2015-08-20 01:06:44 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2021-07-11 18:26:30 -04:00
|
|
|
|
using System.Net;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Serilog.Context;
|
2018-04-08 02:44:42 -04:00
|
|
|
|
using SharedLibraryCore.Helpers;
|
|
|
|
|
using SharedLibraryCore.Dtos;
|
|
|
|
|
using SharedLibraryCore.Configuration;
|
2018-04-11 18:24:21 -04:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2018-11-05 22:01:29 -05:00
|
|
|
|
using SharedLibraryCore.Database.Models;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using Data.Models;
|
2018-04-08 02:44:42 -04:00
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2020-11-17 19:24:54 -05:00
|
|
|
|
public abstract class Server : IGameServer
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2017-08-08 22:44:52 -04:00
|
|
|
|
public enum Game
|
|
|
|
|
{
|
2019-02-05 19:02:45 -05:00
|
|
|
|
COD = -1,
|
|
|
|
|
UKN = 0,
|
|
|
|
|
IW3 = 1,
|
|
|
|
|
IW4 = 2,
|
|
|
|
|
IW5 = 3,
|
|
|
|
|
IW6 = 4,
|
2019-05-08 21:34:17 -04:00
|
|
|
|
T4 = 5,
|
|
|
|
|
T5 = 6,
|
|
|
|
|
T6 = 7,
|
2021-04-16 14:35:51 -04:00
|
|
|
|
T7 = 8,
|
2021-06-03 11:51:03 -04:00
|
|
|
|
SHG1 = 9,
|
|
|
|
|
CSGO = 10
|
2017-08-08 22:44:52 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-11 18:31:26 -05:00
|
|
|
|
public Server(ILogger<Server> logger, SharedLibraryCore.Interfaces.ILogger deprecatedLogger,
|
|
|
|
|
ServerConfiguration config, IManager mgr, IRConConnectionFactory rconConnectionFactory,
|
|
|
|
|
IGameLogReaderFactory gameLogReaderFactory)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Password = config.Password;
|
2018-03-14 01:36:25 -04:00
|
|
|
|
IP = config.IPAddress;
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Port = config.Port;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
Manager = mgr;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
Logger = deprecatedLogger;
|
2018-03-14 01:36:25 -04:00
|
|
|
|
ServerConfig = config;
|
2019-10-09 16:51:02 -04:00
|
|
|
|
EventProcessing = new SemaphoreSlim(1, 1);
|
2020-12-02 15:29:49 -05:00
|
|
|
|
Clients = new List<EFClient>(new EFClient[64]);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
Reports = new List<Report>();
|
2018-11-05 22:01:29 -05:00
|
|
|
|
ClientHistory = new Queue<PlayerHistory>();
|
2018-03-09 03:01:12 -05:00
|
|
|
|
ChatHistory = new List<ChatInfo>();
|
2017-06-19 13:58:01 -04:00
|
|
|
|
NextMessage = 0;
|
2018-03-30 00:13:40 -04:00
|
|
|
|
CustomSayEnabled = Manager.GetApplicationSettings().Configuration().EnableCustomSayName;
|
|
|
|
|
CustomSayName = Manager.GetApplicationSettings().Configuration().CustomSayName;
|
2020-05-04 17:50:02 -04:00
|
|
|
|
this.gameLogReaderFactory = gameLogReaderFactory;
|
2021-06-03 11:51:03 -04:00
|
|
|
|
RConConnectionFactory = rconConnectionFactory;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
ServerLogger = logger;
|
2017-06-12 13:50:00 -04:00
|
|
|
|
InitializeTokens();
|
|
|
|
|
InitializeAutoMessages();
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-11 18:26:30 -04:00
|
|
|
|
public long EndPoint => IPAddress.TryParse(IP, out _)
|
|
|
|
|
? Convert.ToInt64($"{IP.Replace(".", "")}{Port}")
|
|
|
|
|
: $"{IP.Replace(".", "")}{Port}".GetStableHashCode();
|
2018-11-27 19:31:48 -05:00
|
|
|
|
|
2019-05-31 11:17:01 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns list of all current players
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public List<EFClient> GetClientsAsList()
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2019-01-02 19:32:39 -05:00
|
|
|
|
return Clients.FindAll(x => x != null && x.NetworkId != 0);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add a player to the server's player list
|
|
|
|
|
/// </summary>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
/// <param name="P">EFClient pulled from memory reading</param>
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <returns>True if player added sucessfully, false otherwise</returns>
|
2019-11-15 15:50:20 -05:00
|
|
|
|
public abstract Task<EFClient> OnClientConnected(EFClient P);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Remove player by client number
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cNum">Client ID of player to be removed</param>
|
|
|
|
|
/// <returns>true if removal succeded, false otherwise</returns>
|
2019-05-31 11:17:01 -04:00
|
|
|
|
public abstract Task OnClientDisconnected(EFClient client);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a player by name
|
2019-05-31 11:17:01 -04:00
|
|
|
|
/// todo: make this an extension
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// </summary>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
/// <param name="pName">EFClient name to search for</param>
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <returns>Matching player if found</returns>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public List<EFClient> GetClientByName(String pName)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2019-04-02 21:20:37 -04:00
|
|
|
|
if (string.IsNullOrEmpty(pName))
|
|
|
|
|
{
|
|
|
|
|
return new List<EFClient>();
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-11 16:26:13 -04:00
|
|
|
|
pName = pName.Trim().StripColors();
|
|
|
|
|
|
2017-06-16 17:35:51 -04:00
|
|
|
|
string[] QuoteSplit = pName.Split('"');
|
2017-11-16 18:09:19 -05:00
|
|
|
|
bool literal = false;
|
2017-06-16 17:35:51 -04:00
|
|
|
|
if (QuoteSplit.Length > 1)
|
2017-11-16 18:09:19 -05:00
|
|
|
|
{
|
2017-06-16 17:35:51 -04:00
|
|
|
|
pName = QuoteSplit[1];
|
2017-11-16 18:09:19 -05:00
|
|
|
|
literal = true;
|
|
|
|
|
}
|
|
|
|
|
if (literal)
|
2019-04-02 21:20:37 -04:00
|
|
|
|
{
|
2021-06-06 14:40:58 -04:00
|
|
|
|
return GetClientsAsList().Where(p => p.Name?.StripColors()?.ToLower() == pName.ToLower()).ToList();
|
2019-04-02 21:20:37 -04:00
|
|
|
|
}
|
2017-11-16 18:09:19 -05:00
|
|
|
|
|
2021-06-06 14:40:58 -04:00
|
|
|
|
return GetClientsAsList().Where(p => (p.Name?.StripColors()?.ToLower() ?? "").Contains(pName.ToLower())).ToList();
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-26 20:19:42 -04:00
|
|
|
|
virtual public Task<bool> ProcessUpdatesAsync(CancellationToken cts) => (Task<bool>)Task.CompletedTask;
|
2017-10-15 21:40:27 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Process any server event
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="E">Event</param>
|
|
|
|
|
/// <returns>True on sucess</returns>
|
2019-05-31 11:17:01 -04:00
|
|
|
|
protected abstract Task<bool> ProcessEvent(GameEvent E);
|
|
|
|
|
public abstract Task ExecuteEvent(GameEvent E);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Send a message to all players
|
|
|
|
|
/// </summary>
|
2018-09-29 15:52:22 -04:00
|
|
|
|
/// <param name="message">Message to be sent to all players</param>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public GameEvent Broadcast(string message, EFClient sender = null)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2020-10-17 11:47:56 -04:00
|
|
|
|
string formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "", $"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message.FixIW4ForwardSlash()}");
|
2020-11-11 18:31:26 -05:00
|
|
|
|
ServerLogger.LogDebug("All->" + message.StripColors());
|
2018-10-25 09:14:39 -04:00
|
|
|
|
|
2018-08-30 21:53:00 -04:00
|
|
|
|
var e = new GameEvent()
|
2018-06-16 22:11:25 -04:00
|
|
|
|
{
|
|
|
|
|
Type = GameEvent.EventType.Broadcast,
|
2018-08-31 23:35:51 -04:00
|
|
|
|
Data = formattedMessage,
|
|
|
|
|
Owner = this,
|
2018-09-29 15:52:22 -04:00
|
|
|
|
Origin = sender,
|
2018-08-30 21:53:00 -04:00
|
|
|
|
};
|
|
|
|
|
|
2020-05-04 17:50:02 -04:00
|
|
|
|
Manager.AddEvent(e);
|
2018-09-29 15:52:22 -04:00
|
|
|
|
return e;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
2021-01-24 12:47:19 -05:00
|
|
|
|
|
|
|
|
|
public void Broadcast(IEnumerable<string> messages, EFClient sender = null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var message in messages)
|
|
|
|
|
{
|
|
|
|
|
#pragma warning disable 4014
|
|
|
|
|
Broadcast(message, sender).WaitAsync();
|
|
|
|
|
#pragma warning restore 4014
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Send a message to a particular players
|
|
|
|
|
/// </summary>
|
2019-08-02 19:04:34 -04:00
|
|
|
|
/// <param name="message">Message to send</param>
|
2021-06-03 11:51:03 -04:00
|
|
|
|
/// <param name="targetClient">EFClient to send message to</param>
|
|
|
|
|
protected async Task Tell(string message, EFClient targetClient)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2020-11-11 18:31:26 -05:00
|
|
|
|
if (!Utilities.IsDevelopment)
|
|
|
|
|
{
|
2021-06-03 11:51:03 -04:00
|
|
|
|
var temporalClientId = targetClient.GetAdditionalProperty<string>("ConnectionClientId");
|
|
|
|
|
var parsedClientId = string.IsNullOrEmpty(temporalClientId) ? (int?)null : int.Parse(temporalClientId);
|
|
|
|
|
var clientNumber = parsedClientId ?? targetClient.ClientNumber;
|
|
|
|
|
|
2020-11-11 18:31:26 -05:00
|
|
|
|
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
|
2021-06-03 11:51:03 -04:00
|
|
|
|
clientNumber,
|
2020-11-11 18:31:26 -05:00
|
|
|
|
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message.FixIW4ForwardSlash()}");
|
2021-06-03 11:51:03 -04:00
|
|
|
|
if (targetClient.ClientNumber > -1 && message.Length > 0 && targetClient.Level != EFClient.Permission.Console)
|
2020-11-11 18:31:26 -05:00
|
|
|
|
await this.ExecuteCommandAsync(formattedMessage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-06-03 11:51:03 -04:00
|
|
|
|
ServerLogger.LogDebug("Tell[{clientNumber}]->{message}", targetClient.ClientNumber, message.StripColors());
|
2020-11-11 18:31:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-22 02:04:30 -04:00
|
|
|
|
|
2021-06-03 11:51:03 -04:00
|
|
|
|
if (targetClient.Level == EFClient.Permission.Console)
|
2015-08-22 02:04:30 -04:00
|
|
|
|
{
|
2019-05-08 21:34:17 -04:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
using (LogContext.PushProperty("Server", ToString()))
|
|
|
|
|
{
|
|
|
|
|
ServerLogger.LogInformation("Command output received: {message}", message);
|
|
|
|
|
}
|
2019-08-02 19:04:34 -04:00
|
|
|
|
Console.WriteLine(message.StripColors());
|
2015-08-22 02:04:30 -04:00
|
|
|
|
Console.ForegroundColor = ConsoleColor.Gray;
|
|
|
|
|
}
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Send a message to all admins on the server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message">Message to send out</param>
|
2018-09-29 15:52:22 -04:00
|
|
|
|
public void ToAdmins(String message)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2018-11-05 22:01:29 -05:00
|
|
|
|
foreach (var client in GetClientsAsList().Where(c => c.Level > EFClient.Permission.Flagged))
|
2015-08-20 15:23:13 -04:00
|
|
|
|
{
|
2018-09-29 15:52:22 -04:00
|
|
|
|
client.Tell(message);
|
2015-08-20 15:23:13 -04:00
|
|
|
|
}
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Kick a player from the server
|
|
|
|
|
/// </summary>
|
2020-11-17 19:24:54 -05:00
|
|
|
|
/// <param name="reason">Reason for kicking</param>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
/// <param name="Target">EFClient to kick</param>
|
2020-11-17 19:24:54 -05:00
|
|
|
|
public Task Kick(String reason, EFClient Target, EFClient Origin) => Kick(reason, Target, Origin, null);
|
|
|
|
|
public abstract Task Kick(string reason, EFClient target, EFClient origin, EFPenalty originalPenalty);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Temporarily ban a player ( default 1 hour ) from the server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Reason">Reason for banning the player</param>
|
|
|
|
|
/// <param name="Target">The player to ban</param>
|
2020-04-21 18:34:00 -04:00
|
|
|
|
abstract public Task TempBan(String Reason, TimeSpan length, EFClient Target, EFClient Origin);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Perm ban a player from the server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Reason">The reason for the ban</param>
|
|
|
|
|
/// <param name="Target">The person to ban</param>
|
|
|
|
|
/// <param name="Origin">The person who banned the target</param>
|
2020-04-21 18:34:00 -04:00
|
|
|
|
abstract public Task Ban(String Reason, EFClient Target, EFClient Origin, bool isEvade = false);
|
2015-08-20 15:23:13 -04:00
|
|
|
|
|
2020-04-21 18:34:00 -04:00
|
|
|
|
abstract public Task Warn(String Reason, EFClient Target, EFClient Origin);
|
2016-01-16 17:58:24 -05:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Unban a player by npID / GUID
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="npID">npID of the player</param>
|
|
|
|
|
/// <param name="Target">I don't remember what this is for</param>
|
|
|
|
|
/// <returns></returns>
|
2018-11-05 22:01:29 -05:00
|
|
|
|
abstract public Task Unban(string reason, EFClient Target, EFClient Origin);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
2017-05-26 18:49:27 -04:00
|
|
|
|
/// Change the current searver map
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// </summary>
|
2017-05-26 18:49:27 -04:00
|
|
|
|
/// <param name="mapName">Non-localized map name</param>
|
|
|
|
|
public async Task LoadMap(string mapName)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await this.ExecuteCommandAsync($"map {mapName}");
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initalize the macro variables
|
|
|
|
|
/// </summary>
|
2017-06-12 13:50:00 -04:00
|
|
|
|
abstract public void InitializeTokens();
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-08-20 15:23:13 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initialize the messages to be broadcasted
|
|
|
|
|
/// </summary>
|
2017-06-12 13:50:00 -04:00
|
|
|
|
protected void InitializeAutoMessages()
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2017-06-19 13:58:01 -04:00
|
|
|
|
BroadcastMessages = new List<String>();
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2018-05-10 01:34:29 -04:00
|
|
|
|
if (ServerConfig.AutoMessages != null)
|
2018-03-18 22:25:11 -04:00
|
|
|
|
BroadcastMessages.AddRange(ServerConfig.AutoMessages);
|
|
|
|
|
BroadcastMessages.AddRange(Manager.GetApplicationSettings().Configuration().AutoMessages);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 23:45:21 -04:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2019-04-25 14:00:54 -04:00
|
|
|
|
return $"{IP}:{Port}";
|
2017-06-06 23:45:21 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-25 20:29:58 -05:00
|
|
|
|
protected async Task<bool> ScriptLoaded()
|
2017-11-02 12:49:45 -04:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-11-07 11:40:58 -05:00
|
|
|
|
return (await this.GetDvarAsync("sv_customcallbacks", "0")).Value == "1";
|
2017-11-02 12:49:45 -04:00
|
|
|
|
}
|
2017-11-25 20:29:58 -05:00
|
|
|
|
|
|
|
|
|
catch (Exceptions.DvarException)
|
2017-11-02 12:49:45 -04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-26 18:35:05 -04:00
|
|
|
|
public abstract Task<long> GetIdForServer(Server server = null);
|
|
|
|
|
|
2017-06-19 13:58:01 -04:00
|
|
|
|
// Objects
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public IManager Manager { get; protected set; }
|
2020-11-11 18:31:26 -05:00
|
|
|
|
[Obsolete]
|
|
|
|
|
public SharedLibraryCore.Interfaces.ILogger Logger { get; private set; }
|
2018-03-14 01:36:25 -04:00
|
|
|
|
public ServerConfiguration ServerConfig { get; private set; }
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public List<Map> Maps { get; protected set; } = new List<Map>();
|
2017-10-15 21:40:27 -04:00
|
|
|
|
public List<Report> Reports { get; set; }
|
2018-03-09 03:01:12 -05:00
|
|
|
|
public List<ChatInfo> ChatHistory { get; protected set; }
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public Queue<PlayerHistory> ClientHistory { get; private set; }
|
2020-04-22 19:46:41 -04:00
|
|
|
|
public Game GameName { get; set; }
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2017-06-19 13:58:01 -04:00
|
|
|
|
// Info
|
2020-05-23 14:15:22 -04:00
|
|
|
|
private string hostname;
|
|
|
|
|
public string Hostname { get => ServerConfig.CustomHostname ?? hostname; protected set => hostname = value; }
|
2017-06-19 13:58:01 -04:00
|
|
|
|
public string Website { get; protected set; }
|
2018-04-23 01:43:48 -04:00
|
|
|
|
public string Gametype { get; set; }
|
2020-08-20 11:38:11 -04:00
|
|
|
|
public string GamePassword { get; protected set; }
|
2018-04-23 01:43:48 -04:00
|
|
|
|
public Map CurrentMap { get; set; }
|
2017-10-15 21:40:27 -04:00
|
|
|
|
public int ClientNum
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-08-14 12:30:15 -04:00
|
|
|
|
return Clients.ToArray().Count(p => p != null && !p.IsBot);
|
2017-10-15 21:40:27 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public int MaxClients { get; protected set; }
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public List<EFClient> Clients { get; protected set; }
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public string Password { get; private set; }
|
2017-08-09 00:35:23 -04:00
|
|
|
|
public bool Throttled { get; protected set; }
|
2017-11-02 12:49:45 -04:00
|
|
|
|
public bool CustomCallback { get; protected set; }
|
2018-03-06 02:22:19 -05:00
|
|
|
|
public string WorkingDirectory { get; protected set; }
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public IRConConnection RemoteConnection { get; protected set; }
|
2020-04-21 18:34:00 -04:00
|
|
|
|
public IRConParser RconParser { get; set; }
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public IEventParser EventParser { get; set; }
|
2018-09-06 14:25:58 -04:00
|
|
|
|
public string LogPath { get; protected set; }
|
2018-11-05 22:01:29 -05:00
|
|
|
|
public bool RestartRequested { get; set; }
|
2019-10-09 16:51:02 -04:00
|
|
|
|
public SemaphoreSlim EventProcessing { get; private set; }
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2017-06-19 13:58:01 -04:00
|
|
|
|
// Internal
|
2021-07-11 18:26:30 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// this is actually the hostname now
|
|
|
|
|
/// </summary>
|
2018-11-25 21:00:36 -05:00
|
|
|
|
public string IP { get; protected set; }
|
2021-07-11 18:26:30 -04:00
|
|
|
|
public IPEndPoint ResolvedIpEndPoint { get; protected set; }
|
2018-12-16 22:16:56 -05:00
|
|
|
|
public string Version { get; protected set; }
|
2019-04-02 21:20:37 -04:00
|
|
|
|
public bool IsInitialized { get; set; }
|
2020-11-11 18:31:26 -05:00
|
|
|
|
protected readonly ILogger ServerLogger;
|
2018-12-16 22:16:56 -05:00
|
|
|
|
|
2019-05-31 11:17:01 -04:00
|
|
|
|
public int Port { get; private set; }
|
2017-06-19 13:58:01 -04:00
|
|
|
|
protected string FSGame;
|
|
|
|
|
protected int NextMessage;
|
|
|
|
|
protected int ConnectionErrors;
|
|
|
|
|
protected List<string> BroadcastMessages;
|
|
|
|
|
protected TimeSpan LastMessage;
|
|
|
|
|
protected DateTime LastPoll;
|
2018-05-10 01:34:29 -04:00
|
|
|
|
protected ManualResetEventSlim OnRemoteCommandResponse;
|
2020-05-04 17:50:02 -04:00
|
|
|
|
protected IGameLogReaderFactory gameLogReaderFactory;
|
2021-06-03 11:51:03 -04:00
|
|
|
|
protected IRConConnectionFactory RConConnectionFactory;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2018-03-30 00:13:40 -04:00
|
|
|
|
// only here for performance
|
2018-08-03 22:11:58 -04:00
|
|
|
|
private readonly bool CustomSayEnabled;
|
2021-09-18 19:28:37 -04:00
|
|
|
|
protected readonly string CustomSayName;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
}
|
|
|
|
|
}
|