VERSION: 0.8.1

CHANGELOG:
-no longer have `world` client handle broken events
-hopefully fixed an issue with clients missing connection event
-fixed ban order in webfront
-fixed alias output duplicating
-fixed missing evade reason
-cleaned up project files
This commit is contained in:
RaidMax 2015-04-11 12:31:04 -05:00
parent 6b6b5f4a1c
commit 8e31cbe138
9 changed files with 91 additions and 119 deletions

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
</assemblyBinding>
</runtime>
</configuration>

View File

@ -725,9 +725,11 @@ namespace IW4MAdmin
E.Origin.Tell(message.ToString()); E.Origin.Tell(message.ToString());
} }
message = new StringBuilder();
if (E.Target.Alias.getIPS() != null) if (E.Target.Alias.getIPS() != null)
{ {
message.Append("IPS: "); message.Append("IPs: ");
foreach (Player P2 in playerAliases) foreach (Player P2 in playerAliases)
{ {

View File

@ -56,18 +56,22 @@
<PropertyGroup> <PropertyGroup>
<TargetZone>LocalIntranet</TargetZone> <TargetZone>LocalIntranet</TargetZone>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup />
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>4D1.ico</ApplicationIcon> <ApplicationIcon>IW4MAdmin.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>IW4MAdmin.Program</StartupObject> <StartupObject>IW4MAdmin.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Kayak"> <Reference Include="Kayak">
<HintPath>..\packages\Kayak.0.7.2\lib\Kayak.dll</HintPath> <HintPath>..\packages\Kayak.0.7.2\lib\Kayak.dll</HintPath>
@ -97,12 +101,6 @@
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="Maps.cs" /> <Compile Include="Maps.cs" />
<Compile Include="Player.cs" /> <Compile Include="Player.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="RCON.cs" /> <Compile Include="RCON.cs" />
<Compile Include="Report.cs" /> <Compile Include="Report.cs" />
<Compile Include="Server.cs" /> <Compile Include="Server.cs" />
@ -138,9 +136,6 @@
<Content Include="webfront\stats.html"> <Content Include="webfront\stats.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<Content Include="config\maps.cfg"> <Content Include="config\maps.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -168,8 +163,6 @@
<None Include="m2demo\settings\main.gsc"> <None Include="m2demo\settings\main.gsc">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -188,9 +181,8 @@
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="4D1.ico" /> <Content Include="IW4MAdmin.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy $(TargetDir)$(TargetFileName) $(SolutionDir)OFFICIAL\Release\$(TargetFileName) <PostBuildEvent>copy $(TargetDir)$(TargetFileName) $(SolutionDir)OFFICIAL\Release\$(TargetFileName)

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -33,5 +33,5 @@ using System.Resources;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.*")] [assembly: AssemblyVersion("0.8.1")]
[assembly: NeutralResourcesLanguageAttribute("en")] [assembly: NeutralResourcesLanguageAttribute("en")]

View File

@ -209,10 +209,34 @@ namespace IW4MAdmin
aliasDB.updatePlayer(NewPlayer.Alias); aliasDB.updatePlayer(NewPlayer.Alias);
clientDB.updatePlayer(NewPlayer); clientDB.updatePlayer(NewPlayer);
if (NewPlayer.getLevel() == Player.Permission.Banned) // their guid is already banned so no need to check aliases
{
String Message;
Log.Write("Banned client " + P.getName() + " trying to connect...", Log.Level.Debug);
if (NewPlayer.getLastO() != null)
Message = "^7Player Kicked: Previously banned for ^5" + NewPlayer.getLastO() + " ^7(appeal at " + Website + ")";
else
Message = "Player Kicked: Previous Ban";
NewPlayer.Kick(Message);
if (players[NewPlayer.getClientNum()] != null)
{
lock (players)
{
players[NewPlayer.getClientNum()] = null;
}
}
return true;
}
List<Player> newPlayerAliases = new List<Player>(); List<Player> newPlayerAliases = new List<Player>();
getAliases(newPlayerAliases, NewPlayer); getAliases(newPlayerAliases, NewPlayer);
foreach (Player aP in newPlayerAliases) foreach (Player aP in newPlayerAliases) // lets check their aliases
{ {
if (aP == null) if (aP == null)
continue; continue;
@ -220,39 +244,12 @@ namespace IW4MAdmin
if (aP.getLevel() == Player.Permission.Flagged) if (aP.getLevel() == Player.Permission.Flagged)
NewPlayer.setLevel(Player.Permission.Flagged); NewPlayer.setLevel(Player.Permission.Flagged);
String Reason = String.Empty;
String Message = String.Empty;
if (NewPlayer.getLevel() == Player.Permission.Banned)
{
Log.Write("Banned client " + P.getName() + " trying to connect...", Log.Level.Debug);
if (aP.getLastO() != null)
Message = "^7Player Kicked: Previously banned for ^5" + aP.getLastO() + " ^7(appeal at " + Website+ ")";
else
Message = "Player Kicked: Previous Ban";
NewPlayer.Kick(Message);
if (players[NewPlayer.getClientNum()] != null)
{
lock (players)
{
players[NewPlayer.getClientNum()] = null;
}
}
return true;
}
Ban B = isBanned(aP); Ban B = isBanned(aP);
if (B != null && aP != null) if (B != null)
{ {
Log.Write("Banned alias " + aP.getName() + " trying to connect...", Log.Level.Debug); Log.Write(String.Format("Banned client {0} is connecting with new alias {1}", aP.getName(), NewPlayer.getName()), Log.Level.Debug);
NewPlayer.LastOffense = String.Format("Evading ( {0} )", aP.getName());
aP.lastEvent = NewPlayer.lastEvent;
aP.LastOffense = "Evading";
if (B.getReason() != null) if (B.getReason() != null)
NewPlayer.Ban("^7Previously Banned: ^5" + B.getReason() + " ^7(appeal at " + Website + ")", NewPlayer); NewPlayer.Ban("^7Previously Banned: ^5" + B.getReason() + " ^7(appeal at " + Website + ")", NewPlayer);
@ -276,7 +273,7 @@ namespace IW4MAdmin
#if DEBUG == FALSE #if DEBUG == FALSE
NewPlayer.Tell("Welcome ^5" + NewPlayer.getName() + " ^7this is your ^5" + Utilities.timesConnected(NewPlayer.getConnections()) + " ^7time connecting!"); NewPlayer.Tell("Welcome ^5" + NewPlayer.getName() + " ^7this is your ^5" + Utilities.timesConnected(NewPlayer.getConnections()) + " ^7time connecting!");
#endif #endif
Log.Write("Client " + NewPlayer.getName() + " connecting...", Log.Level.Debug); Log.Write("Client " + NewPlayer.getName() + " connecting...", Log.Level.Debug); // they're clean
if (NewPlayer.getLevel() == Player.Permission.Flagged) if (NewPlayer.getLevel() == Player.Permission.Flagged)
ToAdmins("^1NOTICE: ^7Flagged player ^5" + NewPlayer.getName() + "^7 has joined!"); ToAdmins("^1NOTICE: ^7Flagged player ^5" + NewPlayer.getName() + "^7 has joined!");
@ -384,6 +381,10 @@ namespace IW4MAdmin
//Check ban list for every banned player and return ban if match is found //Check ban list for every banned player and return ban if match is found
public Ban isBanned(Player C) public Ban isBanned(Player C)
{ {
if (C.getLevel() == Player.Permission.Banned)
return Bans.Find(p => p.getID().Equals(C.getID()));
foreach (Ban B in Bans) foreach (Ban B in Bans)
{ {
if (B.getID().Length < 5 || B.getIP().Length < 5) if (B.getID().Length < 5 || B.getIP().Length < 5)
@ -584,7 +585,7 @@ namespace IW4MAdmin
if (event_ != null) if (event_ != null)
{ {
if (event_.Origin == null) if (event_.Origin == null)
event_.Origin = new Player("WORLD", "-1", -1, 0); continue;
event_.Origin.lastEvent = event_; event_.Origin.lastEvent = event_;
event_.Origin.lastEvent.Owner = this; event_.Origin.lastEvent.Owner = this;
@ -631,14 +632,35 @@ namespace IW4MAdmin
{ {
lastPoll = DateTime.Now; lastPoll = DateTime.Now;
timesFailed = 0; timesFailed = 0;
if (statusPlayers.Count > clientnum) if (statusPlayers.Count != clientnum)
{ {
lock (statusPlayers) lock (statusPlayers)
{ {
List<Player> toRemove = new List<Player>();
lock (players)
{
foreach (Player P in players)
{
if (P == null)
continue;
Player Matching;
statusPlayers.TryGetValue(P.getID(), out Matching);
if (Matching == null) // they are no longer with us
toRemove.Add(P);
}
foreach (Player Removing in toRemove) // cuz cant modify collections
removePlayer(Removing.getClientNum());
}
foreach (var P in statusPlayers.Values) foreach (var P in statusPlayers.Values)
{ {
if (P == null) if (P == null)
{
Log.Write("Null player found in statusPlayers", Log.Level.Debug);
continue; continue;
}
if (!addPlayer(P)) if (!addPlayer(P))
Log.Write("Error adding " + P.getName() + " at client slot #" + P.getClientNum(), Log.Level.Debug); Log.Write("Error adding " + P.getName() + " at client slot #" + P.getClientNum(), Log.Level.Debug);
@ -646,25 +668,6 @@ namespace IW4MAdmin
} }
} }
else if (statusPlayers.Count < clientnum)
{
List<Player> toRemove = new List<Player>();
foreach (Player P in players)
{
if (P == null)
continue;
Player Matching;
statusPlayers.TryGetValue(P.getID(), out Matching);
if (Matching == null) // they are no longer with us
toRemove.Add(P);
}
foreach (Player Removing in toRemove) // cuz cant modify collections
removePlayer(Removing.getClientNum());
}
clientnum = statusPlayers.Count; clientnum = statusPlayers.Count;
} }
@ -694,6 +697,7 @@ namespace IW4MAdmin
if (infoResponse == null || infoResponse.Length < 2) if (infoResponse == null || infoResponse.Length < 2)
{ {
Log.Write("Could not get server status!", Log.Level.All); Log.Write("Could not get server status!", Log.Level.All);
hostname = "Offline"; // for the web front
return false; return false;
} }
@ -728,7 +732,7 @@ namespace IW4MAdmin
Website = infoResponseDict["_website"]; Website = infoResponseDict["_website"];
} }
catch (Exception E) catch (Exception)
{ {
Website = "this server's website"; Website = "this server's website";
Log.Write("Seems not to have website specified", Log.Level.Debug); Log.Write("Seems not to have website specified", Log.Level.Debug);
@ -803,7 +807,7 @@ namespace IW4MAdmin
//END //END
//get iw4m_onelog //get iw4m_onelog
p =RCON.addRCON("iw4m_onelog"); p = RCON.addRCON("iw4m_onelog");
if (p[0] == String.Empty || p[1].Length < 15) if (p[0] == String.Empty || p[1].Length < 15)
{ {
@ -820,7 +824,7 @@ namespace IW4MAdmin
logPath = Basepath + '\\' + "m2demo" + '\\' + log; logPath = Basepath + '\\' + "m2demo" + '\\' + log;
else else
logPath = Basepath + '\\' + Mod + '\\' + log; logPath = Basepath + '\\' + Mod + '\\' + log;
//#if DEBUG == FALSE && System.Environment.GetEnvironmentVariable("COMPUTERNAME") != "michael-surface"
if (!File.Exists(logPath)) if (!File.Exists(logPath))
{ {
Log.Write("Gamelog does not exist!", Log.Level.All); Log.Write("Gamelog does not exist!", Log.Level.All);
@ -828,7 +832,6 @@ namespace IW4MAdmin
} }
logFile = new file(logPath); logFile = new file(logPath);
//#endif
Log.Write("Log file is " + logPath, Log.Level.Debug); Log.Write("Log file is " + logPath, Log.Level.Debug);
//get players ip's //get players ip's
@ -847,7 +850,6 @@ namespace IW4MAdmin
System.IO.Stream ftpStream = tmp.GetResponse().GetResponseStream(); System.IO.Stream ftpStream = tmp.GetResponse().GetResponseStream();
String ftpLog = new StreamReader(ftpStream).ReadToEnd();*/ String ftpLog = new StreamReader(ftpStream).ReadToEnd();*/
//logPath = "games_old.log"; //logPath = "games_old.log";
//logFile = new file("C:\\Users\\Michael\\text.txt");
#endif #endif
Log.Write("Now monitoring " + this.getName(), Log.Level.Debug); Log.Write("Now monitoring " + this.getName(), Log.Level.Debug);
return true; return true;
@ -862,7 +864,7 @@ namespace IW4MAdmin
//Process any server event //Process any server event
public bool processEvent(Event E) public bool processEvent(Event E)
{ {
/*if (E.Type == Event.GType.Connect) /*if (E.Type == Event.GType.Connect) // this is anow handled by rcon status :(
{ {
if (E.Origin == null) if (E.Origin == null)
Log.Write("Connect event triggered, but no client is detected!", Log.Level.Debug); Log.Write("Connect event triggered, but no client is detected!", Log.Level.Debug);
@ -870,6 +872,11 @@ namespace IW4MAdmin
return true; return true;
}*/ }*/
if (E.Type == Event.GType.Connect)
{
return true;
}
if (E.Type == Event.GType.Disconnect) if (E.Type == Event.GType.Disconnect)
{ {
if (E.Origin == null) if (E.Origin == null)
@ -924,7 +931,7 @@ namespace IW4MAdmin
Log.Write(E.Origin.getName() + " killed " + E.Target.getName() + " with a " + E.Data, Log.Level.Debug); Log.Write(E.Origin.getName() + " killed " + E.Target.getName() + " with a " + E.Data, Log.Level.Debug);
} }
else //Suicide else // suicide/falling
{ {
E.Origin.stats.Deaths++; E.Origin.stats.Deaths++;
E.Origin.stats.updateKDR(); E.Origin.stats.updateKDR();
@ -991,6 +998,7 @@ namespace IW4MAdmin
String[] statusResponse = E.Data.Split('\\'); String[] statusResponse = E.Data.Split('\\');
if (statusResponse.Length >= 15 && statusResponse[13] == "mapname") if (statusResponse.Length >= 15 && statusResponse[13] == "mapname")
mapname = maps.Find(m => m.Name.Equals(statusResponse[14])).Alias; //update map for heartbeat mapname = maps.Find(m => m.Name.Equals(statusResponse[14])).Alias; //update map for heartbeat
return true;
} }
if (E.Type == Event.GType.MapEnd) if (E.Type == Event.GType.MapEnd)
@ -1325,7 +1333,6 @@ namespace IW4MAdmin
//Will probably move this later //Will probably move this later
//public Dictionary<String, String> IPS;
public Dictionary<String, Player> statusPlayers; public Dictionary<String, Player> statusPlayers;
public bool isRunning; public bool isRunning;
private DateTime lastPoll; private DateTime lastPoll;

View File

@ -120,7 +120,7 @@ namespace IW4MAdmin_Web
List<IW4MAdmin.Ban> Bans = new List<IW4MAdmin.Ban>(); List<IW4MAdmin.Ban> Bans = new List<IW4MAdmin.Ban>();
if (totalBans > 0) if (totalBans > 0)
Bans = IW4MAdmin.Program.Servers[0].Bans.GetRange(start, range); Bans = IW4MAdmin.Program.Servers[0].Bans.GetRange(start, range).OrderByDescending(x => x.getTime()).ToList();
else else
Bans.Add(new IW4MAdmin.Ban("No Bans", "0", "0", DateTime.Now, "")); Bans.Add(new IW4MAdmin.Ban("No Bans", "0", "0", DateTime.Now, ""));
@ -180,7 +180,7 @@ namespace IW4MAdmin_Web
range = (totalStats - start); range = (totalStats - start);
else else
range = 30; range = 30;
List<IW4MAdmin.Stats> Stats = IW4MAdmin.Program.Servers[server].statDB.getMultipleStats(start, range); List<IW4MAdmin.Stats> Stats = IW4MAdmin.Program.Servers[server].statDB.getMultipleStats(start, range).OrderByDescending(x => x.Skill).ToList();
buffer.Append("<tr><th style=text-align:left;>Name</th><th style=text-align:left;>Kills</th><th style=text-align:left;>Deaths</th><th style=text-align:left;>KDR</th><th style='width: 175px; text-align:right;'>Rating</th></tr>"); buffer.Append("<tr><th style=text-align:left;>Name</th><th style=text-align:left;>Kills</th><th style=text-align:left;>Deaths</th><th style=text-align:left;>KDR</th><th style='width: 175px; text-align:right;'>Rating</th></tr>");
cycleFix = 0; cycleFix = 0;
for (int i = 0; i < totalStats; i++) for (int i = 0; i < totalStats; i++)

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kayak" version="0.7.2" targetFramework="net40" />
</packages>

View File

@ -1,22 +1,8 @@
VERSION: 0.8 VERSION: 0.8.1
CHANGELOG: CHANGELOG:
-added mask command -no longer have `world` client handle broken events
-added baninfo command -hopefully fixed an issue with clients missing connection event
-added alias command and removed redundant output from `find` -fixed ban order in webfront
-added rcon command -fixed alias output duplicating
-added webfront (http://127.0.0.1:1624) -fixed missing evade reason
-true skill is officially implemented -cleaned up project files
-find now shows last connect time
-noise on pm (if gsc_enabled)
-force 8 line chat height (if gsc_enabled)
-tell admins the number of reports on join
-enhanced ban tracking
-ip wait timeout added
-remove report on ban
-can't report yourself
-remove reported players when banned
-fixed rare crash with toadmins backend
-fixed crash when finding player stats that don't exist
-fixed a bug that caused owner command to reactivate only `creator` rank player existed
-fixed a bug that caused certain notifications to be sent to all players
-various small fixes