Ejemplo 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;
}
Ejemplo n.º 2
0
if ($GET) {
    // output the nice save-url
    header("Location: " . $ROOT . '?go=my-leaderboard&pid=' . urlencode($LEADERBOARD));
    exit;
}
/***************************************************************
 * ESTABLISH DATABASE CONNECTION AND DATA MANAGMENT
 ***************************************************************/
include_once './datamanagement.inc.php';
$link = mysql_connect($DBIP, $DBLOGIN, $DBPASSWORD) or die('Could not connect: ' . mysql_error());
mysql_select_db($DBNAME) or die('Could not select database');
/***************************************************************
 * PLAYERSTATS
 ***************************************************************/
if ($GO == "0" && $PID) {
    $player = getPlayerDataFromPID($PID);
    // receive player data
    $victims = getFavouriteVictims($PID);
    // receive victim data
    $enemies = getFavouriteEnemies($PID);
    // receive enemie data
    $armies = getArmyData($PID);
    // receive army data
    $armySummary = getArmySummaries($armies);
    // retrieve Army summary
    $unlocks = getUnlocksByPID($PID);
    // retrieve unlock data
    $vehicles = getVehicleData($PID);
    // retrieve vehivle data
    $vehicleSummary = getVehicleSummaries($vehicles);
    // retrieve Vehicle summary