2015-03-08 17:20:10 -04:00
|
|
|
|
using System;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
using System.Threading;
|
2018-04-08 02:44:42 -04:00
|
|
|
|
using SharedLibraryCore.Objects;
|
2017-11-25 20:29:58 -05:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public class GameEvent
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public enum EventType
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
//FROM SERVER
|
2015-08-21 21:11:35 -04:00
|
|
|
|
Start,
|
|
|
|
|
Stop,
|
2015-03-08 17:20:10 -04:00
|
|
|
|
Connect,
|
2018-04-28 21:11:13 -04:00
|
|
|
|
// this is for IW5 compatibility
|
|
|
|
|
Join,
|
2015-03-08 17:20:10 -04:00
|
|
|
|
Disconnect,
|
|
|
|
|
Say,
|
|
|
|
|
MapChange,
|
|
|
|
|
MapEnd,
|
2015-08-20 01:06:44 -04:00
|
|
|
|
|
2015-03-08 17:20:10 -04:00
|
|
|
|
//FROM ADMIN
|
|
|
|
|
Broadcast,
|
|
|
|
|
Tell,
|
|
|
|
|
Kick,
|
2015-08-20 01:06:44 -04:00
|
|
|
|
Ban,
|
2017-05-26 18:49:27 -04:00
|
|
|
|
Remote,
|
2015-03-08 17:20:10 -04:00
|
|
|
|
Unknown,
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
//FROM PLAYER
|
2017-06-19 13:58:01 -04:00
|
|
|
|
Report,
|
2017-09-29 22:42:24 -04:00
|
|
|
|
Flag,
|
2018-04-14 00:51:38 -04:00
|
|
|
|
Command,
|
2017-09-29 22:42:24 -04:00
|
|
|
|
|
|
|
|
|
// FROM GAME
|
2018-05-08 00:58:46 -04:00
|
|
|
|
ScriptDamage,
|
2018-05-10 01:34:29 -04:00
|
|
|
|
ScriptKill,
|
2017-09-29 22:42:24 -04:00
|
|
|
|
Kill,
|
2018-04-15 21:27:43 -04:00
|
|
|
|
Damage,
|
2017-09-29 22:42:24 -04:00
|
|
|
|
Death,
|
2018-06-05 17:31:36 -04:00
|
|
|
|
JoinTeam,
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public GameEvent(EventType t, string d, Player O, Player T, Server S)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
Type = t;
|
2018-03-13 17:30:22 -04:00
|
|
|
|
Data = d?.Trim();
|
2015-03-08 17:20:10 -04:00
|
|
|
|
Origin = O;
|
|
|
|
|
Target = T;
|
|
|
|
|
Owner = S;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
OnProcessed = new ManualResetEventSlim();
|
2018-05-03 01:25:49 -04:00
|
|
|
|
Time = DateTime.UtcNow;
|
2018-05-10 01:34:29 -04:00
|
|
|
|
CurrentEventId++;
|
|
|
|
|
Id = CurrentEventId;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-26 02:13:04 -04:00
|
|
|
|
public GameEvent()
|
|
|
|
|
{
|
2018-05-03 01:25:49 -04:00
|
|
|
|
OnProcessed = new ManualResetEventSlim();
|
|
|
|
|
Time = DateTime.UtcNow;
|
2018-05-10 01:34:29 -04:00
|
|
|
|
CurrentEventId++;
|
|
|
|
|
Id = CurrentEventId;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
}
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2018-05-10 01:34:29 -04:00
|
|
|
|
private static long CurrentEventId;
|
2018-04-28 17:39:45 -04:00
|
|
|
|
|
2018-04-13 02:32:30 -04:00
|
|
|
|
public EventType Type;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
public string Data; // Data is usually the message sent by player
|
2017-05-31 01:31:56 -04:00
|
|
|
|
public string Message;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
public Player Origin;
|
|
|
|
|
public Player Target;
|
|
|
|
|
public Server Owner;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public Boolean Remote = false;
|
2018-04-14 00:51:38 -04:00
|
|
|
|
public object Extra { get; set; }
|
2018-04-28 17:39:45 -04:00
|
|
|
|
public ManualResetEventSlim OnProcessed { get; set; }
|
2018-05-03 01:25:49 -04:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|