using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Net.Sockets;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Gameplay.Systems;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using RCONServerLib;
using ScarletCore.Data;
using ScarletCore.Services;
using ScarletCore.Systems;
using ScarletCore.Utils;
using ScarletRCON.CommandSystem;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("markvaaz")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("V Rising RCON Command Framework")]
[assembly: AssemblyFileVersion("1.2.9.0")]
[assembly: AssemblyInformationalVersion("1.2.9+905e543144e55c1d675f505cb890b8dbc6e22ecd")]
[assembly: AssemblyProduct("ScarletRCON")]
[assembly: AssemblyTitle("ScarletRCON")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.9.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;
}
}
}
namespace ScarletRCON
{
public static class ActionExecutor
{
private static readonly Queue<(Func<object> func, TaskCompletionSource<object> tcs)> _queue = new Queue<(Func<object>, TaskCompletionSource<object>)>();
public static int Count
{
get
{
lock (_queue)
{
return _queue.Count;
}
}
}
public static string Enqueue(Func<object> func)
{
TaskCompletionSource<object> taskCompletionSource = new TaskCompletionSource<object>();
lock (_queue)
{
_queue.Enqueue((func, taskCompletionSource));
}
return taskCompletionSource.Task.GetAwaiter().GetResult()?.ToString();
}
public static void ProcessQueue()
{
while (true)
{
(Func<object>, TaskCompletionSource<object>) tuple;
lock (_queue)
{
if (_queue.Count == 0)
{
break;
}
tuple = _queue.Dequeue();
}
try
{
object result = tuple.Item1();
tuple.Item2.SetResult(result);
}
catch (Exception exception)
{
tuple.Item2.SetException(exception);
}
}
}
}
public static class ECSExtensions
{
public delegate void WithRefHandler<T>(ref T item);
public static EntityManager EntityManager => GameSystems.Server.EntityManager;
public static void With<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
T item = entity.Read<T>();
action(ref item);
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
}
public static void AddWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references)
if (!entity.Has<T>())
{
entity.Add<T>();
}
entity.With(action);
}
public static void HasWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0001: 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)
if (entity.Has<T>())
{
entity.With(action);
}
}
public static void Write<T>(this Entity entity, T componentData) where T : struct
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, componentData);
}
public static T Read<T>(this Entity entity) where T : struct
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).GetComponentData<T>(entity);
}
public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
{
//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_0009: 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_0013: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false);
}
public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct
{
//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_0009: 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)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity);
}
public static bool TryGetComponent<T>(this Entity entity, out T componentData) where T : struct
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
componentData = default(T);
if (entity.Has<T>())
{
componentData = entity.Read<T>();
return true;
}
return false;
}
public static bool Has<T>(this Entity entity) where T : struct
{
//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_0009: 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)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
public static void Add<T>(this Entity entity) where T : struct
{
//IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!entity.Has<T>())
{
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).AddComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
}
public static void Remove<T>(this Entity entity) where T : struct
{
//IL_0001: 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_0013: 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)
if (entity.Has<T>())
{
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
}
public static bool TryGetPlayer(this Entity entity, out Entity player)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
player = Entity.Null;
if (entity.Has<PlayerCharacter>())
{
player = entity;
return true;
}
return false;
}
public static bool IsPlayer(this Entity entity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (entity.Has<PlayerCharacter>())
{
return true;
}
return false;
}
public static bool TryGetAttached(this Entity entity, out Entity attached)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
attached = Entity.Null;
if (entity.TryGetComponent<Attach>(out Attach componentData) && componentData.Parent.Exists())
{
attached = componentData.Parent;
return true;
}
return false;
}
public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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)
teamEntity = Entity.Null;
if (entity.TryGetComponent<TeamReference>(out TeamReference componentData))
{
Entity value = componentData.Value._Value;
if (value.Exists())
{
teamEntity = value;
return true;
}
}
return false;
}
public static bool Exists(this Entity entity)
{
//IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references)
int result;
if (!entity.IsNull())
{
EntityManager entityManager = EntityManager;
result = (((EntityManager)(ref entityManager)).Exists(entity) ? 1 : 0);
}
else
{
result = 0;
}
return (byte)result != 0;
}
public static bool IsNull(this Entity entity)
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
Entity @null = Entity.Null;
return ((Entity)(ref @null)).Equals(entity);
}
public static bool IsDisabled(this Entity entity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return entity.Has<Disabled>();
}
public static PrefabGUID GetPrefabGuid(this Entity entity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
{
return componentData;
}
return PrefabGUID.Empty;
}
public static int GetGuidHash(this Entity entity)
{
//IL_0001: 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)
if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
{
return ((PrefabGUID)(ref componentData)).GuidHash;
}
PrefabGUID empty = PrefabGUID.Empty;
return ((PrefabGUID)(ref empty)).GuidHash;
}
public static Entity GetOwner(this Entity entity)
{
//IL_0001: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<EntityOwner>(out EntityOwner componentData) && componentData.Owner.Exists())
{
return componentData.Owner;
}
return Entity.Null;
}
public static bool HasBuff(this Entity entity, PrefabGUID buffPrefabGuid)
{
//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_0009: 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)
ServerGameManager serverGameManager = GameSystems.ServerGameManager;
return ((ServerGameManager)(ref serverGameManager)).HasBuff(entity, ((PrefabGUID)(ref buffPrefabGuid)).ToIdentifier());
}
public static bool TryGetBuffer<T>(this Entity entity, out DynamicBuffer<T> dynamicBuffer) where T : struct
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
ServerGameManager serverGameManager = GameSystems.ServerGameManager;
if (((ServerGameManager)(ref serverGameManager)).TryGetBuffer<T>(entity, ref dynamicBuffer))
{
return true;
}
dynamicBuffer = default(DynamicBuffer<T>);
return false;
}
public static float3 AimPosition(this Entity entity)
{
//IL_0001: 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_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_001f: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<EntityInput>(out EntityInput componentData))
{
return componentData.AimPosition;
}
return float3.zero;
}
public static float3 Position(this Entity entity)
{
//IL_0001: 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_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_001f: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<Translation>(out Translation componentData))
{
return componentData.Value;
}
return float3.zero;
}
public static int2 GetTileCoord(this Entity entity)
{
//IL_0001: 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_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_001f: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<TilePosition>(out TilePosition componentData))
{
return componentData.Tile;
}
return int2.zero;
}
public static int GetUnitLevel(this Entity entity)
{
//IL_0001: 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)
if (entity.TryGetComponent<UnitLevel>(out UnitLevel componentData))
{
return componentData.Level._Value;
}
return 0;
}
public static void Destroy(this Entity entity, bool immediate = false)
{
//IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (entity.Exists())
{
if (immediate)
{
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(entity);
}
else
{
DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)0, (string)null, 0);
}
}
}
public static void SetTeam(this Entity entity, Entity teamSource)
{
//IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0061: 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)
if (entity.Has<Team>() && entity.Has<TeamReference>() && teamSource.TryGetComponent<Team>(out Team componentData) && teamSource.TryGetComponent<TeamReference>(out TeamReference componentData2))
{
Entity teamRefEntity = componentData2.Value._Value;
int teamId = componentData.Value;
entity.With<TeamReference>((WithRefHandler<TeamReference>)delegate(ref TeamReference teamReference)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
teamReference.Value._Value = teamRefEntity;
});
entity.With<Team>((WithRefHandler<Team>)delegate(ref Team team)
{
team.Value = teamId;
});
}
}
public static void SetPosition(this Entity entity, float3 position)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (entity.Has<Translation>())
{
entity.With<Translation>((WithRefHandler<Translation>)delegate(ref Translation translation)
{
//IL_0003: 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)
translation.Value = position;
});
}
if (entity.Has<LastTranslation>())
{
entity.With<LastTranslation>((WithRefHandler<LastTranslation>)delegate(ref LastTranslation lastTranslation)
{
//IL_0003: 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)
lastTranslation.Value = position;
});
}
}
public static void SetFaction(this Entity entity, PrefabGUID factionPrefabGuid)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (entity.Has<FactionReference>())
{
entity.With<FactionReference>((WithRefHandler<FactionReference>)delegate(ref FactionReference factionReference)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
factionReference.FactionGuid._Value = factionPrefabGuid;
});
}
}
public static bool IsAllies(this Entity entity, Entity player)
{
//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_0009: 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)
ServerGameManager serverGameManager = GameSystems.ServerGameManager;
return ((ServerGameManager)(ref serverGameManager)).IsAllies(entity, player);
}
public static bool IsPlayerOwned(this Entity entity)
{
//IL_0001: 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)
if (entity.TryGetComponent<EntityOwner>(out EntityOwner componentData))
{
return componentData.Owner.IsPlayer();
}
return false;
}
public static Entity GetBuffTarget(this Entity entity)
{
//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_000f: Unknown result type (might be due to invalid IL or missing references)
return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity);
}
}
[BepInPlugin("markvaaz.ScarletRCON", "ScarletRCON", "1.2.9")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
private static Harmony _harmony;
public static Harmony Harmony => _harmony;
public static Plugin Instance { get; private set; }
public static ManualLogSource LogInstance { get; private set; }
public override void Load()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
Instance = this;
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>("markvaaz.ScarletRCON");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.9");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
_harmony = new Harmony("markvaaz.ScarletRCON");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
}
public override bool Unload()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
return true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "markvaaz.ScarletRCON";
public const string PLUGIN_NAME = "ScarletRCON";
public const string PLUGIN_VERSION = "1.2.9";
}
}
namespace ScarletRCON.Utils
{
public static class StringExtensions
{
public static string HighlightColor = "#a963ff";
public static string HighlightErrorColor = "#ff4040";
public static string HighlightWarningColor = "#ffff00";
public static string TextColor = "#ffffff";
public static string ErrorTextColor = "#ff8f8f";
public static string WarningTextColor = "#ffff9e";
public static string Bold(this string text)
{
return "<b>" + text + "</b>";
}
public static string Italic(this string text)
{
return "<i>" + text + "</i>";
}
public static string Underline(this string text)
{
return "<u>" + text + "</u>";
}
public static string Red(this string text)
{
return "<color=red>" + text + "</color>";
}
public static string Green(this string text)
{
return "<color=green>" + text + "</color>";
}
public static string Blue(this string text)
{
return "<color=blue>" + text + "</color>";
}
public static string Yellow(this string text)
{
return "<color=yellow>" + text + "</color>";
}
public static string White(this string text)
{
return "<color=white>" + text + "</color>";
}
public static string Black(this string text)
{
return "<color=black>" + text + "</color>";
}
public static string Orange(this string text)
{
return "<color=orange>" + text + "</color>";
}
public static string Lime(this string text)
{
return "<color=#00FF00>" + text + "</color>";
}
public static string Gray(this string text)
{
return "<color=#cccccc>" + text + "</color>";
}
public static string Hex(this string hex, string text)
{
return $"<color={hex}>{text}</color>";
}
public static string Format(this string text, List<string> highlightColors = null)
{
if (highlightColors == null)
{
highlightColors = new List<string>(1) { HighlightColor };
}
return ApplyFormatting(text, TextColor, highlightColors);
}
public static string FormatError(this string text)
{
return ApplyFormatting(text, ErrorTextColor, new List<string>(1) { HighlightErrorColor });
}
public static string FormatWarning(this string text)
{
return ApplyFormatting(text, WarningTextColor, new List<string>(1) { HighlightWarningColor });
}
private static string ApplyFormatting(string text, string baseColor, List<string> highlightColors)
{
string pattern = "\\*\\*(.*?)\\*\\*";
string pattern2 = "\\*(.*?)\\*";
string pattern3 = "__(.*?)__";
string pattern4 = "~(.*?)~";
string input = Regex.Replace(text, pattern, (Match m) => m.Groups[1].Value.Bold());
input = Regex.Replace(input, pattern2, (Match m) => m.Groups[1].Value.Italic());
input = Regex.Replace(input, pattern3, (Match m) => m.Groups[1].Value.Underline());
int highlightIndex = 0;
input = Regex.Replace(input, pattern4, delegate(Match m)
{
string text2 = ((highlightIndex < highlightColors.Count) ? highlightColors[highlightIndex] : HighlightColor);
if (text2 == null)
{
text2 = HighlightColor;
}
highlightIndex++;
return text2.Hex(m.Groups[1].Value);
});
return baseColor.Hex(input);
}
}
}
namespace ScarletRCON.Patches
{
[HarmonyPatch(typeof(RconListenerSystem), "OnCreate")]
internal class RconInitializePatch
{
private static RemoteConServer server;
private static void Postfix(RconListenerSystem __instance)
{
server = __instance._Server;
CommandEventHandler val = DelegateSupport.ConvertDelegate<CommandEventHandler>((Delegate)new Action<string, IList<string>>(OnCommandReceived));
server.UseCustomCommandHandler = true;
CommandHandler.Initialize();
server.OnCommandReceived += val;
server.TimeoutSeconds = 900;
server.MaxPasswordTries = 3u;
server.BanMinutes = 30;
server.MaxConnections = 1u;
}
public static Socket GetSocket()
{
Enumerator<TcpClient> enumerator = server._clients.GetEnumerator();
while (enumerator.MoveNext())
{
TcpClient current = enumerator.Current;
if (!current.Connected)
{
continue;
}
return current.Client;
}
return null;
}
private static void OnCommandReceived(string cmd, IList<string> args)
{
try
{
List<string> list = new List<string>();
int num = 0;
while (true)
{
try
{
string text = args[num];
if (text == null)
{
break;
}
string @string = Encoding.UTF8.GetString(Encoding.Latin1.GetBytes(text));
list.Add(@string);
num++;
continue;
}
catch
{
}
break;
}
string message = CommandHandler.HandleCommand(cmd.ToLower(), list);
Send(message);
}
catch (Exception ex)
{
Console.WriteLine($"RCON command error: {ex}");
Log.Error(new object[1] { "Error processing command: " + ex.Message });
}
}
public static void Send(string message)
{
Socket socket = GetSocket();
if (socket != null)
{
SendRconPacket(socket, message);
}
}
private static void SendRconPacket(Socket socket, string payload)
{
byte[] bytes = Encoding.UTF8.GetBytes(payload);
int num = 8 + bytes.Length + 2;
byte[] array = new byte[4 + num];
BitConverter.GetBytes(num).CopyTo(array, 0);
BitConverter.GetBytes(0).CopyTo(array, 4);
BitConverter.GetBytes(0).CopyTo(array, 8);
Array.Copy(bytes, 0, array, 12, bytes.Length);
array[12 + bytes.Length] = 0;
array[13 + bytes.Length] = 0;
Il2CppStructArray<byte> val = new Il2CppStructArray<byte>((long)array.Length);
for (int i = 0; i < array.Length; i++)
{
((Il2CppArrayBase<byte>)(object)val)[i] = array[i];
}
socket.Send(val, 0, array.Length, (SocketFlags)0);
}
}
[HarmonyPatch(typeof(RconListenerSystem), "OnUpdate")]
internal class RconUpdatePatch
{
private static void Postfix()
{
if (ActionExecutor.Count != 0)
{
ActionExecutor.ProcessQueue();
}
}
}
internal static class StringExtensions
{
public static IntPtr ToIntPtr(this string str)
{
return IL2CPP.ManagedStringToIl2Cpp(str);
}
}
}
namespace ScarletRCON.Commands
{
[RconCommandCategory("Help")]
public static class HelpCommand
{
[RconCommand("help", "Show info about a specific command.", null, false)]
public static string Help(string commandName)
{
if (CommandHandler.TryGetCommands(commandName, out var commands))
{
string value = "\u001b[97m";
string text = "\u001b[90m";
string text2 = "\u001b[0m";
string text3 = "";
foreach (RconCommandDefinition item in commands)
{
text3 += $"{value}{item.Name}{text2}: {text}{item.Description}{text2}\n";
text3 = ((!string.IsNullOrEmpty(item.Usage)) ? (text3 + $"{text}- usage: {item.Usage}{text2}\n") : (text3 + text + "- this command has no parameters" + text2 + "\n"));
}
return text3;
}
return "Unknown command '" + commandName + "'";
}
[RconCommand("help", "List all commands.", null, false)]
public static string ListAll()
{
string text = "";
IEnumerable<KeyValuePair<string, List<RconCommandDefinition>>> orderedCategories = GetOrderedCategories();
foreach (KeyValuePair<string, List<RconCommandDefinition>> item in orderedCategories)
{
text = text + "\n\u001b[97m" + item.Key + "\u001b[0m:\n";
foreach (RconCommandDefinition item2 in item.Value.OrderBy<RconCommandDefinition, string>((RconCommandDefinition c) => c.Name, StringComparer.OrdinalIgnoreCase))
{
text += $"\u001b[37m- {item2.Name}\u001b[0m:\u001b[90m{(string.IsNullOrEmpty(item2.Usage) ? "" : (" " + item2.Usage))} - {item2.Description}\u001b[0m\n";
}
}
return text + "\nTotal commands: " + CommandHandler.Commands.Count;
}
public static IEnumerable<KeyValuePair<string, List<RconCommandDefinition>>> GetOrderedCategories()
{
Dictionary<string, List<RconCommandDefinition>> dictionary = new Dictionary<string, List<RconCommandDefinition>>(StringComparer.OrdinalIgnoreCase);
foreach (KeyValuePair<string, List<RconCommandDefinition>> commandCategory in CommandHandler.CommandCategories)
{
dictionary[commandCategory.Key] = commandCategory.Value.ToList();
}
foreach (KeyValuePair<string, List<RconCommandDefinition>> customCommandCategory in CommandHandler.CustomCommandCategories)
{
if (dictionary.TryGetValue(customCommandCategory.Key, out var value))
{
value.AddRange(customCommandCategory.Value);
}
else
{
dictionary[customCommandCategory.Key] = customCommandCategory.Value.ToList();
}
}
return dictionary.OrderBy<KeyValuePair<string, List<RconCommandDefinition>>, string>((KeyValuePair<string, List<RconCommandDefinition>> x) => x.Key, StringComparer.OrdinalIgnoreCase);
}
}
[RconCommandCategory("Inventory Management")]
public static class InventoryCommands
{
[RconCommand("giveitem", "Give an item to a player.", null, false)]
public static string Give(string playerName, string prefabGUID, int amount)
{
//IL_006b: 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)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
PrefabGUID val2 = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID, ref val2))
{
return "Invalid PrefabGUID.";
}
if (InventoryService.IsFull(val.CharacterEntity))
{
return "Player '" + playerName + "' has a full inventory.";
}
InventoryService.AddItem(val.CharacterEntity, val2, amount);
return $"Given {amount} {((PrefabGUID)(ref val2)).GuidHash} to {playerName}.";
}
[RconCommand("giveitemall", "Give an item to all online players.", null, false)]
public static string GiveAll(int prefabGUID, int amount)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
PrefabGUID val = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID.ToString(), ref val))
{
return "Invalid Prefab GUID.";
}
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
if (allPlayer.IsOnline && !InventoryService.IsFull(allPlayer.CharacterEntity))
{
InventoryService.AddItem(allPlayer.CharacterEntity, val, amount);
}
}
return $"Given {amount} {val} to all players.";
}
[RconCommand("removeitem", "Remove an item from a player's inventory.", null, false)]
public static string RemoveItem(string playerName, string prefabGUID, int amount)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
PrefabGUID val2 = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID, ref val2))
{
return "Invalid PrefabGUID.";
}
if (InventoryService.HasAmount(val.CharacterEntity, val2, amount))
{
InventoryService.RemoveItem(val.CharacterEntity, val2, amount);
return $"Removed {amount} {((PrefabGUID)(ref val2)).GuidHash} from {playerName}'s inventory.";
}
return $"Player '{playerName}' does not have {amount} {((PrefabGUID)(ref val2)).GuidHash} in their inventory.";
}
[RconCommand("removeitemall", "Remove an item from all online players' inventories.", null, false)]
public static string RemoveItemAll(int prefabGUID, int amount)
{
//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_00b8: 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)
PrefabGUID val = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID.ToString(), ref val))
{
return "Invalid Prefab GUID.";
}
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
if (allPlayer.IsOnline && InventoryService.HasAmount(allPlayer.CharacterEntity, val, amount))
{
InventoryService.RemoveItem(allPlayer.CharacterEntity, val, amount);
}
}
return $"Removed {amount} {val} from all players' inventories.";
}
}
[RconCommandCategory("Messaging")]
public static class MessagingCommands
{
[RconCommand("announce", "Send a message to all online players.", "<message>", false)]
public static string Announce(List<string> args)
{
string text = string.Join(" ", args);
MessageService.SendAll(text);
return "Sent announcement: " + text;
}
[RconCommand("announcerestart", "Announce server restart in X minutes.", "<minutes>", false)]
public static string AnnounceRestart(int minutes)
{
string text = $"The server will restart in {minutes} minutes!";
MessageService.SendAll(text);
return "Sent announcement: " + text;
}
[RconCommand("private", "Send a private message to a player.", "<playerName> <message>", false)]
public static string PrivateMessage(string playerName, string message)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
MessageService.Send(val.UserEntity.Read<User>(), message);
return "Sent private message to " + val.Name + ": " + message;
}
}
[RconCommandCategory("Player Administration")]
public static class PlayerCommand
{
private static PrefabGUID FreezeBuffGUID = new PrefabGUID(-1527408583);
private static PrefabGUID WoundedBuffGUID = new PrefabGUID(-1992158531);
[RconCommand("playerinfo", "Show info about a player.", null, false)]
public static string PlayerInfo(string playerName)
{
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
string text = "- Character Name: " + val.Name + "\n";
text += $"- Steam ID: {val.PlatformId}\n";
text += $"- Profile URL: https://steamcommunity.com/profiles/{val.PlatformId}\n";
if (val.IsOnline)
{
text += $"- Connected Since: {val.ConnectedSince}\n";
}
return text + "- " + (val.IsOnline ? "Online" : "Offline") + "\n";
}
[RconCommand("kick", "Kick a player.", null, false)]
public static string Kick(string playerName)
{
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
MessageService.SendAll(val.Name + " got ~kicked~ by an admin.");
KickBanService.Kick(val.PlatformId);
return "Kicked " + playerName + ".";
}
[RconCommand("ban", " Ban a player by ID.", null, false)]
public static string BanById(ulong playerId)
{
if (!KickBanService.IsBanned(playerId))
{
KickBanService.Ban(playerId);
return $"Banned {playerId} by ID.";
}
return $"Player '{playerId}' is already banned.";
}
[RconCommand("ban", "Ban a player by name.", null, false)]
public static string BanByName(string playerName)
{
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.\nTry using the ID instead.";
}
if (KickBanService.IsBanned(val.PlatformId))
{
return "Player '" + playerName + "' is already banned.";
}
MessageService.SendAll(val.Name + " got ~banned~ by an admin.");
KickBanService.Ban(val.PlatformId);
return "Banned " + playerName + " by name.";
}
[RconCommand("unban", "Unban a player by ID.", null, false)]
public static string Unban(ulong playerId)
{
if (KickBanService.IsBanned(playerId))
{
KickBanService.Unban(playerId);
return $"Unbanned {playerId}.";
}
return $"Player '{playerId}' is not banned.";
}
[RconCommand("addadmin", "Add a player as admin by ID.", null, false)]
public static string AddAdmin(ulong playerId)
{
if (!AdminService.IsAdmin(playerId))
{
AdminService.AddAdmin(playerId);
return $"Added {playerId} as admin.";
}
return $"Player '{playerId}' is already an admin.";
}
[RconCommand("addadmin", "Add a player as admin.", null, false)]
public static string AddAdmin(string playerName)
{
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (val.IsAdmin)
{
return "Player '" + playerName + "' is already an admin.";
}
AdminService.AddAdmin(val.PlatformId);
return "Added " + playerName + " as admin.";
}
[RconCommand("removeadmin", "Remove a player as admin by ID.", null, false)]
public static string RemoveAdmin(ulong playerId)
{
if (AdminService.IsAdmin(playerId))
{
AdminService.RemoveAdmin(playerId);
return $"Removed {playerId} as admin.";
}
return $"Player '{playerId}' is not an admin.";
}
[RconCommand("removeadmin", "Remove a player as admin.", null, false)]
public static string RemoveAdmin(string playerName)
{
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsAdmin)
{
return "Player '" + playerName + "' is not an admin.";
}
AdminService.RemoveAdmin(val.PlatformId);
return "Removed " + playerName + " as admin.";
}
[RconCommand("buff", "Apply a buff to a player.", null, false)]
public static string BuffPlayer(string playerName, string prefabGUID, int duration)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
PrefabGUID val2 = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID, ref val2))
{
return "Invalid PrefabGUID.";
}
if (!BuffService.HasBuff(val.CharacterEntity, val2))
{
if (BuffService.TryApplyBuff(val.CharacterEntity, val2, (float)duration))
{
return $"Applied buff {prefabGUID} to {playerName} for {duration} seconds.";
}
return $"Failed to apply buff {prefabGUID} to {playerName}.";
}
return $"Player {playerName} already has buff {((PrefabGUID)(ref val2)).GuidHash}.";
}
[RconCommand("debuff", "Remove a buff from a player.", null, false)]
public static string RemoveBuff(string playerName, string prefabGUID)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
PrefabGUID val2 = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID, ref val2))
{
return "Invalid PrefabGUID.";
}
if (BuffService.HasBuff(val.CharacterEntity, val2))
{
BuffService.TryRemoveBuff(val.CharacterEntity, val2);
return $"Removed buff {prefabGUID} from {playerName}.";
}
return $"Player {playerName} does not have buff {((PrefabGUID)(ref val2)).GuidHash}.";
}
[RconCommand("freeze", "Freeze a player for x seconds.", null, false)]
public static string Freeze(string playerName, int duration)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a8: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (BuffService.HasBuff(val.CharacterEntity, FreezeBuffGUID))
{
return "Player " + playerName + " is already frozen.";
}
if (!BuffService.TryApplyBuff(val.CharacterEntity, FreezeBuffGUID, (float)duration))
{
return "Failed to freeze " + playerName + ".";
}
MessageService.Send(val.User, $"You’ve been ~frozen~ in place for ~{duration}~ seconds by an admin!");
return "Frozen " + playerName + ".";
}
[RconCommand("unfreeze", "Unfreeze a player.", null, false)]
public static string Unfreeze(string playerName)
{
//IL_0049: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (!BuffService.HasBuff(val.CharacterEntity, FreezeBuffGUID))
{
return "Player " + playerName + " is not frozen.";
}
BuffService.TryRemoveBuff(val.CharacterEntity, FreezeBuffGUID);
MessageService.Send(val.User, "You have been ~unfrozen~ by an admin!");
return "Unfroze " + playerName + ".";
}
[RconCommand("heal", "Full heal a player.", "<playerName>", false)]
public static string Heal(string playerName)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
Entity characterEntity = val.CharacterEntity;
Health val2 = characterEntity.Read<Health>();
val2.Value = ModifiableFloat.op_Implicit(val2.MaxHealth);
val2.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val2.MaxHealth);
characterEntity.Write<Health>(val2);
MessageService.Send(val.User, "You have been ~healed~ by an admin!");
return "Healed " + val.Name + ".";
}
[RconCommand("healradius", "Full heal all players within a radius of specific coordinates.", "<x> <z> <radius>", false)]
public static string HealRadius(float x, float z, float radius)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_00a1: 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_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_00bd: Unknown result type (might be due to invalid IL or missing references)
if (radius <= 0f)
{
return "Radius must be greater than 0.";
}
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
float3 val = allPlayer.CharacterEntity.Position();
float num = math.distance(new float3(x, 0f, z), new float3(val.x, 0f, val.z));
if (!(num > radius))
{
Health val2 = characterEntity.Read<Health>();
val2.Value = ModifiableFloat.op_Implicit(val2.MaxHealth);
val2.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val2.MaxHealth);
characterEntity.Write<Health>(val2);
MessageService.Send(allPlayer.User, "You have been ~healed~ by an admin!");
}
}
return $"Healed all players within radius {radius} around ({x}, {z}).";
}
[RconCommand("healradius", "Full heal all players within a player's radius.", "<playerName> <radius>", false)]
public static string HealRadius(string playerName, float radius)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (radius <= 0f)
{
return "Radius must be greater than 0.";
}
float3 val2 = val.CharacterEntity.Position();
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
float3 val3 = allPlayer.CharacterEntity.Position();
float num = math.distance(new float3(val2.x, 0f, val2.z), new float3(val3.x, 0f, val3.z));
if (!(num > radius))
{
Health val4 = characterEntity.Read<Health>();
val4.Value = ModifiableFloat.op_Implicit(val4.MaxHealth);
val4.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val4.MaxHealth);
characterEntity.Write<Health>(val4);
MessageService.Send(allPlayer.User, "You have been ~healed~ by an admin!");
}
}
return $"Healed all players within radius {radius} around {playerName}.";
}
[RconCommand("healall", "Full heal all players.", null, false)]
public static string HealAll()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_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)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
Health val = characterEntity.Read<Health>();
val.Value = ModifiableFloat.op_Implicit(val.MaxHealth);
val.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val.MaxHealth);
characterEntity.Write<Health>(val);
MessageService.Send(allPlayer.User, "You have been ~healed~ by an admin!");
}
return "Healed all players.";
}
[RconCommand("wound", "Wound a player.", "<playerName>", false)]
public static string Wound(string playerName)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (!BuffService.TryApplyBuff(val.CharacterEntity, WoundedBuffGUID, 0f))
{
return "Failed to wound " + playerName + ".";
}
MessageService.Send(val.User, "You have been ~wounded~ by an admin!");
return "Wounded " + val.Name + ".";
}
[RconCommand("kill", "Kill a player.", "<playerName>", false)]
public static string Kill(string playerName)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
StatChangeUtility.KillEntity(GameSystems.EntityManager, val.CharacterEntity, val.CharacterEntity, GameSystems.ServerGameManager.ServerTime, (StatChangeReason)1, true);
MessageService.Send(val.User, "You have been ~killed~ by an admin!");
return "Killed " + val.Name + ".";
}
[RconCommand("revive", "Revive a player.", "<playerName>", false)]
public static string Revive(string playerName)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_00ba: 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_008f: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_0118: 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)
//IL_00cd: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: 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_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
Entity characterEntity = val.CharacterEntity;
Health val2 = characterEntity.Read<Health>();
Entity val3 = default(Entity);
if (BuffUtility.TryGetBuff<EntityManager>(GameSystems.EntityManager, characterEntity, PrefabIdentifier.op_Implicit(WoundedBuffGUID), ref val3))
{
DestroyUtility.Destroy(GameSystems.EntityManager, val3, (DestroyDebugReason)13, (string)null, 0);
val2.Value = ModifiableFloat.op_Implicit(val2.MaxHealth);
val2.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val2.MaxHealth);
characterEntity.Write<Health>(val2);
}
if (val2.IsDead)
{
LocalToWorld val4 = characterEntity.Read<LocalToWorld>();
float3 position = ((LocalToWorld)(ref val4)).Position;
EntityCommandBuffer val5 = GameSystems.EntityCommandBufferSystem.CreateCommandBuffer();
GameSystems.ServerBootstrapSystem.RespawnCharacter(val5, val.UserEntity, new Nullable_Unboxed<float3>
{
value = position
}, characterEntity, default(Entity), -1);
}
MessageService.Send(val.User, "You've been ~revived~ by an admin");
return "Revived " + val.Name + ".";
}
[RconCommand("reviveall", "Revive all players.", null, false)]
public static string ReviveAll()
{
//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_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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_007c: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
Entity val2 = default(Entity);
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
Health val = characterEntity.Read<Health>();
if (BuffUtility.TryGetBuff<EntityManager>(GameSystems.EntityManager, characterEntity, PrefabIdentifier.op_Implicit(WoundedBuffGUID), ref val2))
{
DestroyUtility.Destroy(GameSystems.EntityManager, val2, (DestroyDebugReason)13, (string)null, 0);
val.Value = ModifiableFloat.op_Implicit(val.MaxHealth);
val.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val.MaxHealth);
characterEntity.Write<Health>(val);
}
if (val.IsDead)
{
LocalToWorld val3 = characterEntity.Read<LocalToWorld>();
float3 position = ((LocalToWorld)(ref val3)).Position;
EntityCommandBuffer val4 = GameSystems.EntityCommandBufferSystem.CreateCommandBuffer();
GameSystems.ServerBootstrapSystem.RespawnCharacter(val4, allPlayer.UserEntity, new Nullable_Unboxed<float3>
{
value = position
}, characterEntity, default(Entity), -1);
}
MessageService.Send(allPlayer.User, "You've been ~revived~ by an admin");
}
return "Revived all players.";
}
[RconCommand("reviveradius", "Revive all players within a radius.", null, false)]
public static string ReviveRadius(int x, int y, int z, int radius)
{
//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_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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0130: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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_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)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: 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)
Entity val3 = default(Entity);
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
float3 val = allPlayer.CharacterEntity.Position();
float num = math.distance(new float3((float)x, 0f, (float)z), new float3(val.x, 0f, val.z));
if (!(num > (float)radius))
{
Health val2 = characterEntity.Read<Health>();
if (BuffUtility.TryGetBuff<EntityManager>(GameSystems.EntityManager, characterEntity, PrefabIdentifier.op_Implicit(WoundedBuffGUID), ref val3))
{
DestroyUtility.Destroy(GameSystems.EntityManager, val3, (DestroyDebugReason)13, (string)null, 0);
val2.Value = ModifiableFloat.op_Implicit(val2.MaxHealth);
val2.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val2.MaxHealth);
characterEntity.Write<Health>(val2);
}
if (val2.IsDead)
{
LocalToWorld val4 = characterEntity.Read<LocalToWorld>();
float3 position = ((LocalToWorld)(ref val4)).Position;
EntityCommandBuffer val5 = GameSystems.EntityCommandBufferSystem.CreateCommandBuffer();
GameSystems.ServerBootstrapSystem.RespawnCharacter(val5, allPlayer.UserEntity, new Nullable_Unboxed<float3>
{
value = position
}, characterEntity, default(Entity), -1);
}
MessageService.Send(allPlayer.User, "You've been ~revived~ by an admin");
}
}
return "Revived all players.";
}
[RconCommand("reviveradius", "Revive all players within a player's radius.", null, false)]
public static string ReviveRadius(string playerName, int radius)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
float3 val2 = val.CharacterEntity.Position();
Entity val5 = default(Entity);
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
Entity characterEntity = allPlayer.CharacterEntity;
float3 val3 = allPlayer.CharacterEntity.Position();
float num = math.distance(new float3(val2.x, 0f, val2.z), new float3(val3.x, 0f, val3.z));
if (!(num > (float)radius))
{
Health val4 = characterEntity.Read<Health>();
if (BuffUtility.TryGetBuff<EntityManager>(GameSystems.EntityManager, characterEntity, PrefabIdentifier.op_Implicit(WoundedBuffGUID), ref val5))
{
DestroyUtility.Destroy(GameSystems.EntityManager, val5, (DestroyDebugReason)13, (string)null, 0);
val4.Value = ModifiableFloat.op_Implicit(val4.MaxHealth);
val4.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val4.MaxHealth);
characterEntity.Write<Health>(val4);
}
if (val4.IsDead)
{
LocalToWorld val6 = characterEntity.Read<LocalToWorld>();
float3 position = ((LocalToWorld)(ref val6)).Position;
EntityCommandBuffer val7 = GameSystems.EntityCommandBufferSystem.CreateCommandBuffer();
GameSystems.ServerBootstrapSystem.RespawnCharacter(val7, allPlayer.UserEntity, new Nullable_Unboxed<float3>
{
value = position
}, characterEntity, default(Entity), -1);
}
MessageService.Send(allPlayer.User, "You've been ~revived~ by an admin");
}
}
return "Revived all players.";
}
[RconCommand("revealmap", "Reveal the map for a player.", null, false)]
public static string RevealMap(string playerName)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
RevealMapService.RevealFullMap(val);
MessageService.Send(val.User, "Your map has been ~revealed~ by an admin!");
return "Revealed map for " + val.Name + ".";
}
[RconCommand("revealmapradius", "Reveal the map within a radius of specific coordinates for a player.", null, false)]
public static string RevealMapRadius(string playerName, float x, float z, float radius)
{
//IL_0070: 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)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (radius <= 0f)
{
return "Radius must be greater than 0.";
}
RevealMapService.RevealMapRadius(val, new float3(x, 0f, z), radius);
MessageService.Send(val.User, "Your map has been partially ~revealed~ by an admin!");
return $"Revealed map for {val.Name} within radius {radius} around ({x}, {z}).";
}
[RconCommand("revealmapradius", "Reveal the map within a radius around another player.", null, false)]
public static string RevealMapRadius(string playerName, string targetPlayerName, float radius)
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
PlayerData val2 = default(PlayerData);
if (!PlayerService.TryGetByName(targetPlayerName, ref val2))
{
return "Center player '" + targetPlayerName + "' was not found.";
}
if (!val2.IsOnline)
{
return "Center player '" + targetPlayerName + "' is not currently online.";
}
if (radius <= 0f)
{
return "Radius must be greater than 0.";
}
RevealMapService.RevealMapRadius(val, val2.CharacterEntity.Position(), radius);
MessageService.Send(val.User, "Your map has been partially ~revealed~ by an admin!");
return $"Revealed map for {val.Name} within radius {radius} around {val2.Name}.";
}
[RconCommand("revealmaprect", "Reveal the map within a rectangle for a player.", null, false)]
public static string RevealMapRect(string playerName, float x, float z, float width, float height)
{
//IL_007c: 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)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
if (width <= 0f || height <= 0f)
{
return "Width and height must be greater than 0.";
}
RevealMapService.RevealMapRectangle(val, new float3(x, 0f, z), width, height);
MessageService.Send(val.User, "Your map has been partially ~revealed~ by an admin!");
return $"Revealed map for {val.Name} within rectangle at ({x}, {z}) with width {width} and height {height}.";
}
[RconCommand("revealmapall", "Reveal the map for all players.", null, false)]
public static string RevealMapAll()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
if (allPlayer.IsOnline)
{
RevealMapService.RevealFullMap(allPlayer);
MessageService.Send(allPlayer.User, "Your map has been ~revealed~ by an admin!");
}
}
return "Revealed map for all online players.";
}
[RconCommand("hidemap", "Hide/obscure the map for a player.", null, false)]
public static string HideMap(string playerName)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetByName(playerName, ref val))
{
return "Player '" + playerName + "' was not found.";
}
if (!val.IsOnline)
{
return "Player '" + playerName + "' is not currently online.";
}
RevealMapService.HideFullMap(val);
MessageService.Send(val.User, "Your map has been ~hidden~ by an admin!");
return "Hidden map for " + val.Name + ".";
}
}
[RconCommandCategory("Server Administration")]
public static class ServerCommands
{
[RconCommand("shutdown", "Shuts down the server gracefully.", null, false)]
public static string Shutdown()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (!GameSystems.Initialized)
{
return "Game systems not initialized. Cannot shutdown.";
}
GameSystems.TriggerPersistenceSaveSystem.TriggerAutoSave(GetServerRuntimeSettings());
ShutdownAsync();
string value = "\u001b[97m";
string value2 = "\u001b[90m";
string value3 = "\u001b[0m";
return $"{value}Game saved successfully!{value3}\n{value2}Server will shut down in 3 seconds...{value3}\n{value2}Server context window will close in 10 seconds.{value3}";
}
private static async void ShutdownAsync()
{
await Task.Delay(TimeSpan.FromSeconds(3.0));
Application.Quit();
await Task.Delay(TimeSpan.FromSeconds(7.0));
try
{
Process.GetCurrentProcess().Kill();
}
catch
{
}
}
[RconCommand("save", "Save the game", null, false)]
public static string Save()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
GameSystems.TriggerPersistenceSaveSystem.TriggerAutoSave(GetServerRuntimeSettings());
return "Game saved'.";
}
[RconCommand("serverstats", "Show server statistics.", null, false)]
public static string ServerStats()
{
List<PlayerData> allPlayers = PlayerService.AllPlayers;
int num = 0;
foreach (PlayerData item in allPlayers)
{
if (item.IsOnline)
{
num++;
}
}
TimeSpan value = DateTime.Now - Process.GetCurrentProcess().StartTime;
string text = "Server Stats\n";
Process currentProcess = Process.GetCurrentProcess();
text += $"- Players Online: {num}\n";
text += $"- Uptime: {value:hh\\:mm\\:ss}\n";
return text + $"- Memory Usage: {currentProcess.WorkingSet64 / 1048576} MB\n";
}
[RconCommand("settings", "Live-updates a server setting. Does not persist after restart at the moment. This is an experimental feature, use at your own risk.", null, false)]
public static string Settings(string settingsPath, string settingsValue)
{
object obj = null;
if (settingsPath.StartsWith("serverhostsettings.", StringComparison.OrdinalIgnoreCase))
{
obj = SettingsManager.ServerHostSettings;
string text = settingsPath;
int length = "serverhostsettings.".Length;
settingsPath = text.Substring(length, text.Length - length);
}
else
{
if (!settingsPath.StartsWith("servergamesettings.", StringComparison.OrdinalIgnoreCase))
{
return "Invalid root setting: must start with 'serverhostsettings.' or 'servergamesettings.'";
}
obj = SettingsManager.ServerGameSettings;
string text = settingsPath;
int length = "servergamesettings.".Length;
settingsPath = text.Substring(length, text.Length - length);
}
string[] array = settingsPath.Split('.');
object obj2 = obj;
PropertyInfo propertyInfo = null;
for (int i = 0; i < array.Length; i++)
{
Type type = obj2.GetType();
propertyInfo = type.GetProperty(array[i], BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);
if (propertyInfo == null)
{
return $"Invalid property: '{array[i]}' not found in '{type.Name}'";
}
if (i < array.Length - 1)
{
obj2 = propertyInfo.GetValue(obj2);
if (obj2 == null)
{
return "Null reference: '" + array[i] + "' is null.";
}
}
}
try
{
object value = Convert.ChangeType(settingsValue, propertyInfo.PropertyType);
propertyInfo.SetValue(obj2, value);
return $"Setting '{settingsPath}' changed to '{settingsValue}'";
}
catch (Exception ex)
{
return "Failed to set property: " + ex.Message;
}
}
[RconCommand("settings", "Get the value of a server setting.", null, false)]
public static string GetSettings(string settingsPath)
{
object obj;
if (settingsPath.StartsWith("serverhostsettings.", StringComparison.OrdinalIgnoreCase))
{
obj = SettingsManager.ServerHostSettings;
string text = settingsPath;
int length = "serverhostsettings.".Length;
settingsPath = text.Substring(length, text.Length - length);
}
else
{
if (!settingsPath.StartsWith("servergamesettings.", StringComparison.OrdinalIgnoreCase))
{
return "Invalid root setting: must start with 'serverhostsettings.' or 'servergamesettings.'";
}
obj = SettingsManager.ServerGameSettings;
string text = settingsPath;
int length = "servergamesettings.".Length;
settingsPath = text.Substring(length, text.Length - length);
}
string[] array = settingsPath.Split('.');
object obj2 = obj;
for (int i = 0; i < array.Length; i++)
{
Type type = obj2.GetType();
PropertyInfo property = type.GetProperty(array[i], BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);
if (property == null)
{
return $"Invalid property: '{array[i]}' not found in '{type.Name}'";
}
obj2 = property.GetValue(obj2);
if (obj2 == null)
{
return "Null reference: '" + array[i] + "' is null.";
}
}
return $"Setting '{settingsPath}' is '{obj2}'";
}
[RconCommand("listadmins", "List all admins.", null, false)]
public static string ListAdmins()
{
List<PlayerData> admins = PlayerService.GetAdmins();
string text = "";
int num = 0;
foreach (PlayerData item in admins)
{
num++;
string value = (item.IsOnline ? "\u001b[32m●\u001b[0m" : "\u001b[31m●\u001b[0m");
text += $"- \u001b[97m{item.Name}\u001b[0m \u001b[90m({item.PlatformId})\u001b[0m {value}\n";
}
return text + $"Total admins: {num}";
}
[RconCommand("listplayers", "List online players.", null, false)]
public static string ListOnlinePlayers()
{
string text = "";
int num = 0;
foreach (PlayerData allPlayer in PlayerService.AllPlayers)
{
if (allPlayer.IsOnline)
{
num++;
string value = (allPlayer.IsOnline ? "\u001b[32m●\u001b[0m" : "\u001b[31m●\u001b[0m");
text += $"- \u001b[97m{allPlayer.Name}\u001b[0m \u001b[90m({allPlayer.PlatformId})\u001b[0m {value}\n";
}
}
if (num == 0)
{
return "No players online.";
}
return text + $"Total online players: {num}";
}
[RconCommand("listallplayers", "List online players.", null, false)]
public static string ListAllPlayers(int page)
{
List<PlayerData> list = PlayerService.AllPlayers ?? new List<PlayerData>();
if (!list.Any())
{
return "No players found.";
}
int num = (int)Math.Ceiling((double)list.Count / 20.0);
page = Math.Max(1, Math.Min(page, num));
int count = (page - 1) * 20;
IEnumerable<PlayerData> enumerable = list.Skip(count).Take(20);
string text = "";
int num2 = 0;
foreach (PlayerData item in enumerable)
{
string value = (item.IsOnline ? "\u001b[32m●\u001b[0m" : "\u001b[31m●\u001b[0m");
if (item.IsOnline)
{
num2++;
}
text += $"- \u001b[97m{item.Name}\u001b[0m \u001b[90m({item.PlatformId})\u001b[0m {value}\n";
}
int value2 = list.Count - num2;
text += $"Total players: {list.Count} ({num2} online, {value2} offline)";
if (num > 1)
{
text += $"\nPage {page} of {num}";
}
return text;
}
[RconCommand("listallplayers", "List online players.", null, false)]
public static string ListAllPlayers()
{
return ListAllPlayers(1);
}
[RconCommand("listclans", "List all clans.", null, false)]
public static string ListClans()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
string text = "Clans:\n";
string value = "\u001b[97m";
string value2 = "\u001b[90m";
string value3 = "\u001b[0m";
List<ClanTeam> clanTeams = ClanService.GetClanTeams();
if (clanTeams.Count == 0)
{
return "No clans found.";
}
foreach (ClanTeam item in clanTeams)
{
FixedString64Bytes name = item.Name;
string value4 = ((object)(FixedString64Bytes)(ref name)).ToString();
text += $"-{value} Clan Name{value3}: {value2}{value4}{value3}\n";
}
return text;
}
private static ServerRuntimeSettings GetServerRuntimeSettings()
{
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = GameSystems.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<ServerRuntimeSettings>() });
ServerRuntimeSettings result = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2))[0].Read<ServerRuntimeSettings>();
((EntityQuery)(ref val)).Dispose();
return result;
}
}
[RconCommandCategory("Summon")]
public static class SummonCommand
{
[RconCommand("summon", "Summon an entity at specific coordinates.", null, false)]
public static string Summon(string prefabGUID, float x, float y, float z, int quantity, int lifeTime, bool disableWhenNoPlayersInRange)
{
//IL_001c: 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_003a: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0074: 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)
PrefabGUID val = default(PrefabGUID);
if (!PrefabGUID.TryParse(prefabGUID, ref val))
{
return "Invalid Prefab GUID.";
}
List<Entity> list = SpawnerService.ImmediateSpawn(val, new float3(x, y, z), 2f, 2f, (float)lifeTime, quantity, default(Entity));
if (disableWhenNoPlayersInRange)
{
foreach (Entity item in list)
{
if (item.Has<DisableWhenNoPlayersInRange>())
{
item.Remove<DisableWhenNoPlayersInRange>();
}
if (item.Has<DisableWhenNoPlayersInRangeOfChunk>())
{
item.Remove<DisableWhenNoPlayersInRangeOfChunk>();
}
}
}
return $"Summoned {((PrefabGUID)(ref val)).GuidHash} at ({x}, {y}, {z}).";
}
[RconCommand("summon", "Summon an entity at a player's location.", null, false)]
public static string Summon(string prefabGUID, string playerName, int quantity, int lifeTime, bool disableWhenNoPlayersInRange)
{
//IL_006d: Unknown result type (might be