TagPro Name Changer

By default, it displays VapingDragon's name as VapingPig

Instalirajte ovu skriptu?
Autorov prijedlog skripta

Možda ti se također svidi TagPro RL Chat.

Instalirajte ovu skriptu

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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
});