} else { $listB = getPlayers($playerB, 50); } } } if (sizeof($listA) == 1 && sizeof($listB) == 1) { if ($listA[0] == $playerA && $listB[0] == $playerB) { #We have found a match $found = true; if ($isTeam == true) { $idA = getTid($listA[0]); $idB = getTid($listB[0]); } else { $idA = getPid($listA[0]); $idB = getPid($listB[0]); } $scoreA = getScore($idA, $gt, $isTeam); $scoreB = getScore($idB, $gt, $isTeam); $newScoreA_1 = floor(calculateElo($scoreA, $scoreB, true)); $newScoreB_1 = floor(calculateElo($scoreB, $scoreA, false)); $newScoreA_2 = floor(calculateElo($scoreA, $scoreB, false)); $newScoreB_2 = floor(calculateElo($scoreB, $scoreA, true)); } } } if ($found == true) { include "{$BASE_FILES}/inc_whatif_results.php"; } else { include "{$BASE_FILES}/inc_whatif.php"; } include "{$BASE_FILES}/inc_bottom.php";
function calculateRanksPlayers($sqlServerKey, $winnerKey, $gameType) { $sql = "select distinct ge_playera from game_event where ge_serverkey='{$sqlServerKey}' and ge_playera is not null and ge_playera <> '{$winnerKey}' and (ge_eventtype = " . WINBOLO_NET_EVENT_BASE_CAPTURE . " or ge_eventtype = " . WINBOLO_NET_EVENT_PILL_CAPTURE . " or ge_eventtype = " . WINBOLO_NET_EVENT_BASE_STEAL . " or ge_eventtype = " . WINBOLO_NET_EVENT_PILL_STEAL . ")"; $result = mysql_query($sql); $loserKey = mysql_result($result, 0, 0); $winnerPid = getPidFromKey($winnerKey, $sqlServerKey); $loserPid = getPidFromKey($loserKey, $sqlServerKey); if ($winnerPid == 0 || $loserPid == 0) { return; } # Get player Ranks $winnerScore = getScore($winnerPid, $gameType, false); $loserScore = getScore($loserPid, $gameType, false); # Calclulate New Scores $newWinnerScore = calculateElo($winnerScore, $loserScore, true); $newLoserScore = calculateElo($loserScore, $winnerScore, false); # Update ranks setScore($winnerPid, $gameType, $newWinnerScore, false); setScore($loserPid, $gameType, $newLoserScore, false); updateWinsLoses($winnerPid, $gameType, true, false); updateWinsLoses($loserPid, $gameType, false, false); }