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 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
    }
  };
});