1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

changed player graph update interval to every 5 minutes

hopefully fixed skipping the logging of Kayak library issue.
I'm an idiot, 59 in playerhistory, not 60
added IW4 callback gsc for custom scriptkills.
Fixed duplicate death events
Trusted group can be enabled/disabled with !enable/disabletrusted
This commit is contained in:
RaidMax
2017-11-02 11:49:45 -05:00
parent c19d6e98f5
commit 9699f7c3f1
21 changed files with 189 additions and 29 deletions

View File

@ -11,7 +11,7 @@ namespace StatsPlugin
{
public class CViewStats : Command
{
public CViewStats() : base("stats", "view your stats. syntax !stats", "xlrstats", Player.Permission.User, 0, false) { }
public CViewStats() : base("stats", "view your stats. syntax: !stats", "xlrstats", Player.Permission.User, 0, false) { }
public override async Task ExecuteAsync(Event E)
{
@ -54,7 +54,7 @@ namespace StatsPlugin
public class CViewTopStats : Command
{
public CViewTopStats() : base("topstats", "view the top 5 players on this server. syntax !topstats", "ts", Player.Permission.User, 0, false) { }
public CViewTopStats() : base("topstats", "view the top 5 players on this server. syntax: !topstats", "ts", Player.Permission.User, 0, false) { }
public override async Task ExecuteAsync(Event E)
{
@ -75,7 +75,7 @@ namespace StatsPlugin
public class CResetStats : Command
{
public CResetStats() : base("resetstats", "reset your stats to factory-new, !syntax !resetstats", "rs", Player.Permission.User, 0, false) { }
public CResetStats() : base("resetstats", "reset your stats to factory-new. syntax: !resetstats", "rs", Player.Permission.User, 0, false) { }
public override async Task ExecuteAsync(Event E)
{
@ -201,7 +201,6 @@ namespace StatsPlugin
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALKILLS", GetTotalKills));
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALPLAYTIME", GetTotalPlaytime));
try
{
var minimapConfig = MinimapConfig.Read("Config/minimaps.cfg");
@ -229,6 +228,10 @@ namespace StatsPlugin
{
statLists.Add(new StatTracking(S.GetPort()));
ServerStats.Add(S.GetPort(), new ServerStatInfo());
var config = new ConfigurationManager(S);
if (config.GetProperty("EnableTrusted") == null)
config.AddProperty(new KeyValuePair<string, object>("EnableTrusted", true));
}
if (E.Type == Event.GType.Stop)
@ -241,9 +244,14 @@ namespace StatsPlugin
{
ResetCounters(E.Origin.ClientID, S.GetPort());
var config = new ConfigurationManager(E.Owner);
if (!(bool)config.GetProperty("EnableTrusted"))
return;
PlayerStats checkForTrusted = statLists.Find(x => x.Port == S.GetPort()).playerStats.GetStats(E.Origin);
//todo: move this out of here!!
if (checkForTrusted.TotalPlayTime >= 4320 && E.Origin.Level < Player.Permission.Trusted)
if (checkForTrusted.TotalPlayTime >= 4320 && E.Origin.Level < Player.Permission.Trusted && E.Origin.Level != Player.Permission.Flagged)
{
E.Origin.SetLevel(Player.Permission.Trusted);
E.Owner.Manager.GetClientDatabase().UpdatePlayer(E.Origin);

View File

@ -74,6 +74,7 @@
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StatsPage.cs" />
<Compile Include="TrustedGroupCommands.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibrary\SharedLibrary.csproj">

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary;
using SharedLibrary.Interfaces;
using SharedLibrary.Helpers;
namespace StatsPlugin
{
public class CEnableTrusted : Command
{
public CEnableTrusted() : base("enabletrusted", "enable trusted player group for the server. syntax: !enabletrusted", "et", Player.Permission.Owner, 0, false) { }
public override async Task ExecuteAsync(Event E)
{
var config = new ConfigurationManager(E.Owner);
if (config.GetProperty("EnableTrusted") == null)
config.AddProperty(new KeyValuePair<string, object>("EnableTrusted", true));
else
config.UpdateProperty(new KeyValuePair<string, object>("EnableTrusted", true));
await E.Origin.Tell("Trusted group has been disabled for this server");
}
}
public class CDisableTrusted : Command
{
public CDisableTrusted() : base("disabletrusted", "disable trusted player group for the server. syntax: !disabletrusted", "dt", Player.Permission.Owner, 0, false) { }
public override async Task ExecuteAsync(Event E)
{
var config = new ConfigurationManager(E.Owner);
if (config.GetProperty("EnableTrusted") == null)
config.AddProperty(new KeyValuePair<string, object>("EnableTrusted", false));
else
config.UpdateProperty(new KeyValuePair<string, object>("EnableTrusted", false));
await E.Origin.Tell("Trusted group has been disabled for this server");
}
}
}