1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-11 15:52:25 -05:00

added 'none' and extra m16 variants to weapon list

moved killstreak/deathstreak messages into configuration file
cleaned up configuration manager
fixed misc startup issue and threading
added more importing stuff
network id is a ulong now
ip str is now ip
added time played (per server)
This commit is contained in:
RaidMax
2018-02-10 22:33:42 -06:00
parent d1cdb93cc3
commit b8a161161d
33 changed files with 418 additions and 213 deletions

View File

@ -207,6 +207,12 @@ namespace IW4MAdmin
if (Status.RunAverage > 1000 + UPDATE_FREQUENCY)
Logger.WriteWarning($"Update task average execution is longer than desired for {(Status.Dependant as Server)} [{Status.RunAverage}ms]");
}
if (Status.RequestedTask.Status == TaskStatus.Faulted)
{
Logger.WriteWarning($"Update task for {(Status.Dependant as Server)} faulted, restarting");
Status.Abort();
}
}
Thread.Sleep(UPDATE_FREQUENCY);

View File

@ -380,6 +380,7 @@ namespace IW4MAdmin
DateTime playerCountStart = DateTime.Now;
DateTime lastCount = DateTime.Now;
DateTime tickTime = DateTime.Now;
bool firstRun = true;
override public async Task<bool> ProcessUpdatesAsync(CancellationToken cts)
{
@ -388,6 +389,13 @@ namespace IW4MAdmin
try
#endif
{
// first start
if (firstRun)
{
await ExecuteEvent(new Event(Event.GType.Start, "Server started", null, null, this));
firstRun = false;
}
if ((DateTime.Now - LastPoll).TotalMinutes < 2 && ConnectionErrors >= 1)
return true;
@ -596,7 +604,6 @@ namespace IW4MAdmin
LogFile = new RemoteFile("https://raidmax.org/IW4MAdmin/getlog.php");
#endif
Logger.WriteInfo("Log file is " + logPath);
await ExecuteEvent(new Event(Event.GType.Start, "Server started", null, null, this));
#if !DEBUG
Broadcast("IW4M Admin is now ^2ONLINE");
#endif
@ -617,13 +624,13 @@ namespace IW4MAdmin
else if (E.Type == Event.GType.Script)
{
if (E.Origin == E.Target)// suicide/falling
/* if (E.Origin == E.Target)// suicide/falling
await ExecuteEvent(new Event(Event.GType.Death, E.Data, E.Target, E.Target, this));
else
{
{*/
await ExecuteEvent(new Event(Event.GType.Kill, E.Data, E.Origin, E.Target, this));
await ExecuteEvent(new Event(Event.GType.Death, E.Data, E.Target, E.Origin, this));
}
//await ExecuteEvent(new Event(Event.GType.Death, E.Data, E.Target, E.Origin, this));
// }
}
if (E.Type == Event.GType.Say && E.Data.Length >= 2)
@ -806,7 +813,7 @@ namespace IW4MAdmin
}
else
await Target.CurrentServer.ExecuteCommandAsync($"clientkick {Target.ClientNumber } \"^1Player Temporarily Banned: ^5{ Reason }\"");
await Target.CurrentServer.ExecuteCommandAsync($"clientkick {Target.ClientNumber } \"^7Player Temporarily Banned: ^5{ Reason }\"");
#if DEBUG
await Target.CurrentServer.RemovePlayer(Target.ClientNumber);

View File

@ -232,7 +232,7 @@ namespace IW4MAdmin
bool authed = querySet["IP"] == "127.0.0.1"
|| (await (ApplicationManager.GetInstance().GetClientService() as ClientService).GetPrivilegedClients())
.Where(x => x.IPAddress == querySet["IP"])
.Where(x => x.IPAddress == querySet["IP"].ConvertToIP())
.Where(x => x.Level > Player.Permission.Trusted).Count() > 0;
@ -384,7 +384,7 @@ namespace IW4MAdmin
if (S != null)
{
// fixme
Func<EFClient, bool> predicate = c => c.IPAddress == querySet["IP"];
Func<EFClient, bool> predicate = c => c.IPAddress == querySet["IP"].ConvertToIP();
Player admin = (await ApplicationManager.GetInstance().GetClientService().Find(predicate)).FirstOrDefault()?.AsPlayer();
if (admin == null)
@ -752,7 +752,7 @@ namespace IW4MAdmin
contentType = GetContentType(),
additionalHeaders = new Dictionary<string, string>()
};
Func<EFClient, bool> predicate = c => c.IPAddress == querySet["IP"] && c.Level > Player.Permission.Trusted;
Func<EFClient, bool> predicate = c => c.IPAddress == querySet["IP"].ConvertToIP() && c.Level > Player.Permission.Trusted;
bool authed = (await ApplicationManager.GetInstance().GetClientService().Find(predicate)).Count > 0
|| querySet["IP"] == "127.0.0.1";
bool recent = false;
@ -765,7 +765,7 @@ namespace IW4MAdmin
else if (querySet["npID"] != null)
{
matchedPlayers.Add(await ApplicationManager.GetInstance().GetClientService().GetUnique(querySet["npID"]));
matchedPlayers.Add(await ApplicationManager.GetInstance().GetClientService().GetUnique(querySet["npID"].ConvertLong()));
}
else if (querySet["name"] != null)
@ -793,11 +793,11 @@ namespace IW4MAdmin
PlayerInfo eachPlayer = new PlayerInfo()
{
playerIP = pp.IPAddress,
playerIP = pp.IPAddressString,
playerID = pp.ClientId,
playerLevel = pp.Level.ToString(),
playerName = pp.Name,
playernpID = pp.NetworkId,
playernpID = pp.NetworkId.ToString(),
forumID = -1,
authed = authed,
showV2Features = false,
@ -815,7 +815,7 @@ namespace IW4MAdmin
if (authed)
eachPlayer.playerIPs = pp.AliasLink.Children
.Select(a => a.IPAddress)
.Select(a => a.IPAddress.ConvertIPtoString())
.Distinct()
.ToList();
}

Binary file not shown.