define new event types

This commit is contained in:
RaidMax 2023-02-11 21:03:35 -06:00
parent 5e32536821
commit dab429776d
36 changed files with 320 additions and 0 deletions

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class ClientCommandEvent : ClientMessageEvent
{
}

View File

@ -0,0 +1,30 @@
using SharedLibraryCore.Database.Models;
namespace SharedLibraryCore.Events.Game;
public class ClientDamageEvent : ClientGameEvent
{
public EFClient Attacker => Origin;
public void UpdateAttacker(EFClient client)
{
Origin = client;
}
public EFClient Victim => Target;
public string AttackerClientName => ClientName;
public string AttackerNetworkId => ClientNetworkId;
public int AttackerClientSlotNumber => ClientSlotNumber;
public string AttackerTeamName { get; init; }
public string VictimClientName { get; init; }
public string VictimNetworkId { get; init; }
public int VictimClientSlotNumber { get; init; }
public string VictimTeamName { get; init; }
public string WeaponName { get; init; }
public int Damage { get; init; }
public string MeansOfDeath { get; init; }
public string HitLocation { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class ClientEnterMatchEvent : ClientGameEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class ClientExitMatchEvent : ClientGameEvent
{
}

View File

@ -0,0 +1,12 @@
using SharedLibraryCore.Database.Models;
namespace SharedLibraryCore.Events.Game;
public abstract class ClientGameEvent : GameEventV2
{
public string ClientName { get; init; }
public string ClientNetworkId { get; init; }
public int ClientSlotNumber { get; init; }
public EFClient Client => Origin;
}

View File

@ -0,0 +1,20 @@
using System;
using SharedLibraryCore.Database.Models;
namespace SharedLibraryCore.Events.Game;
public class ClientJoinTeamEvent : ClientGameEvent
{
public string TeamName { get; init; }
public EFClient.TeamType? Team {
get
{
if (Enum.TryParse(typeof(EFClient.TeamType), TeamName, out var parsedTeam) && parsedTeam is not null)
{
return (EFClient.TeamType)parsedTeam;
}
return null;
}
}
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class ClientKillEvent : ClientDamageEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class ClientMessageEvent : ClientGameEvent
{
public bool IsTeamMessage { get; init; }
}

View File

@ -0,0 +1,8 @@
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Events.Game;
public abstract class GameEventV2 : GameEvent
{
public IGameServer Server { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class GameScriptEvent : GameEventV2
{
public string ScriptData { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Game;
public class MatchEndEvent : GameEventV2
{
public string SessionData { get; init; }
}

View File

@ -0,0 +1,8 @@
using System.Collections.Generic;
namespace SharedLibraryCore.Events.Game;
public class MatchStartEvent : GameEventV2
{
public IReadOnlyDictionary<string, string> SessionData { get; init; } = new Dictionary<string, string>();
}

View File

@ -0,0 +1,9 @@
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Events.Management;
public class ClientExecuteCommandEvent : ClientStateEvent
{
public IManagerCommand Command { get; init; }
public string CommandText { get; init; }
}

View File

@ -0,0 +1,10 @@
using Data.Models;
using Data.Models.Client;
namespace SharedLibraryCore.Events.Management;
public class ClientPenaltyEvent : ManagementEvent
{
public EFClient Client { get; init; }
public EFPenalty Penalty { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class ClientPenaltyRevokeEvent : ClientPenaltyEvent
{
}

View File

@ -0,0 +1,9 @@
using Data.Models.Client;
namespace SharedLibraryCore.Events.Management;
public class ClientPermissionChangeEvent : ClientStateEvent
{
public EFClient.Permission OldPermission { get; init; }
public EFClient.Permission NewPermission { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class ClientStateAuthorizeEvent : ClientStateEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class ClientStateDisposeEvent : ClientStateEvent
{
}

View File

@ -0,0 +1,8 @@
using EFClient = SharedLibraryCore.Database.Models.EFClient;
namespace SharedLibraryCore.Events.Management;
public abstract class ClientStateEvent : ManagementEvent
{
public EFClient Client { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class ClientStateInitializeEvent : ClientStateEvent
{
}

View File

@ -0,0 +1,14 @@
namespace SharedLibraryCore.Events.Management;
public class LoginEvent : ManagementEvent
{
public enum LoginSourceType
{
Ingame,
Webfront
}
public string EntityId { get; init; }
public string Identifier { get; init; }
public LoginSourceType LoginSource { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class LogoutEvent : LoginEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Management;
public class ManagementEvent : CoreEvent
{
}

View File

@ -0,0 +1,8 @@
using System;
namespace SharedLibraryCore.Events.Management;
public class NotifyAfterDelayCompleteEvent : ManagementEvent
{
public Delegate Action { get; init; }
}

View File

@ -0,0 +1,9 @@
using System;
namespace SharedLibraryCore.Events.Management;
public class NotifyAfterDelayRequestEvent : ManagementEvent
{
public int DelayMs { get; init; }
public Action Action { get; init; }
}

View File

@ -0,0 +1,9 @@
using System.Collections.Generic;
using SharedLibraryCore.Database.Models;
namespace SharedLibraryCore.Events.Server;
public class ClientDataUpdateEvent : GameServerEvent
{
public IReadOnlyCollection<EFClient> Clients { get; init; }
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Server;
public class ConnectionInterruptEvent : GameServerEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Server;
public class ConnectionRestoreEvent : GameServerEvent
{
}

View File

@ -0,0 +1,8 @@
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Events.Server;
public abstract class GameServerEvent : CoreEvent
{
public IGameServer Server { get; init; }
}

View File

@ -0,0 +1,5 @@
namespace SharedLibraryCore.Events.Server;
public class MonitorStartEvent : GameServerEvent
{
}

View File

@ -0,0 +1,6 @@
namespace SharedLibraryCore.Events.Server;
public class MonitorStopEvent : GameServerEvent
{
}

View File

@ -0,0 +1,7 @@
namespace SharedLibraryCore.Events.Server;
public class ServerCommandExecuteEvent : GameServerEvent
{
public string Command { get; init; }
public string[] Output { get; init; }
}

View File

@ -0,0 +1,7 @@
namespace SharedLibraryCore.Events.Server;
public class ServerValueReceiveEvent : GameServerEvent
{
public Dvar<string> Response { get; init; }
public bool Success { get; init; }
}

View File

@ -0,0 +1,17 @@
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Events.Server;
public class ServerValueRequestEvent : GameServerEvent
{
public ServerValueRequestEvent(string valueName, IGameServer server)
{
ValueName = valueName;
Server = server;
}
public string ValueName { get; init; }
public int? DelayMs { get; init; }
public int? TimeoutMs { get; init; }
public string FallbackValue { get; init; }
}

View File

@ -0,0 +1,8 @@
namespace SharedLibraryCore.Events.Server;
public class ServerValueSetCompleteEvent : GameServerEvent
{
public bool Success { get; init; }
public string ValueName { get; init; }
public string Value { get; set; }
}

View File

@ -0,0 +1,18 @@
using SharedLibraryCore.Interfaces;
namespace SharedLibraryCore.Events.Server;
public class ServerValueSetRequestEvent : GameServerEvent
{
public ServerValueSetRequestEvent(string valueName, string value, IGameServer server)
{
ValueName = valueName;
Server = server;
Value = value;
}
public string ValueName { get; init; }
public string Value { get; init; }
public int? DelayMs { get; init; }
public int? TimeoutMs { get; init; }
}