Global Statistics – Source Code

<script type="text/javascript">
    var x = 250292843828,
        y = 1500000000000,
        left = Number(y) - Number(x),
        count = x;

    if (left < 0) {
        left = 0;
    }

    if ((Number(x) > Number(y)) && (0 < Number(y))) {
        count = y;
    }

    $('.count').text(numberWithSpaces(count));
    $('.count_left').text(numberWithSpaces(left));

    function numberWithSpaces(x) {
        return String(x).toString().replace(/B(?=(d{3})+(?!d))/g, " ");
    }
</script>

Located here – View the source of the page. (CTRL+U)

This is the page source for the /cash. The maximum y value is 1.5T (the money needed), and the current x value is what is currently donated by players. On the surface, the Y is updating and is actually at 1.2T right now, but don't be discouraged as the number cannot exceed 1.5T as defined here:

var x = 250292843828,
    y = 1500000000000,

Looking at the meat and potatoes of the function:

if ((Number(x) > Number(y)) && (0 < Number(y))) {
        count = y;

Looking at this, we can understand that when x (the donated amount) is greater than y (the debt) AND 0 is less than y (the debt, so it doesn't go into the negative for any reason), the count for x and the count for y will be equivalent. count = x, count = y, therefore x = y. Although it states that x must be greater than y, which is odd since that could mean players MUST donate MORE than 1.5T (could be 1.5T + 1 and it would satisfy the requirements, but that is just an interesting thing to note since they didn't use ">=" (greater than OR equal to) or even "==" (just equal to).

Gotta hand it to them, this is pretty neat and had a lot of us fooled. Some of us thought so simplistically that 4/28 was gonna be a wipe, and some others thought it was gonna be a simple expansion type deal, but it was in front of our faces symbolically the whole time. The damaged door, LK, Fence. Good stuff, very creative.

Don't worry about this line of code:

function numberWithSpaces(x) {
        return String(x).toString().replace(/B(?=(d{3})+(?!d))/g

This line of code is just to graphically put spaces between the numbers for visual purposes. It counts three numbers and inserts a space, and then repeats until it reaches the end of the number. (specifically number x which is the top number, or the money donated by players)

Just thought I would share this stuff. Pretty neat.

This was originally posted by /u/ThisIsNari – I have no clue as to why this extremely informative post explaining the code behind the global statistics page was removed. I messaged him and asked him for permission to repost it.

Source: https://www.reddit.com/r/EscapefromTarkov/comments/ue6l3h/global_statistics_source_code/

leave a comment

Your email address will not be published. Required fields are marked *