Exemple #1
0
 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     $have = $this->getAmount();
     $need = $this->getNeededAmount();
     $give = 0;
     foreach ($player->getInventory() as $item) {
         if ($item instanceof SR_Rune) {
             $player->deleteFromInventory($item);
             $have++;
             $give++;
             if ($have >= $need) {
                 break;
             }
         }
     }
     if ($give > 0) {
         $this->increase('sr4qu_amount', $give);
         $player->message($this->lang('gave', array($give, $npc->getName())));
         // 			$player->message(sprintf('You gave %s %s to %s.', $give, 'Runes', $npc->getName()));
     }
     if ($have >= $need) {
         $npc->reply($this->lang('thanks1'));
         // 			$npc->reply('Thank you very much my friend. Now I can also craft some equipment again.');
         $this->onSolve($player);
         $npc->reply($this->lang('thanks2', array(self::REWARD_RUNES)));
         // 			$npc->reply('As a reward I let you create '.self::REWARD_RUNES.' new runes via #reward.');
         $player->increaseConst(Seattle_Blacksmith::REWARD_RUNES, self::REWARD_RUNES);
     } else {
         $npc->reply($this->lang('more', array($have, $need)));
         // 			$npc->reply(sprintf('You gave me %s of %s Runes... Give me a few more and I will reward you greatly :)', $have, $need));
     }
 }
Exemple #2
0
 private function checkQuestHotelier(SR_NPC $npc, SR_Player $player)
 {
     $data = $this->getQuestData();
     if (isset($data['gave'])) {
         return false;
     }
     if (false === ($item = $player->getInvItemByName('Package'))) {
         return false;
     }
     if (false === $player->deleteFromInventory($item)) {
         return false;
     }
     $data['gave'] = 1;
     $this->saveQuestData($data);
     $player->message($this->lang('give1'));
     $npc->reply($this->lang('give2'));
     $player->message($this->lang('give3'));
     // 		$player->message('You give the package to the hotelier: "Here is a package for you from Mr.Johnson!"');
     // 		$npc->reply('Oh, Thank you. I am sure Mr.Johnson will reward you well.');
     // 		$player->message('The hotelier takes the package');
     return true;
 }