query(" SELECT description FROM hlstats_Actions WHERE id='$action_id' AND game='$game' "); if ($db->num_rows() != 1) { $act_name = ucfirst($action); } else { $actiondata = $db->fetch_array(); $db->free_result(); $act_name = $actiondata['description']; } $db->query("SELECT name FROM hlstats_Games WHERE code='$game'"); if ($db->num_rows() != 1) error('Invalid or no game specified.'); else list($gamename) = $db->fetch_row(); $table = new Table( array( new TableColumn( 'playerName', 'Player', 'width=45&align=left&flag=1&link=' . urlencode("mode=statsme&player=%k") ), new TableColumn( 'obj_count', 'Achieved', 'width=25&align=right' ), new TableColumn( 'obj_bonus', 'Skill Bonus Total', 'width=25&align=right&sort=no' ) ), 'playerId', 'obj_count', 'playerName', true, 50 ); $result = $db->query(" SELECT hlstats_Events_PlayerActions.playerId, hlstats_Players.lastName AS playerName, hlstats_Players.flag as flag, COUNT(hlstats_Events_PlayerActions.id) AS obj_count, COUNT(hlstats_Events_PlayerActions.id) * hlstats_Actions.reward_player AS obj_bonus FROM hlstats_Events_PlayerActions, hlstats_Players, hlstats_Actions WHERE hlstats_Actions.code = '$action' AND hlstats_Players.game = '$game' AND hlstats_Players.playerId = hlstats_Events_PlayerActions.playerId AND hlstats_Events_PlayerActions.actionId = hlstats_Actions.id AND hlstats_Players.hideranking<>'1' GROUP BY hlstats_Events_PlayerActions.playerId ORDER BY $table->sort $table->sortorder, $table->sort2 $table->sortorder LIMIT $table->startitem,$table->numperpage "); $resultCount = $db->query(" SELECT COUNT(DISTINCT hlstats_Events_PlayerActions.playerId), COUNT(hlstats_Events_PlayerActions.Id) FROM hlstats_Events_PlayerActions, hlstats_Players, hlstats_Actions WHERE hlstats_Actions.code = '$action' AND hlstats_Players.game = '$game' AND hlstats_Players.playerId = hlstats_Events_PlayerActions.playerId AND hlstats_Events_PlayerActions.actionId = hlstats_Actions.id "); list($numitems, $totalact) = $db->fetch_row($resultCount); if ($totalact == 0) { $result = $db->query(" SELECT hlstats_Events_TeamBonuses.playerId, hlstats_Players.lastName AS playerName, hlstats_Players.flag as flag, COUNT(hlstats_Events_TeamBonuses.id) AS obj_count, COUNT(hlstats_Events_TeamBonuses.id) * hlstats_Actions.reward_player AS obj_bonus FROM hlstats_Events_TeamBonuses, hlstats_Players, hlstats_Actions WHERE hlstats_Actions.code = '$action' AND hlstats_Players.game = '$game' AND hlstats_Players.playerId = hlstats_Events_TeamBonuses.playerId AND hlstats_Events_TeamBonuses.actionId = hlstats_Actions.id AND hlstats_Players.hideranking<>'1' GROUP BY hlstats_Events_TeamBonuses.playerId ORDER BY $table->sort $table->sortorder, $table->sort2 $table->sortorder LIMIT $table->startitem,$table->numperpage "); $resultCount = $db->query(" SELECT COUNT(DISTINCT hlstats_Events_TeamBonuses.playerId), COUNT(hlstats_Events_TeamBonuses.Id) FROM hlstats_Events_TeamBonuses, hlstats_Players, hlstats_Actions WHERE hlstats_Actions.code = '$action' AND hlstats_Players.game = '$game' AND hlstats_Players.playerId = hlstats_Events_TeamBonuses.playerId AND hlstats_Events_TeamBonuses.actionId = hlstats_Actions.id "); list($numitems, $totalact) = $db->fetch_row($resultCount); } ?> draw($result, $numitems, 100, 'center'); ?>