mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
Fixed the ban loop bug (client goes into zombie state if immediately kicked upon joining, and won't disconnect until a timeout)
This commit is contained in:
@ -12,15 +12,17 @@ namespace SharedLibrary
|
||||
CancellationToken Token;
|
||||
DateTime StartTime;
|
||||
int TimesRun;
|
||||
int UpdateFrequency;
|
||||
public double RunAverage { get; private set; }
|
||||
public object Dependant { get; private set; }
|
||||
public Task RequestedTask { get; private set; }
|
||||
|
||||
public AsyncStatus(object dependant)
|
||||
public AsyncStatus(object dependant, int frequency)
|
||||
{
|
||||
Token = new CancellationToken();
|
||||
StartTime = DateTime.Now;
|
||||
Dependant = dependant;
|
||||
UpdateFrequency = frequency;
|
||||
// technically 0 but it's faster than checking for division by 0
|
||||
TimesRun = 1;
|
||||
}
|
||||
@ -40,10 +42,10 @@ namespace SharedLibrary
|
||||
RequestedTask = T;
|
||||
RequestedTask.Start();
|
||||
|
||||
if (TimesRun > 100)
|
||||
if (TimesRun > 25)
|
||||
TimesRun = 1;
|
||||
|
||||
RunAverage = RunAverage + ((DateTime.Now - StartTime).TotalMilliseconds - RunAverage) / TimesRun;
|
||||
RunAverage = RunAverage + ((DateTime.Now - StartTime).TotalMilliseconds - RunAverage - UpdateFrequency) / TimesRun;
|
||||
StartTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,11 @@ namespace SharedLibrary
|
||||
return ((Player)obj).npID == this.npID;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public Player(string n, string id, int num, int l)
|
||||
{
|
||||
Name = n;
|
||||
@ -178,6 +183,8 @@ namespace SharedLibrary
|
||||
public DateTime LastConnection { get; private set; }
|
||||
public Server currentServer { get; private set; }
|
||||
|
||||
public int Ping;
|
||||
|
||||
public Event lastEvent;
|
||||
public String lastOffense;
|
||||
public int Warnings;
|
||||
|
@ -32,12 +32,13 @@ namespace SharedLibrary.Network
|
||||
{
|
||||
String[] playerInfo = responseLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int cID = -1;
|
||||
int Ping = -1;
|
||||
Int32.TryParse(playerInfo[2], out Ping);
|
||||
String cName = Utilities.StripColors(responseLine.Substring(46, 18)).Trim();
|
||||
String npID = responseLine.Substring(29, 17).Trim(); // DONT TOUCH PLZ
|
||||
int.TryParse(playerInfo[0], out cID);
|
||||
String cIP = responseLine.Substring(72, 20).Trim().Split(':')[0];
|
||||
|
||||
Player P = new Player(cName, npID, cID, cIP);
|
||||
Player P = new Player(cName, npID, cID, cIP) { Ping = Ping };
|
||||
StatusPlayers.Add(P);
|
||||
}
|
||||
}
|
||||
|
@ -121,13 +121,13 @@ namespace SharedLibrary
|
||||
/// Get any know aliases ( name or ip based ) from the database
|
||||
/// </summary>
|
||||
/// <param name="Origin">Player to scan for aliases</param>
|
||||
abstract public List<Aliases> getAliases(Player Origin);
|
||||
abstract public List<Aliases> GetAliases(Player Origin);
|
||||
|
||||
public List<Player> getPlayerAliases(Player Origin)
|
||||
{
|
||||
List<int> databaseIDs = new List<int>();
|
||||
|
||||
foreach (Aliases A in getAliases(Origin))
|
||||
foreach (Aliases A in GetAliases(Origin))
|
||||
databaseIDs.Add(A.Number);
|
||||
|
||||
return Manager.GetClientDatabase().getPlayers(databaseIDs);
|
||||
|
@ -268,9 +268,9 @@ namespace SharedLibrary
|
||||
case 100:
|
||||
return "One-Hundreth (amazing!)";
|
||||
case 500:
|
||||
return "^7You're really ^5dedicated ^7to this server! This is your ^5500th ^7time connecting!";
|
||||
return "you're really ^5dedicated ^7to this server! This is your ^5500th^7";
|
||||
case 1000:
|
||||
return "WOW! Soldier, it's your ^11000th ^7time connecting! You deserve a medal.";
|
||||
return "you deserve a medal. it's your ^11000th^7";
|
||||
|
||||
default:
|
||||
return connection.ToString() + Prefix;
|
||||
|
Reference in New Issue
Block a user