Esempio n. 1
0
function getNextRankInfo($PID)
{
    // Get player data
    $player = getPlayerDataFromPID($PID);
    // Read the lines from the ranks list,a dn assign a key to each rank
    $lines = file(getcwd() . "/queries/ranks.list");
    foreach ($lines as $key => $value) {
        $rank[$key] = $value;
    }
    unset($lines);
    // Read the lines from the ranks points list to assign needed points for each rank
    $lines = file(getcwd() . "/queries/rank_points.list");
    foreach ($lines as $key => $value) {
        $points[$key] = $value;
    }
    unset($lines);
    // Lets get our SPM, very important
    $SPM = round($player['score'] / intToMins($player['time']), 1);
    // Init a return array
    $return = array();
    // Initiate next 3 ranks before checking 1SG, SGM checks
    $NEXT_RANK = array();
    $NEXT_RANK[0] = $player['rank'] + 1;
    $NEXT_RANK[1] = $player['rank'] + 2;
    $NEXT_RANK[2] = $player['rank'] + 3;
    // Include the requirements for special ranks, and get the next 3
    include getcwd() . "/queries/nextRankReqs.php";
    $RANK = getNext3($PID, $NEXT_RANK[0], $NEXT_RANK[1], $NEXT_RANK[2]);
    // Next rank
    $return[0] = array('rank' => $RANK[0], 'title' => $rank[$RANK[0]], 'rank_points' => $points[$RANK[0]], 'points_needed' => $points[$RANK[0]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[0]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[0]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[0]], $SPM));
    // 2 ranks away
    $return[1] = array('rank' => $RANK[1], 'title' => $rank[$RANK[1]], 'rank_points' => $points[$RANK[1]], 'points_needed' => $points[$RANK[1]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[1]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[1]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[1]], $SPM));
    // 3 ranks away
    $return[2] = array('rank' => $RANK[2], 'title' => $rank[$RANK[2]], 'rank_points' => $points[$RANK[2]], 'points_needed' => $points[$RANK[2]] - $player['score'], 'percent' => getPercent($player['score'], $points[$RANK[2]]), 'days' => getNextRankDayCount($player['joined'], $player['lastonline'], $player['score'], $points[$RANK[2]]), 'time_straight' => getNextRankTime($player['score'], $points[$RANK[2]], $SPM));
    return $return;
}
Esempio n. 2
0
				<tr>
					<td>Total &amp; Streak</td>

					<td>';
if ($player['deathstreak']) {
    $template .= $player['deaths'] . ' / ' . $player['deathstreak'];
} else {
    $template .= $player['deaths'];
}
$template .= '</td>
					</tr>
				<tr>
					<td>Per Minute </td>
					<td>';
if ($player['time']) {
    $template .= round($player['deaths'] / round(intToMins($player['time']), 0), 3);
} else {
    $template .= $player['deaths'];
}
$template .= '</td>
					</tr>
				<tr>

					<td>Per Round </td>
					<td>';
if ($player['rounds']) {
    $template .= round($player['deaths'] / $player['rounds'], 3);
} else {
    $template .= round($player['deaths']);
}
$template .= '</td>