mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-09 23:00:57 -05:00
implement new eventing system
This commit is contained in:
120
SharedLibraryCore/Interfaces/Events/IGameEventSubscriptions.cs
Normal file
120
SharedLibraryCore/Interfaces/Events/IGameEventSubscriptions.cs
Normal file
@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Events;
|
||||
using SharedLibraryCore.Events.Game;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces.Events;
|
||||
|
||||
public interface IGameEventSubscriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised when game log prints that match has started
|
||||
/// <example>InitGame</example>
|
||||
/// <value><see cref="MatchStartEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<MatchStartEvent, CancellationToken, Task> MatchStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that match has ended
|
||||
/// <example>ShutdownGame:</example>
|
||||
/// <value><see cref="MatchEndEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<MatchEndEvent, CancellationToken, Task> MatchEnded;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log printed that client has entered the match
|
||||
/// <remarks>J;clientNetworkId;clientSlotNumber;clientName</remarks>
|
||||
/// <example>J;110000100000000;0;bot</example>
|
||||
/// <value><see cref="ClientEnterMatchEvent"/></value>
|
||||
/// </summary>
|
||||
public static event Func<ClientEnterMatchEvent, CancellationToken, Task> ClientEnteredMatch;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client has exited the match
|
||||
/// <remarks>Q;clientNetworkId;clientSlotNumber;clientName</remarks>
|
||||
/// <example>Q;110000100000000;0;bot</example>
|
||||
/// <value><see cref="ClientExitMatchEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientExitMatchEvent, CancellationToken, Task> ClientExitedMatch;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client has joined a team
|
||||
/// <remarks>JT;clientNetworkId;clientSlotNumber;clientTeam;clientName</remarks>
|
||||
/// <example>JT;110000100000000;0;axis;bot</example>
|
||||
/// <value><see cref="ClientJoinTeamEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientJoinTeamEvent, CancellationToken, Task> ClientJoinedTeam;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client has been damaged
|
||||
/// <remarks>D;victimNetworkId;victimSlotNumber;victimTeam;victimName;attackerNetworkId;attackerSlotNumber;attackerTeam;attackerName;weapon;damage;meansOfDeath;hitLocation</remarks>
|
||||
/// <example>D;110000100000000;17;axis;bot_0;110000100000001;4;allies;bot_1;scar_mp;38;MOD_HEAD_SHOT;head</example>
|
||||
/// <value><see cref="ClientDamageEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientDamageEvent, CancellationToken, Task> ClientDamaged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client has been killed
|
||||
/// <remarks>K;victimNetworkId;victimSlotNumber;victimTeam;victimName;attackerNetworkId;attackerSlotNumber;attackerTeam;attackerName;weapon;damage;meansOfDeath;hitLocation</remarks>
|
||||
/// <example>K;110000100000000;17;axis;bot_0;110000100000001;4;allies;bot_1;scar_mp;100;MOD_HEAD_SHOT;head</example>
|
||||
/// <value><see cref="ClientKillEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientKillEvent, CancellationToken, Task> ClientKilled;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client entered a chat message
|
||||
/// <remarks>say;clientNetworkId;clientSlotNumber;clientName;message</remarks>
|
||||
/// <example>say;110000100000000;0;bot;hello world!</example>
|
||||
/// <value><see cref="ClientMessageEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientMessageEvent, CancellationToken, Task> ClientMessaged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints that client entered a command (chat message prefixed with command character(s))
|
||||
/// <remarks>say;clientNetworkId;clientSlotNumber;clientName;command</remarks>
|
||||
/// <example>say;110000100000000;0;bot;!command</example>
|
||||
/// <value><see cref="ClientCommandEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientCommandEvent, CancellationToken, Task> ClientEnteredCommand;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when game log prints user generated script event
|
||||
/// <remarks>GSE;data</remarks>
|
||||
/// <example>GSE;loadBank=1</example>
|
||||
/// <value><see cref="GameScriptEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<GameScriptEvent, CancellationToken, Task> ScriptEventTriggered;
|
||||
|
||||
static Task InvokeEventAsync(CoreEvent coreEvent, CancellationToken token)
|
||||
{
|
||||
return coreEvent switch
|
||||
{
|
||||
MatchStartEvent matchStartEvent => MatchStarted?.InvokeAsync(matchStartEvent, token) ?? Task.CompletedTask,
|
||||
MatchEndEvent matchEndEvent => MatchEnded?.InvokeAsync(matchEndEvent, token) ?? Task.CompletedTask,
|
||||
ClientEnterMatchEvent clientEnterMatchEvent => ClientEnteredMatch?.InvokeAsync(clientEnterMatchEvent, token) ?? Task.CompletedTask,
|
||||
ClientExitMatchEvent clientExitMatchEvent => ClientExitedMatch?.InvokeAsync(clientExitMatchEvent, token) ?? Task.CompletedTask,
|
||||
ClientJoinTeamEvent clientJoinTeamEvent => ClientJoinedTeam?.InvokeAsync(clientJoinTeamEvent, token) ?? Task.CompletedTask,
|
||||
ClientKillEvent clientKillEvent => ClientKilled?.InvokeAsync(clientKillEvent, token) ?? Task.CompletedTask,
|
||||
ClientDamageEvent clientDamageEvent => ClientDamaged?.InvokeAsync(clientDamageEvent, token) ?? Task.CompletedTask,
|
||||
ClientCommandEvent clientCommandEvent => ClientEnteredCommand?.InvokeAsync(clientCommandEvent, token) ?? Task.CompletedTask,
|
||||
ClientMessageEvent clientMessageEvent => ClientMessaged?.InvokeAsync(clientMessageEvent, token) ?? Task.CompletedTask,
|
||||
GameScriptEvent gameScriptEvent => ScriptEventTriggered?.InvokeAsync(gameScriptEvent, token) ?? Task.CompletedTask,
|
||||
_ => Task.CompletedTask
|
||||
};
|
||||
}
|
||||
|
||||
static void ClearEventInvocations()
|
||||
{
|
||||
MatchStarted = null;
|
||||
MatchEnded = null;
|
||||
ClientEnteredMatch = null;
|
||||
ClientExitedMatch = null;
|
||||
ClientJoinedTeam = null;
|
||||
ClientDamaged = null;
|
||||
ClientKilled = null;
|
||||
ClientMessaged = null;
|
||||
ClientEnteredCommand = null;
|
||||
ScriptEventTriggered = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Events;
|
||||
using SharedLibraryCore.Events.Server;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces.Events;
|
||||
|
||||
public interface IGameServerEventSubscriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised when IW4MAdmin starts monitoring a game server
|
||||
/// <value><see cref="MonitorStartEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<MonitorStartEvent, CancellationToken, Task> MonitoringStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when IW4MAdmin stops monitoring a game server
|
||||
/// <value><see cref="MonitorStopEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<MonitorStopEvent, CancellationToken, Task> MonitoringStopped;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when communication was interrupted with a game server
|
||||
/// <value><see cref="ConnectionInterruptEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ConnectionInterruptEvent, CancellationToken, Task> ConnectionInterrupted;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when communication was resumed with a game server
|
||||
/// <value><see cref="ConnectionRestoreEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ConnectionRestoreEvent, CancellationToken, Task> ConnectionRestored;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when updated client data was received from a game server
|
||||
/// <value><see cref="ClientDataUpdateEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientDataUpdateEvent, CancellationToken, Task> ClientDataUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a command was executed on a game server
|
||||
/// <value><see cref="ServerCommandExecuteEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ServerCommandExecuteEvent, CancellationToken, Task> ServerCommandExecuted;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a server value is requested for a game server
|
||||
/// <value><see cref="ServerValueRequestEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ServerValueRequestEvent, CancellationToken, Task> ServerValueRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a server value was received from a game server (success or fail)
|
||||
/// <value><see cref="ServerValueReceiveEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ServerValueReceiveEvent, CancellationToken, Task> ServerValueReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a request to set a server value on a game server is received
|
||||
/// <value><see cref="ServerValueSetRequestEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ServerValueSetRequestEvent, CancellationToken, Task> ServerValueSetRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a setting server value on a game server is completed (success or fail)
|
||||
/// <value><see cref="ServerValueSetRequestEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ServerValueSetCompleteEvent, CancellationToken, Task> ServerValueSetCompleted;
|
||||
|
||||
static Task InvokeEventAsync(CoreEvent coreEvent, CancellationToken token)
|
||||
{
|
||||
return coreEvent switch
|
||||
{
|
||||
MonitorStartEvent monitoringStartEvent => MonitoringStarted?.InvokeAsync(monitoringStartEvent, token) ?? Task.CompletedTask,
|
||||
MonitorStopEvent monitorStopEvent => MonitoringStopped?.InvokeAsync(monitorStopEvent, token) ?? Task.CompletedTask,
|
||||
ConnectionInterruptEvent connectionInterruptEvent => ConnectionInterrupted?.InvokeAsync(connectionInterruptEvent, token) ?? Task.CompletedTask,
|
||||
ConnectionRestoreEvent connectionRestoreEvent => ConnectionRestored?.InvokeAsync(connectionRestoreEvent, token) ?? Task.CompletedTask,
|
||||
ClientDataUpdateEvent clientDataUpdateEvent => ClientDataUpdated?.InvokeAsync(clientDataUpdateEvent, token) ?? Task.CompletedTask,
|
||||
ServerCommandExecuteEvent dataReceiveEvent => ServerCommandExecuted?.InvokeAsync(dataReceiveEvent, token) ?? Task.CompletedTask,
|
||||
ServerValueRequestEvent serverValueRequestEvent => ServerValueRequested?.InvokeAsync(serverValueRequestEvent, token) ?? Task.CompletedTask,
|
||||
ServerValueReceiveEvent serverValueReceiveEvent => ServerValueReceived?.InvokeAsync(serverValueReceiveEvent, token) ?? Task.CompletedTask,
|
||||
ServerValueSetRequestEvent serverValueSetRequestEvent => ServerValueSetRequested?.InvokeAsync(serverValueSetRequestEvent, token) ?? Task.CompletedTask,
|
||||
ServerValueSetCompleteEvent serverValueSetCompleteEvent => ServerValueSetCompleted?.InvokeAsync(serverValueSetCompleteEvent, token) ?? Task.CompletedTask,
|
||||
_ => Task.CompletedTask
|
||||
};
|
||||
}
|
||||
|
||||
static void ClearEventInvocations()
|
||||
{
|
||||
MonitoringStarted = null;
|
||||
MonitoringStopped = null;
|
||||
ConnectionInterrupted = null;
|
||||
ConnectionRestored = null;
|
||||
ClientDataUpdated = null;
|
||||
ServerCommandExecuted = null;
|
||||
ServerValueReceived = null;
|
||||
ServerValueRequested = null;
|
||||
ServerValueSetRequested = null;
|
||||
ServerValueSetCompleted = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Events;
|
||||
using SharedLibraryCore.Events.Management;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces.Events;
|
||||
|
||||
public interface IManagementEventSubscriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised when <see cref="IManager"/> is loading
|
||||
/// </summary>
|
||||
static event Func<IManager, CancellationToken, Task> Load;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when <see cref="IManager"/> is restarting
|
||||
/// </summary>
|
||||
static event Func<IManager, CancellationToken, Task> Unload;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when client enters a tracked state
|
||||
/// <remarks>
|
||||
/// At this point, the client is not guaranteed to be allowed to play on the server.
|
||||
/// See <see cref="ClientStateAuthorized"/> for final state.
|
||||
/// </remarks>
|
||||
/// <value><see cref="ClientStateInitializeEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientStateInitializeEvent, CancellationToken, Task> ClientStateInitialized;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when client enters an authorized state (valid data and no bans)
|
||||
/// <value><see cref="ClientStateAuthorizeEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientStateAuthorizeEvent, CancellationToken, Task> ClientStateAuthorized;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when client is no longer tracked (unknown state)
|
||||
/// <remarks>At this point any references to the client should be dropped</remarks>
|
||||
/// <value><see cref="ClientStateDisposeEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientStateDisposeEvent, CancellationToken, Task> ClientStateDisposed;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client receives a penalty
|
||||
/// <value><see cref="ClientPenaltyEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientPenaltyEvent, CancellationToken, Task> ClientPenaltyAdministered;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client penalty is revoked (eg unflag/unban)
|
||||
/// <value><see cref="ClientPenaltyRevokeEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientPenaltyRevokeEvent, CancellationToken, Task> ClientPenaltyRevoked;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client command is executed (after completion of the command)
|
||||
/// <value><see cref="ClientExecuteCommandEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientExecuteCommandEvent, CancellationToken, Task> ClientCommandExecuted;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client's permission level changes
|
||||
/// <value><see cref="ClientPermissionChangeEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientPermissionChangeEvent, CancellationToken, Task> ClientPermissionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client logs in to the webfront or ingame
|
||||
/// <value><see cref="LoginEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<LoginEvent, CancellationToken, Task> ClientLoggedIn;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client logs out of the webfront
|
||||
/// <value><see cref="LogoutEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<LogoutEvent, CancellationToken, Task> ClientLoggedOut;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a client's persistent id (stats file marker) is received
|
||||
/// <value><see cref="ClientPersistentIdReceiveEvent"/></value>
|
||||
/// </summary>
|
||||
static event Func<ClientPersistentIdReceiveEvent, CancellationToken, Task> ClientPersistentIdReceived;
|
||||
|
||||
static Task InvokeEventAsync(CoreEvent coreEvent, CancellationToken token)
|
||||
{
|
||||
return coreEvent switch
|
||||
{
|
||||
ClientStateInitializeEvent clientStateInitializeEvent => ClientStateInitialized?.InvokeAsync(
|
||||
clientStateInitializeEvent, token) ?? Task.CompletedTask,
|
||||
ClientStateDisposeEvent clientStateDisposedEvent => ClientStateDisposed?.InvokeAsync(
|
||||
clientStateDisposedEvent, token) ?? Task.CompletedTask,
|
||||
ClientStateAuthorizeEvent clientStateAuthorizeEvent => ClientStateAuthorized?.InvokeAsync(
|
||||
clientStateAuthorizeEvent, token) ?? Task.CompletedTask,
|
||||
ClientPenaltyRevokeEvent clientPenaltyRevokeEvent => ClientPenaltyRevoked?.InvokeAsync(
|
||||
clientPenaltyRevokeEvent, token) ?? Task.CompletedTask,
|
||||
ClientPenaltyEvent clientPenaltyEvent =>
|
||||
ClientPenaltyAdministered?.InvokeAsync(clientPenaltyEvent, token) ?? Task.CompletedTask,
|
||||
ClientPermissionChangeEvent clientPermissionChangeEvent => ClientPermissionChanged?.InvokeAsync(
|
||||
clientPermissionChangeEvent, token) ?? Task.CompletedTask,
|
||||
ClientExecuteCommandEvent clientExecuteCommandEvent => ClientCommandExecuted?.InvokeAsync(
|
||||
clientExecuteCommandEvent, token) ?? Task.CompletedTask,
|
||||
LogoutEvent logoutEvent => ClientLoggedOut?.InvokeAsync(logoutEvent, token) ?? Task.CompletedTask,
|
||||
LoginEvent loginEvent => ClientLoggedIn?.InvokeAsync(loginEvent, token) ?? Task.CompletedTask,
|
||||
ClientPersistentIdReceiveEvent clientPersistentIdReceiveEvent => ClientPersistentIdReceived?.InvokeAsync(
|
||||
clientPersistentIdReceiveEvent, token) ?? Task.CompletedTask,
|
||||
_ => Task.CompletedTask
|
||||
};
|
||||
}
|
||||
|
||||
static Task InvokeLoadAsync(IManager manager, CancellationToken token) => Load?.InvokeAsync(manager, token) ?? Task.CompletedTask;
|
||||
static Task InvokeUnloadAsync(IManager manager, CancellationToken token) => Unload?.InvokeAsync(manager, token) ?? Task.CompletedTask;
|
||||
|
||||
static void ClearEventInvocations()
|
||||
{
|
||||
Load = null;
|
||||
Unload = null;
|
||||
ClientStateInitialized = null;
|
||||
ClientStateAuthorized = null;
|
||||
ClientStateDisposed = null;
|
||||
ClientPenaltyAdministered = null;
|
||||
ClientPenaltyRevoked = null;
|
||||
ClientCommandExecuted = null;
|
||||
ClientPermissionChanged = null;
|
||||
ClientLoggedIn = null;
|
||||
ClientLoggedOut = null;
|
||||
ClientPersistentIdReceived = null;
|
||||
}
|
||||
}
|
19
SharedLibraryCore/Interfaces/ICoreEventHandler.cs
Normal file
19
SharedLibraryCore/Interfaces/ICoreEventHandler.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Threading;
|
||||
using SharedLibraryCore.Events;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Handles games events (from log, manual events, etc)
|
||||
/// </summary>
|
||||
public interface ICoreEventHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a core event event to the queue to be processed
|
||||
/// </summary>
|
||||
/// <param name="manager"><see cref="IManager"/></param>
|
||||
/// <param name="coreEvent"><see cref="CoreEvent"/></param>
|
||||
void QueueEvent(IManager manager, CoreEvent coreEvent);
|
||||
|
||||
void StartProcessing(CancellationToken token);
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Data.Models;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
@ -16,7 +17,70 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="previousPenalty">previous penalty the kick is occuring for (if applicable)</param>
|
||||
/// <returns></returns>
|
||||
Task Kick(string reason, EFClient target, EFClient origin, EFPenalty previousPenalty = null);
|
||||
|
||||
/// <summary>
|
||||
/// Time the most recent match ended
|
||||
/// </summary>
|
||||
DateTime? MatchEndTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time the current match started
|
||||
/// </summary>
|
||||
DateTime? MatchStartTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// List of connected clients
|
||||
/// </summary>
|
||||
IReadOnlyList<EFClient> ConnectedClients { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Game code corresponding to the development studio project
|
||||
/// </summary>
|
||||
Reference.Game GameCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the anticheat/custom callbacks/live radar integration is enabled
|
||||
/// </summary>
|
||||
bool IsLegacyGameIntegrationEnabled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique identifier for the server (typically ip:port)
|
||||
/// </summary>
|
||||
string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Network address the server is listening on
|
||||
/// </summary>
|
||||
string ListenAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Network port the server is listening on
|
||||
/// </summary>
|
||||
int ListenPort { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the server (hostname)
|
||||
/// </summary>
|
||||
string ServerName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Current gametype
|
||||
/// </summary>
|
||||
string Gametype { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Game password (required to join)
|
||||
/// </summary>
|
||||
string GamePassword { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Current map the game server is running
|
||||
/// </summary>
|
||||
Map Map { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Database id for EFServer table and references
|
||||
/// </summary>
|
||||
long LegacyDatabaseId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Events;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Services;
|
||||
|
||||
@ -34,7 +35,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
Task Init();
|
||||
Task Start();
|
||||
Task Stop();
|
||||
void Restart();
|
||||
Task Restart();
|
||||
|
||||
[Obsolete]
|
||||
ILogger GetLogger(long serverId);
|
||||
@ -87,6 +88,11 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="gameEvent">event to be processed</param>
|
||||
void AddEvent(GameEvent gameEvent);
|
||||
|
||||
/// <summary>
|
||||
/// queues an event for processing
|
||||
/// </summary>
|
||||
void QueueEvent(CoreEvent coreEvent);
|
||||
|
||||
/// <summary>
|
||||
/// adds an additional (script) command to the command list
|
||||
/// </summary>
|
||||
|
11
SharedLibraryCore/Interfaces/IModularAssembly.cs
Normal file
11
SharedLibraryCore/Interfaces/IModularAssembly.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SharedLibraryCore.Interfaces;
|
||||
|
||||
public interface IModularAssembly
|
||||
{
|
||||
string Name { get; }
|
||||
string Author { get; }
|
||||
string Version { get; }
|
||||
string Scope => string.Empty;
|
||||
string Role => string.Empty;
|
||||
string[] Claims => System.Array.Empty<string>();
|
||||
}
|
@ -55,8 +55,6 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default, CancellationToken token = default);
|
||||
|
||||
void BeginGetDvar(IRConConnection connection, string dvarName, AsyncCallback callback, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// set value of DVAR by name
|
||||
@ -67,9 +65,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue, CancellationToken token = default);
|
||||
|
||||
void BeginSetDvar(IRConConnection connection, string dvarName, object dvarValue, AsyncCallback callback, CancellationToken token = default);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// executes a console command on the server
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user