当前位置: 首页>>代码示例>>PHP>>正文


PHP SR_Player::deleteFromInventory方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:Seattle_BD2.php

示例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;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:22,代码来源:Redmond_Johnson_3.php


注:本文中的SR_Player::deleteFromInventory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。