KPP2 Script

shows an alternate kpp excluding hold and counting 180 spins as 1 key

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         KPP2 Script
// @namespace    http://tampermonkey.net/
// @version      0.31
// @description  shows an alternate kpp excluding hold and counting 180 spins as 1 key
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

/**************************
      KPP2 Script      
**************************/

(function() {
    window.addEventListener('load', function(){


count_hold_as_keypress = true
STAT_POS = 990

var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}

Game["keypressesMinus"] = 0;

var rotFunc = Game['prototype']['rotateCurrentBlock'].toString()
var holdFunc = GameCore['prototype']['holdBlock'].toString()
var readyGoFunc = Game['prototype']["startReadyGo"].toString()
var kppFunc = GameCore['prototype']['getKPP'].toString()

var rotParams = getParams(rotFunc)

rotFunc = rotFunc.replace("2:","(Game['keypressesMinus']++,2):")
if(!count_hold_as_keypress){
holdFunc = holdFunc.replace("++","++;Game['keypressesMinus']++;")
}
readyGoFunc = "this['GameStats'].addStat(new StatLine('KPPT', 'KPP2', "+STAT_POS+"),true);Game['keypressesMinus']=0;" + trim(readyGoFunc)


function kppAdd() {
    var kpp2 = 0;
    if (this['placedBlocks']) {
        kpp2 = (this['totalKeyPresses'] - Game["keypressesMinus"] + this['placedBlocks']) / this['placedBlocks']

    };
    if(this['GameStats'].get('KPPT'))this['GameStats'].get('KPPT').set(kpp2.toFixed(2));
};


GameCore['prototype']['getKPP'] = new Function(trim(kppAdd.toString()) + trim(kppFunc))
GameCore['prototype']['holdBlock'] = new Function(trim(holdFunc));
Game['prototype']['rotateCurrentBlock'] = new Function(...rotParams, trim(rotFunc));
Game['prototype']["startReadyGo"] = new Function(readyGoFunc);


})})()