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)); } }
private static function hasItem(SR_Player $player, $itemID) { $items = array_merge($player->getAllEquipment(false), $player->getInventory(), $player->getBankItems(), $player->getMountInvItems(), $player->getCyberware()); foreach ($items as $item) { $item instanceof SR_Item; if ($item->getID() == $itemID) { // printf("Found item :)\n"); return true; } } return false; }
public static function execute(SR_Player $player, array $args) { $items = $player->getInventory(); $text = array('usage' => Shadowhelp::getHelp($player, 'i'), 'prefix' => $player->lang('inventory'), 'code' => '5005'); Shadowfunc::genericViewI($player, $items, $args, $text, false); }