TagPro Name Changer

By default, it displays VapingDragon's name as VapingPig

Installa questo script?
Script suggerito dall'autore

Potresti essere interessato/a anche a TagPro RL Chat

Installa questo script

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         TagPro Name Changer
// @description  By default, it displays VapingDragon's name as VapingPig
// @author       Ko
// @version      1.2
// @include      *.koalabeast.com:*
// @include      *.jukejuice.com:*
// @include      *.newcompte.fr:*
// @include      *.koalabeast.com/game
// @include      *.jukejuice.com/game
// @include      *.newcompte.fr/game
// @supportURL   https://www.reddit.com/message/compose/?to=Wilcooo
// @license      MIT
// @namespace https://greasyfork.org/users/152992
// ==/UserScript==


// This option makes sure that only green names are changed
// (change to false to disable)
const onlyAuth = true;

// All names that should be changed, and their replacements:
const replacements = {
    'VapingDragon'     : 'VapingPig'   ,
    'YouCanAddYourOwn' : 'LikeThis'    ,
    'AddAsMuchAsYou'   : 'like!'       ,
    'Ko'               : 'Ko the Great',
};

tagpro.ready(function() {

    // We *could* just change the name directly in the player object,
    // but that may cause problems if other scripts use that name (like TagPro Analytics)
    // Instead I alter the various functions that draw the name on the screen.

    // There's this function: tagpro.renderer.drawName
    // that draws the name next to a ball
    // I copied it from the TP source code, and altered it a bit

    tagpro.renderer.drawName = function( player, forceRedraw=false ) {
        if (!player.sprites.name || forceRedraw) {

            if (player.sprites.name) player.sprites.info.removeChild(player.sprites.name);

            if (!tagpro.settings.ui.names) return;

            var color = "#ffffff";
            if (player.auth) color = "#BFFF00";

            var name = player.name;
            if (name in replacements) name = replacements[name]; // This is the line I wrote myself

            player.sprites.name = tagpro.renderer.veryPrettyText(name, color);
            player.sprites.info.addChild(player.sprites.name);
        }
        player.sprites.name.x = 20;
        player.sprites.name.y = -21;
        player.sprites.name.visible = tagpro.settings.ui.names;
    };

    // This next function draws the name in chat messages:
    // nvm that's to much programmatical trouble for this stupid script
    // Same for the scoreboard
});