Advertisement
Guest User

TagPro - Use Any Name

a guest
Jan 30th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name          Use Any Name
  3. // @description   It can be any length & can include Unicode. BUT ONLY YOU CAN SEE IT. Everyone else will see your normal name.
  4. // @include       http://tagpro-*.koalabeast.com:*
  5. // @include       http://tangent.jukejuice.com:*
  6. // @include       http://*.newcompte.fr:*
  7. // @author        You!
  8. // @version       0.1.0
  9. // @grant         none
  10. // ==/UserScript==
  11.  
  12. tagpro.ready(function() {
  13.     var name = '🎅ABCD-1234567890-DCBA🎅';
  14.  
  15.     var tr = tagpro.renderer;
  16.    
  17.     tr.veryPrettyText = function (text, color) {
  18.         /* Returns a tagpro style sprite PIXI object rendered from canvas. It's very cute. Like baby sloth cute.
  19.          * @param text {string} The text to initially set it to.
  20.          * @param color {string} The color to render the text.
  21.          * */
  22.         var canvas = document.createElement("canvas");
  23.  
  24.         canvas.width = 256;
  25.         canvas.height = 32;
  26.  
  27.         var context = canvas.getContext("2d");
  28.  
  29.         context.clearRect(0, 0, canvas.width, canvas.height);
  30.         context.font = "bold 11px arial";
  31.         context.fillStyle = color || "#ffffff";
  32.         context.strokeStyle = "#000000";
  33.         context.shadowColor = "#000000";
  34.         context.shadowOffsetX = 0;
  35.         context.shadowOffsetY = 0;
  36.         context.lineWidth = 2;
  37.         context.shadowBlur = 10;
  38.         context.strokeText(text, 16, 16);
  39.         context.shadowBlur = 0;
  40.         context.fillText(text, 16, 16);
  41.  
  42.         var texture = PIXI.Texture.fromCanvas(canvas);
  43.  
  44.         return new PIXI.Sprite(texture);
  45.     };
  46.  
  47.     var dN = tr.drawName;
  48.     tr.drawName = function (player, forceRedraw) {
  49.         if (player.id === tagpro.playerId) player.name = name;
  50.  
  51.         return dN.apply(this, arguments);
  52.     };
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement