marceloorigoni.com.ar / match fix

// ==UserScript==
// @name        match fix
// @namespace   nb_mf
// @include     http://www.neuronball.com/*/game/*/
// @include     http://www.neuronball.com/*/game/*
// @downloadURL https://openuserjs.org/install/marceloorigoni.com.ar/match_fix.user.js
// @version     1.5
// @grant       none
// ==/UserScript==
clearInterval(infos_update_intv);
window.PlayField = null;
window.PlayField = (function() {
    function PlayField(view) {
        this.view = view;
        this.mobiles = [];
        this.mobiles.push(new Ball(view.size.ball_size, this.view.img_ballshadow));
        this.team1 = new Team(this, 0);
        this.team2 = new Team(this, 1);
        this.scoretrackreader = [{}, {}];
        this.possessionreader = [{}, {}];
        this.initialized = false;
        this.t1 = [];
        this.t2 = [];
        this.players_by_id = [];
        this.init();
    }
    PlayField.prototype.init = function() {
        var chunk, i, _i, _j, _ref, _ref1;
        if (!this.initialized) {
            chunk = this.view.game.getInfo();
            if (chunk.data != null) {
                this.initialized = true;
                this.team1.suit.set(chunk.data.teams[0].pattern, chunk.data.teams[0].main_tint, chunk.data.teams[0].secondary_tint);
                this.team2.suit.set(chunk.data.teams[1].pattern, chunk.data.teams[1].main_tint, chunk.data.teams[1].secondary_tint);
                for (i = _i = 0, _ref = chunk.data.teams[0].players.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
                    this.team1.addPlayer();
                    this.team1.players[i].info.id = chunk.data.teams[0].players[i].id;
                    this.team1.players[i].info.name = chunk.data.teams[0].players[i].name;
                    this.team1.players[i].info.num = chunk.data.teams[0].players[i].number;
                    this.team1.players[i].info.eyes = chunk.data.teams[0].players[i].eyes;
                    this.team1.players[i].type_id = chunk.data.teams[0].players[i].type_id;
                    this.team1.players[i].setNumber(chunk.data.teams[0].players[i].number);
                    this.team1.players[i].booster_active = chunk.data.teams[0].players[i].booster_active;
                    this.t1[this.team1.players[i].info.id] = this.team1.players[i];
                    this.players_by_id[this.team1.players[i].info.id] = this.team1.players[i];
                }
                for (i = _j = 0, _ref1 = chunk.data.teams[1].players.length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
                    this.team2.addPlayer();
                    this.team2.players[i].info.id = chunk.data.teams[1].players[i].id;
                    this.team2.players[i].info.name = chunk.data.teams[1].players[i].name;
                    this.team2.players[i].info.num = chunk.data.teams[1].players[i].number;
                    this.team2.players[i].info.eyes = chunk.data.teams[1].players[i].eyes;
                    this.team2.players[i].type_id = chunk.data.teams[1].players[i].type_id;
                    this.team2.players[i].setNumber(chunk.data.teams[1].players[i].number);
                    this.team2.players[i].booster_active = chunk.data.teams[1].players[i].booster_active;
                    this.t2[this.team2.players[i].info.id] = this.team2.players[i];
                    this.players_by_id[this.team2.players[i].info.id] = this.team2.players[i];
                }
            }
        }
    };
    PlayField.prototype.updatePositions = function(game, pos) {
        var chunk, i, p, _i, _j, _k, _l, _ref, _ref1, _ref2, _ref3;
        chunk = game.getChunk((pos / 300) | 0);
        if ((chunk != null) && (chunk.data != null)) {
            this.mobiles[0].updatePos(chunk.data.ball, pos - chunk.data.start_frame);
            for (i = _i = 0, _ref = this.team1.players.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
                if(i < 5){
					p = this.t1[chunk.data.team[0].player[i].id];
					p.update(chunk.data.team[0].player[i], pos - chunk.data.start_frame);
				}
            }
            for (i = _j = 0, _ref1 = this.team2.players.length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
                if(i < 5){
					p = this.t2[chunk.data.team[1].player[i].id];
					p.update(chunk.data.team[1].player[i], pos - chunk.data.start_frame);
				}
            }
            if (chunk.data.team[0].score !== this.scoretrackreader[0].data) {
                this.scoretrackreader[0] = new TrackReader(chunk.data.team[0].score, 0);
                this.scoretrackreader[1] = new TrackReader(chunk.data.team[1].score, 0);
                this.team1.info.audience = chunk.data.team[0].audience;
                this.team2.info.audience = chunk.data.team[1].audience;
                this.team1.info.bonus = chunk.data.team[0].bonus;
                this.team2.info.bonus = chunk.data.team[1].bonus;
                this.possessionreader[0] = new TrackReader(chunk.data.team[0].possession, 0);
                this.possessionreader[1] = new TrackReader(chunk.data.team[1].possession, 0);
                for (i = _k = 0, _ref2 = this.team1.players.length - 1; 0 <= _ref2 ? _k <= _ref2 : _k >= _ref2; i = 0 <= _ref2 ? ++_k : --_k) {
					if(i < 5){
						p = this.t1[chunk.data.team[0].player[i].id];
						if (chunk.data.team[0].player[i].size != null) {
							p.size = chunk.data.team[0].player[i].size / 200;
						}
					}
                }
                for (i = _l = 0, _ref3 = this.team2.players.length - 1; 0 <= _ref3 ? _l <= _ref3 : _l >= _ref3; i = 0 <= _ref3 ? ++_l : --_l) {
                    if(i < 5){
						p = this.t2[chunk.data.team[1].player[i].id];
						if (chunk.data.team[0].player[i].size != null) {
							p.size = chunk.data.team[1].player[i].size / 200;
						}
					}
                }
            }
            this.team1.info.score = this.scoretrackreader[0].read(pos - chunk.data.start_frame);
            this.team2.info.score = this.scoretrackreader[1].read(pos - chunk.data.start_frame);
            this.team1.info.possession = this.possessionreader[0].read(pos - chunk.data.start_frame);
            this.team2.info.possession = this.possessionreader[1].read(pos - chunk.data.start_frame);
            return true;
        } else {
            return false;
        }
    };
    PlayField.prototype.ghostOn = function(id) {
        var p;
        p = this.players_by_id[id];
        if (p != null) {
            return p.ghost_active = true;
        }
    };
    PlayField.prototype.ghostOff = function(id) {
        var p;
        p = this.players_by_id[id];
        if (p != null) {
            return p.ghost_active = false;
        }
    };
    PlayField.prototype.turboOn = function(id) {
        var p;
        p = this.players_by_id[id];
        if (p != null) {
            return p.turbo_active = true;
        }
    };
    PlayField.prototype.turboOff = function(id) {
        var p;
        p = this.players_by_id[id];
        if (p != null) {
            return p.turbo_active = false;
        }
    };
    PlayField.prototype.electricImpulse = function(i1, i2) {
        var p1, p2;
        p1 = this.players_by_id[i1];
        p2 = this.players_by_id[i2];
        if (p1 != null) {
            p2.electric_emission = 7;
        }
        if (p2 != null) {
            return p1.electrized = 7;
        }
    };
    PlayField.prototype.changeSize = function(id, size) {
        var p;
        p = this.players_by_id[id];
        if (p != null) {
            p.newsize = size;
        }
        if (p != null) {
            return p.resizing = 15;
        }
    };
    return PlayField;
})();

$(".player0-stats tbody").empty();
$(".player1-stats tbody").empty();
clearInterval(infos_update_intv);