TagPro Flair Trails and Spinner

Have sick trails for all your flairs just like the arc reactor. (Without having to level up) But wait there's more. You can also have your flairs spin like the level 4 donor flair absolutely free.

目前為 2022-05-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            TagPro Flair Trails and Spinner
// @version         0.1
// @description     Have sick trails for all your flairs just like the arc reactor. (Without having to level up) But wait there's more. You can also have your flairs spin like the level 4 donor flair absolutely free.
// @include         https://tagpro.koalabeast.com/game
// @include         https://tagpro.koalabeast.com/game?*
// @author          Pindelta
// @supportURL      https://www.reddit.com/message/compose/?to=Pindelta
// @namespace       https://github.com/Pindelta/TagPro-Flair-Trails-and-Spinner

// ==/UserScript==

// ========= SETTINGS =========
// Set either of these to true to enable the respective effect.
// It looks wonky with both on, so set one to true and the other to false.
// Feel free to do turn em both on tho, it won't break anything
const spinFlair = false;
const useTrail = true;

// Enter your Display Name here. This is to make sure only your ball gets these effects applied to it
const displayName = "";

// ========= END OF SETTINGS =========

const trail = {
  acceleration: { x: 0, y: 0 },
  addAtBack: false,
  alpha: { start: 1, end: 0 },
  blendMode: "normal",
  color: { start: "#ffffff", end: "#ffffff" },
  emitterLifetime: -1,
  frequency: 0.001,
  lifetime: { min: 0.25, max: 0.25 },
  maxParticles: 500,
  maxSpeed: 0,
  noRotation: true,
  pos: { x: 0, y: 0 },
  rotationSpeed: { min: 0, max: 0 },
  scale: { start: 1, end: 0.25, minimumScaleMultiplier: 1 },
  spawnType: "point",
  speed: { start: 0, end: 0, minimumSpeedMultiplier: 1 },
  startRotation: { min: 0, max: 0 },
};

tagpro.ready(function () {
  // Override the drawFlair function
  tagpro.renderer.drawFlair = function (player) {
    const isYourBall = player.name === displayName; // check if this is your ball

    player.sprites.flair &&
      player.sprites.flair.flairName !== player.flair &&
      (player.sprites.info.removeChild(player.sprites.flair),
      (player.sprites.flair = null));

    if (player.flair && !player.sprites.flair) {
      var n = "flair-" + player.flair.x + "," + player.flair.y,
        r = tagpro.renderer.getFlairTexture(n, player.flair);
      (player.sprites.flair = new PIXI.Sprite(r)),
        (player.sprites.flair.pivot.x = 8),
        (player.sprites.flair.pivot.y = 8),
        (player.sprites.flair.x = 20),
        (player.sprites.flair.y = -9),
        player.sprites.info.addChild(player.sprites.flair),
        (player.sprites.flair.flairName = player.flair),
        (player.sprites.rotation = 0),
        (player.rotateFlairSpeed = 0);

      const shouldActivateTrail = useTrail && isYourBall; // we should activate the trail if the setting is set to true and this is your ball
      if (
        (player.flair.description === "Arc Reactor" || shouldActivateTrail) &&
        !tagpro.renderer.options.disableParticles
      ) {
        var i = new PIXI.particles.Emitter(
          tagpro.renderer.layers.midground,
          [useTrail ? r : tagpro.renderer.particleTexture],
          trail
        );
        tagpro.renderer.emitters.push(i),
          (player.flairEmitter = i),
          (player.flairEmitter.keep = !0);
      }
    }

    const shouldActivateSpin = spinFlair && isYourBall;
    if (
      player.sprites.flair &&
      (player.flair.description === "Level 4 Donor" || shouldActivateSpin)
    ) {
      player.lastFrame || (player.lastFrame = { "s-captures": 0, "s-tags": 0 });
      if (
        player.lastFrame["s-captures"] !== player["s-captures"] ||
        player.lastFrame["s-tags"] !== player["s-tags"]
      )
        (player.tween = new Tween(0.4, -0.38, 4e3, "quadOut")),
          (player.rotateFlairSpeed = player.tween.getValue());
      player.rotateFlairSpeed > 0.02 &&
        (player.rotateFlairSpeed = player.tween.getValue()),
        (player.rotateFlairSpeed = Math.max(0.02, player.rotateFlairSpeed)),
        (player.sprites.flair.rotation += player.rotateFlairSpeed),
        (player.lastFrame["s-captures"] = player["s-captures"]),
        (player.lastFrame["s-tags"] = player["s-tags"]);
    }

    !player.flair &&
      player.sprites.flair &&
      player.sprites.info.removeChild(player.sprites.flair);

    if (player.flairEmitter) {
      var s = true && !player.dead,
        o = s;

      (player.flairEmitter.emit = s),
        player.flairEmitter.updateOwnerPos(player.x + 20, player.y - 9),
        o && player.flairEmitter.resetPositionTracking();
    }
  };
});