IW4M-Admin/SharedLibraryCore/Event.cs

80 lines
1.9 KiB
C#
Raw Normal View History

2015-03-08 17:20:10 -04:00
using System;
using System.Threading;
2018-04-08 02:44:42 -04:00
using SharedLibraryCore.Objects;
2018-04-08 02:44:42 -04:00
namespace SharedLibraryCore
2015-03-08 17:20:10 -04:00
{
public class GameEvent
2015-03-08 17:20:10 -04:00
{
public enum EventType
2015-03-08 17:20:10 -04:00
{
//FROM SERVER
Start,
Stop,
2015-03-08 17:20:10 -04:00
Connect,
// this is for IW5 compatibility
Join,
2015-03-08 17:20:10 -04:00
Disconnect,
Say,
MapChange,
MapEnd,
2015-03-08 17:20:10 -04:00
//FROM ADMIN
Broadcast,
Tell,
Kick,
Ban,
Remote,
2015-03-08 17:20:10 -04:00
Unknown,
//FROM PLAYER
Report,
Flag,
2018-04-14 00:51:38 -04:00
Command,
// FROM GAME
ScriptDamage,
2018-05-10 01:34:29 -04:00
ScriptKill,
Kill,
Damage,
Death,
JoinTeam,
2015-03-08 17:20:10 -04:00
}
public GameEvent(EventType t, string d, Player O, Player T, Server S)
2015-03-08 17:20:10 -04:00
{
Type = t;
Data = d?.Trim();
2015-03-08 17:20:10 -04:00
Origin = O;
Target = T;
Owner = S;
OnProcessed = new ManualResetEventSlim();
Time = DateTime.UtcNow;
2018-05-10 01:34:29 -04:00
CurrentEventId++;
Id = CurrentEventId;
2015-03-08 17:20:10 -04:00
}
public GameEvent()
{
OnProcessed = new ManualResetEventSlim();
Time = DateTime.UtcNow;
2018-05-10 01:34:29 -04:00
CurrentEventId++;
Id = CurrentEventId;
}
2015-03-08 17:20:10 -04:00
2018-05-10 01:34:29 -04:00
private static long CurrentEventId;
public EventType Type;
2015-03-08 17:20:10 -04:00
public string Data; // Data is usually the message sent by player
public string Message;
2015-03-08 17:20:10 -04:00
public Player Origin;
public Player Target;
public Server Owner;
public Boolean Remote = false;
2018-04-14 00:51:38 -04:00
public object Extra { get; set; }
public ManualResetEventSlim OnProcessed { get; set; }
public DateTime Time { get; private set; }
2018-05-10 01:34:29 -04:00
public long Id { get; private set; }
2015-03-08 17:20:10 -04:00
}
}