TagPro Name Changer

By default, it displays VapingDragon's name as VapingPig

目前为 2018-04-05 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name TagPro Name Changer
  3. // @description By default, it displays VapingDragon's name as VapingPig
  4. // @author Ko
  5. // @version 1.0
  6. // @include *.koalabeast.com:*
  7. // @include *.jukejuice.com:*
  8. // @include *.newcompte.fr:*
  9. // @supportURL https://www.reddit.com/message/compose/?to=Wilcooo
  10. // @website https://redd.it/no-post-yet
  11. // @license MIT
  12. // @namespace https://greasyfork.org/users/152992
  13. // ==/UserScript==
  14.  
  15.  
  16. // This option makes sure that only green names are changed
  17. // (change to false to disable)
  18. const onlyAuth = true;
  19.  
  20. // All names that should be changed, and their replacements:
  21. const replacements = {
  22. 'VapingDragon' : 'VapingPig' ,
  23. 'YouCanAddYourOwn' : 'LikeThis' ,
  24. 'AddAsMuchAsYou' : 'like!' ,
  25. 'Ko' : 'Ko the Great',
  26. };
  27.  
  28. tagpro.ready(function() {
  29.  
  30. // We *could* just change the name directly in the player object,
  31. // but that may cause problems if other scripts use that name (like TagPro Analytics)
  32. // Instead I alter the various functions that draw the name on the screen.
  33.  
  34. // There's this function: tagpro.renderer.drawName
  35. // that draws the name next to a ball
  36. // I copied it from the TP source code, and altered it a bit
  37.  
  38. tagpro.renderer.drawName = function( player, forceRedraw=false ) {
  39. if (!player.sprites.name || forceRedraw) {
  40.  
  41. if (player.sprites.name) player.sprites.info.removeChild(player.sprites.name);
  42.  
  43. if (!tagpro.settings.ui.names) return;
  44.  
  45. var color = "#ffffff";
  46. if (player.auth) color = "#BFFF00";
  47.  
  48. var name = player.name;
  49. if (name in replacements) name = replacements[name]; // This is the line I wrote myself
  50.  
  51. player.sprites.name = tagpro.renderer.veryPrettyText(name, color);
  52. player.sprites.info.addChild(player.sprites.name);
  53. }
  54. player.sprites.name.x = 20;
  55. player.sprites.name.y = -21;
  56. player.sprites.name.visible = tagpro.settings.ui.names;
  57. };
  58.  
  59. // This next function draws the name in chat messages:
  60. // nvm that's to much programmatical trouble for this stupid script
  61. // Same for the scoreboard
  62. });