IW4M-Admin/SharedLibraryCore/Event.cs

81 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
{
Unknown,
// events "generated" by the server
Start,
Stop,
2015-03-08 17:20:10 -04:00
Connect,
Join,
Quit,
2015-03-08 17:20:10 -04:00
Disconnect,
MapEnd,
MapChange,
// events "generated" by clients
Say,
Report,
Flag,
Unflag,
Kick,
TempBan,
Ban,
2018-04-14 00:51:38 -04:00
Command,
// events "generated" by IW4MAdmin
Broadcast,
Tell,
// events "generated" by script/log
ScriptDamage,
2018-05-10 01:34:29 -04:00
ScriptKill,
Damage,
Kill,
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
}
}