IW4M-Admin/Plugins/SimpleStats/Plugin.cs

92 lines
2.6 KiB
C#
Raw Normal View History

using System;
2015-08-20 17:54:38 -04:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary;
using SharedLibrary.Interfaces;
using StatsPlugin.Helpers;
namespace StatsPlugin
{
class Plugin : IPlugin
{
public string Name => "Simple Stats";
public float Version => 1.0f;
public string Author => "RaidMax";
private StatManager Manager;
public async Task OnEventAsync(Event E, Server S)
{
switch (E.Type)
2015-08-23 17:58:48 -04:00
{
case Event.GType.Start:
Manager.AddServer(S);
2015-08-23 17:58:48 -04:00
break;
case Event.GType.Stop:
2015-08-23 17:58:48 -04:00
break;
case Event.GType.Connect:
Manager.AddPlayer(E.Origin);
2015-08-23 17:58:48 -04:00
break;
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
}
}
public Task OnLoadAsync(IManager manager)
2015-08-20 17:54:38 -04:00
{
return Task.FromResult(
Manager = new StatManager(manager)
);
}
2015-08-20 17:54:38 -04:00
public async Task OnTickAsync(Server S)
{
}
2015-08-20 17:54:38 -04:00
public Task OnUnloadAsync()
2015-08-20 17:54:38 -04:00
{
return Task.FromResult(
Manager = null
);
2015-08-20 17:54:38 -04:00
}
}
}