2018-02-07 00:19:06 -05:00
|
|
|
|
using System;
|
2015-08-20 17:54:38 -04:00
|
|
|
|
using System.Collections.Generic;
|
2018-02-07 00:19:06 -05:00
|
|
|
|
using System.Linq;
|
2017-10-03 19:17:35 -04:00
|
|
|
|
using System.Text;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
using SharedLibrary;
|
|
|
|
|
using SharedLibrary.Interfaces;
|
|
|
|
|
using StatsPlugin.Helpers;
|
2017-11-25 20:29:58 -05:00
|
|
|
|
|
2015-08-28 00:39:36 -04:00
|
|
|
|
namespace StatsPlugin
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
class Plugin : IPlugin
|
2015-08-20 01:06:44 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
public string Name => "Simple Stats";
|
2017-06-01 13:42:28 -04:00
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
public float Version => 1.0f;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2017-11-15 16:04:13 -05:00
|
|
|
|
public string Author => "RaidMax";
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
private StatManager Manager;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2017-05-27 18:08:04 -04:00
|
|
|
|
public async Task OnEventAsync(Event E, Server S)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
switch (E.Type)
|
2015-08-23 17:58:48 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
case Event.GType.Start:
|
|
|
|
|
Manager.AddServer(S);
|
2015-08-23 17:58:48 -04:00
|
|
|
|
break;
|
2018-02-07 00:19:06 -05:00
|
|
|
|
case Event.GType.Stop:
|
2015-08-23 17:58:48 -04:00
|
|
|
|
break;
|
2018-02-07 00:19:06 -05:00
|
|
|
|
case Event.GType.Connect:
|
|
|
|
|
Manager.AddPlayer(E.Origin);
|
2015-08-23 17:58:48 -04:00
|
|
|
|
break;
|
2018-02-07 00:19:06 -05:00
|
|
|
|
case Event.GType.Disconnect:
|
|
|
|
|
await Manager.RemovePlayer(E.Origin);
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Say:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.MapChange:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.MapEnd:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Broadcast:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Tell:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Kick:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Ban:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Remote:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Unknown:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Report:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Flag:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Script:
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Kill:
|
|
|
|
|
string[] killInfo = (E.Data != null) ? E.Data.Split(';') : new string[0];
|
|
|
|
|
if (killInfo.Length >= 9 && killInfo[0].Contains("ScriptKill"))
|
|
|
|
|
await Manager.AddKill(E.Origin, E.Target, S.GetHashCode(), S.CurrentMap.Name, killInfo[7], killInfo[8], killInfo[5], killInfo[6], killInfo[3], killInfo[4]);
|
|
|
|
|
break;
|
|
|
|
|
case Event.GType.Death:
|
2015-08-23 17:58:48 -04:00
|
|
|
|
break;
|
2015-08-20 17:54:38 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
public Task OnLoadAsync(IManager manager)
|
2015-08-20 17:54:38 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
return Task.FromResult(
|
|
|
|
|
Manager = new StatManager(manager)
|
|
|
|
|
);
|
2017-05-31 01:31:56 -04:00
|
|
|
|
}
|
2015-08-20 17:54:38 -04:00
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
public async Task OnTickAsync(Server S)
|
2015-08-28 00:39:36 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
|
2015-08-28 00:39:36 -04:00
|
|
|
|
}
|
2015-08-20 17:54:38 -04:00
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
public Task OnUnloadAsync()
|
2015-08-20 17:54:38 -04:00
|
|
|
|
{
|
2018-02-07 00:19:06 -05:00
|
|
|
|
return Task.FromResult(
|
|
|
|
|
Manager = null
|
|
|
|
|
);
|
2015-08-20 17:54:38 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-07 00:19:06 -05:00
|
|
|
|
}
|