Пример #1
0
 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;
 }
Пример #2
0
 public function moveTowards(SR_Player $player, SR_Player $target)
 {
     $move = $player->getMovePerSecond();
     $d1 = $player->getY();
     $d2 = $target->getY();
     $dt = $d1 - $d2;
     if ($dt < 0) {
         $dt = -$dt;
         if ($move > $dt) {
             $move = $dt;
         }
         $move = -$move;
     } else {
         if ($move > $dt) {
             $move = $dt;
         }
     }
     $pid = $player->getID();
     $move = -$move;
     $new_d = 0;
     $move = round($move, 1);
     $this->movePlayerB($pid, $move, $new_d);
     $new_d = round($new_d, 1);
     $busy = $player->busy(25);
     $name = $player->displayNameNB();
     $tn = $target->displayNameNB();
     $ep = $this->getEnemyParty();
     $args = array($name, abs($move), $tn, $new_d, $busy);
     $this->ntice('5097', $args);
     $ep->ntice('5097', $args);
     // 		$ep->ntice('5098', array($name, abs($move), $tn, $new_d));
     // 		$this->notice(sprintf('%s moves %.01f meters towards %s and is now on position %.01f meters. %ds busy.', $name, abs($move), $tn, $new_d, $busy));
     // 		$this->getEnemyParty()->notice(sprintf('%s moves %.01f meters towards %s and is now on position %.01f meters.', $name, abs($move), $tn, $new_d));
     return true;
 }