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.

Gamer

Recent Posts

Ledx have been so hard for me this wipe

Not being able to craft them sucks. Especially when everyone I talk to about it…

1 year ago

My interesting and unfortunate Gwent life

First I'd like to say I absolutely love this game it's quality. Basically I first…

1 year ago

Teacher Tuesday 12/Dec/2023 – ask your questions here!

Welcome to Teacher Tuesday, a thread where anyone can ask any type of question without…

1 year ago

This games balance is confusing

I’m kind of new/returning to gwent I played beta and obviously it’s a lot lot…

1 year ago

Summary of 10 Days of Draws from Chaffee’s Bundles

Level 1 Bag (Free with Atmosphere Level 2) 6 small consumable (First Aid, Repair, Fire…

1 year ago

Why is my crew at 135%?

Here's my crew - T34-85M - for the life of me I cant figure out…

1 year ago