本文整理汇总了PHP中SR_Player::deleteFromInventory方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::deleteFromInventory方法的具体用法?PHP SR_Player::deleteFromInventory怎么用?PHP SR_Player::deleteFromInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::deleteFromInventory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkQuest
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));
}
}
示例2: checkQuestHotelier
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;
}