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)); } }
public function checkQuest(SR_NPC $npc, SR_Player $player) { if (!$this->isInQuest($player)) { return false; } if ($this->getAmount() >= $this->getNeededAmount()) { $npc->reply($this->lang('thanks')); // $npc->reply('Thank you very much!'); $player->message($this->lang('reward')); // $player->message(sprintf('The elve cheers and hands out a glowing dark bow.')); $bow = SR_Item::createByName('DarkBow'); $mod1 = SR_Rune::randModifier($player, 10); $mod2 = SR_Rune::randModifier($player, 10); $modifiers = SR_Rune::mergeModifiers($mod1, $mod2); $bow->addModifiers($modifiers); $player->giveItems(array($bow), $npc->getName()); $this->onSolve($player); return true; } else { $npc->reply($this->lang('more', array($this->getAmount(), $this->getNeededAmount()))); // $npc->reply(sprintf('I see you have punished %s of %s Angry Elves.', $this->getAmount(), $this->getNeededAmount())); return false; } }