public function onConsume(SR_Player $player) { $p = $player->getParty(); $oldhp = $player->getHP(); $maxhp = $player->getMaxHP(); $gain = $player->healHP(0.1); $newhp = $player->getHP(); $gainmsg = Shadowfunc::displayHPGain($oldhp, $gain, $maxhp); $last = $this->getAmount() === 0 ? 'the last' : 'a'; if ($p->isFighting()) { $busy = $this->getItemUsetime(); $player->busy($busy); $busytext = sprintf(' %s busy.', GWF_Time::humanDuration($busy)); $p->message($player, sprintf(' eats %s potatoe chip from his roll of Pringles: %s.%s', $last, $gainmsg, $busytext)); $p->getEnemyParty()->message($player, sprintf(' eats %s chip from his roll of Pringles.', $last)); } else { $player->message(sprintf('You eat %s chip from your Pringles: %s', $last, $gainmsg)); } }
public function announceUsage(SR_Player $player, SR_Player $target, $message = '', $message2 = '', $useamt = 1) { if ($player->isFighting()) { $busy = $player->busy($this->getItemUsetime()); $busymsg = $player->lang('busy', array($busy)); #sprintf(' %ds busy.', $busy); } else { $busymsg = ''; } $player->getParty()->ntice('5228', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message)); // $player->getParty()->notice(sprintf('%s used %s on %s.%s%s', $player->getName(), $this->getName(), $target->getName(), $busymsg, $message)); if ($player->isFighting()) { $player->getEnemyParty()->ntice('5229', array($player->displayNameNB(), $this->getName(), $target->displayNameNB(), $busymsg, $message2)); // $player->getEnemyParty()->notice(sprintf('%s used %s on %s.%s', $player->getName(), $this->getName(), $target->getName(), $message2)); } if ($useamt > 0) { return $this->useAmount($player, $useamt); } return true; }
private function forwardB(SR_Player $player, $dir, $fwbw, $busy = -1) { $by = $dir * $player->getMovePerSecond(); $pid = $player->getID(); $new_d = 0; $this->movePlayerB($pid, $by, $new_d); $busy = $busy > 0 ? ', ' . Shadowfunc::displayBusy($player->busy($busy)) : '.'; $by = round($by, 1); $new_d = round($new_d, 1); $ep = $this->getEnemyParty(); $pname = $player->getName(); $this->ntice('5090', array($pname, abs($by), $fwbw, $new_d, $busy)); $ep->ntice('5091', array($pname, abs($by), $fwbw, $new_d, $busy)); // $message = sprintf(' moves %.01f meters %s and is now on position %.01f meters%s', abs($by), $fwbw, $new_d, $busy); // $this->message($player, $message); // $this->getEnemyParty()->message($player, $message); return true; }