Inheritance: extends GenericParticle
コード例 #1
0
 public function grantCoins($coins, $ignoreGrind = false, $effects = true)
 {
     if (!$ignoreGrind and $this->isGrinding()) {
         $coins *= Settings::getGrindFactor($this->getRank());
     }
     if ($effects) {
         $this->getPlayer()->getLevel()->addSound(new FizzSound($this->getPlayer()), [$this->getPlayer()]);
         $random = new Random(time() + $coins);
         $player = $this->getPlayer();
         $particle = new TerrainParticle($player, Block::get(Block::GOLD_BLOCK));
         $level = $player->getLevel();
         $recipients = [$player];
         for ($i = 0; $i < 50; $i++) {
             $x = $random->nextSignedFloat();
             $y = $random->nextSignedFloat() * $player->eyeHeight / 2;
             $z = $random->nextSignedFloat();
             $particle->setComponents($player->x + $x, $player->y + $player->eyeHeight / 2 + $y, $player->z + $z);
             $level->addParticle($particle, $recipients);
         }
     }
     $this->setCoins($out = $this->getCoins() + $coins);
     return [$coins, $out];
 }
コード例 #2
0
 public function grantCoins($coins, $ignoreGrind = false, $effects = true, $bonus = true)
 {
     if (!$ignoreGrind and $this->isGrinding()) {
         $coins *= Settings::getGrindFactor($this->getRank());
     }
     if ($effects) {
         $this->getPlayer()->getLevel()->addSound(new FizzSound($this->getPlayer()), [$this->getPlayer()]);
         $random = new Random(time() + $coins);
         $player = $this->getPlayer();
         $particle = new TerrainParticle($player, Block::get(Block::GOLD_BLOCK));
         $level = $player->getLevel();
         $recipients = [$player];
         for ($i = 0; $i < 500; $i++) {
             $x = $random->nextSignedFloat();
             $y = $random->nextSignedFloat();
             $z = $random->nextSignedFloat();
             $particle->setComponents($player->x + $x, $player->y + $y, $player->z + $z);
             $level->addParticle($particle, $recipients);
         }
     }
     $this->setCoins($out = $this->getCoins() + $coins);
     if ($bonus) {
         if (mt_rand(0, 99) === 0) {
             $add = mt_rand(25, 50);
         } elseif (mt_rand(0, 499) === 0) {
             $add = mt_rand(150, 300);
         } elseif (mt_rand(0, 749) === 0) {
             $add = mt_rand(300, 500);
         }
         if (isset($add)) {
             $this->grantCoins($add, false, true, false);
         }
     }
     return [$coins, $out];
 }