diff --git a/source/masterserver/showGameStats.php b/source/masterserver/showGameStats.php index 5cc69922..a12a3558 100644 --- a/source/masterserver/showGameStats.php +++ b/source/masterserver/showGameStats.php @@ -89,7 +89,6 @@ echo ' Player Type' . PHP_EOL; echo ' Resource Multiplier' . PHP_EOL; echo ' Faction Type' . PHP_EOL; - echo ' Personality Type' . PHP_EOL; echo ' Team' . PHP_EOL; echo ' Winner' . PHP_EOL; echo ' Kills' . PHP_EOL; @@ -98,10 +97,22 @@ echo ' Units Produced' . PHP_EOL; echo ' Resources Harvested' . PHP_EOL; echo ' Player Name' . PHP_EOL; + echo ' Score' . PHP_EOL; echo ' Quit Before Game Ended' . PHP_EOL; echo ' Quit Time' . PHP_EOL; echo ' ' . PHP_EOL; + $best_score = 0; + foreach( $all_player_stats as $player_stats ) + { + $player_score = $player_stats['enemyKillCount'] * 100 + $player_stats['unitsProducedCount'] * 50 + $player_stats['resourceHarvestedCount'] / 10; + + if($best_score < $player_score) + { + $best_score = $player_score; + } + } + foreach( $all_player_stats as $player_stats ) { echo "\t\t\t" . '' . PHP_EOL; @@ -155,30 +166,31 @@ printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['resourceMultiplier'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['factionTypeName'], ENT_QUOTES ), PHP_EOL ); - - $personalityType = $player_stats['personalityType']; - switch ( $personalityType ) - { - case 0: - $personalityType = "Normal"; - break; - case 1: - $personalityType = "Observer"; - break; - default: - $personalityType = 'unknown'; - } - - printf( "\t\t\t\t%s%s", htmlspecialchars( $personalityType, ENT_QUOTES ), PHP_EOL ); - printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['teamIndex'], ENT_QUOTES ), PHP_EOL ); - printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['wonGame'], ENT_QUOTES ), PHP_EOL ); + + $wonGame_class = "player_loser"; + if($player_stats['wonGame']) + { + $wonGame_class = "player_winner"; + } + + printf( "\t\t\t\t%s%s", $wonGame_class, htmlspecialchars( $player_stats['wonGame'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['killCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['enemyKillCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['deathCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['unitsProducedCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['resourceHarvestedCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['playerName'], ENT_QUOTES ), PHP_EOL ); + + $player_score = $player_stats['enemyKillCount'] * 100 + $player_stats['unitsProducedCount'] * 50 + $player_stats['resourceHarvestedCount'] / 10; + $player_score_class = "player_losing_score"; + if($player_score == $best_score) + { + $player_score_class = "player_high_score"; + } + + printf( "\t\t\t\t%s%s", $player_score_class, htmlspecialchars( $player_score, ENT_QUOTES ), PHP_EOL ); + printf( "\t\t\t\t%s%s", htmlspecialchars( $player_stats['quitBeforeGameEnd'], ENT_QUOTES ), PHP_EOL ); $quitTime = $player_stats['quitTime']; diff --git a/source/masterserver/showServers.php b/source/masterserver/showServers.php index ef7b2a8e..2bf9e5e0 100644 --- a/source/masterserver/showServers.php +++ b/source/masterserver/showServers.php @@ -31,7 +31,7 @@ // consider replacing this by a cron job cleanupServerList(); - $servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' ); + $servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' ); $all_servers = array(); while ( $server = mysql_fetch_array( $servers_in_db ) ) { diff --git a/source/masterserver/showServersJson.php b/source/masterserver/showServersJson.php index 4858d3d0..2efc23a3 100644 --- a/source/masterserver/showServersJson.php +++ b/source/masterserver/showServersJson.php @@ -12,7 +12,7 @@ // consider replacing this by a cron job cleanupServerList(); - $servers_in_db = mysql_query( 'SELECT * FROM glestserver status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' ); + $servers_in_db = mysql_query( 'SELECT * FROM glestserver status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' ); $all_servers = array(); while ( $server = mysql_fetch_array( $servers_in_db ) ) { diff --git a/source/masterserver/style/screen.css b/source/masterserver/style/screen.css index 07ee4fc4..a2b4f356 100644 --- a/source/masterserver/style/screen.css +++ b/source/masterserver/style/screen.css @@ -48,3 +48,17 @@ th { .unknown { background-color: Red; } + +.player_high_score { + background-color: LightGreen; +} +.player_losing_score { + background-color: Yellow; +} +.player_winner { + background-color: LightGreen; +} +.player_loser { + background-color: Red; +} +