1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Protecting rank from going to zero.

Discussion in 'BF2Statistics discussion' started by FiberLetalis, May 7, 2006.

  1. FiberLetalis

    FiberLetalis New Member

    We've experienced problems with some high ranks (actually starting from 2 - lance corporal) which sometimes drop back to 0. My assumption is that connection problems are to blame. When player joins the game-server fetches his rank info from stat-server. But if it didn't fetch this info for some reason, then on end of round player will have a 0 PID. Again, this is only assumption.

    To fix this issue - i've limited maximal rank decrement to 1 point.. This won't protect Private First Class to be mistakenly driven back to Private. But as i've seen this is not a big problem since lance corporal is earned quite fast.

    NOTE: This patch includes my previous modification (correction 'None' fields).

    NOTE: Didn't tested it thoroughly, but the code is very simple and i don't think anything can go wrong ;)

    diff -Naur old/bf2statistics.php new/bf2statistics.php
    --- old/bf2statistics.php	2006-02-19 01:20:16.000000000 +0600
    +++ new/bf2statistics.php	2006-05-07 13:49:00.754125000 +0700
    @@ -62,6 +62,9 @@
    // Get URL POST data
    $rawdata = file_get_contents('php://input');
    +$rawdata = str_replace('\\None\\', '\\0\\', $rawdata);
    // Seperate data
    $gooddata = explode('\\', $rawdata);
    @@ -263,6 +266,11 @@
    // Calculate best round score
    $rndscore = ($row['rndscore'] > $data["rs_$x"]) ? $row['rndscore'] : $data["rs_$x"];
    +			// Assume that rank can't go down 2 points after a match
    +			if ($data["rank_$x"] < $row['rank']-1) {
    +				$data["rank_$x"] = $row['rank'];
    +			}
    // Calculate rank change
    $chng = $decr = 0;
    if ($data["rank_$x"] != $row['rank'])
  2. FiberLetalis

    FiberLetalis New Member

    And yes, maybe there is a better way - apply a "Fix bot rank" block to all players instead of only to the bots, so stat-server calculaes ranks on it's own.This will solve problem once and for all :)
  3. ontestjimbo

    ontestjimbo New Member

    FiberLetalis can you post the solution plz ?