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


PHP Shadowfunc::getFriendlyTarget方法代码示例

本文整理汇总了PHP中Shadowfunc::getFriendlyTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowfunc::getFriendlyTarget方法的具体用法?PHP Shadowfunc::getFriendlyTarget怎么用?PHP Shadowfunc::getFriendlyTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shadowfunc的用法示例。


在下文中一共展示了Shadowfunc::getFriendlyTarget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     # One arg is like examine.
     if (count($args) === 1) {
         return Shadowcmd_examine::execute($player, $args);
     }
     # Other than 2 args is error => help.
     if (count($args) !== 2) {
         $bot->reply(Shadowhelp::getHelp($player, 'show'));
         return false;
     }
     # Try to get target.
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
         $player->msg('1028', array($args[0]));
         // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
         return false;
     }
     # Show to yourself is like examine.
     if ($target->getID() === $player->getID()) {
         return Shadowcmd_examine::execute($player, array($args[1]));
     }
     # Try to get item.
     if (false === ($item = $player->getItem($args[1]))) {
         $player->msg('1029');
         // 			$bot->reply('You don`t have that item.');
         return false;
     }
     return $target->msg('5062', array($player->displayName(), $item->getItemInfo($target)));
     // 		$msg = sprintf('%s shows you: %s', $player->displayName(), $item->getItemInfo($player));
     // 		return $target->message($msg);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:show.php

示例2: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekw'));
         return false;
     }
     if ($argc === 2) {
         if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
             $player->msg('1028', array($args[0]));
             #$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
             return false;
         }
         $word = $args[1];
         $targets = array($target);
     } else {
         $word = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === $player->hasKnowledge('words', $word)) {
         $player->msg('1023');
         # You don`t have this knowledge.
         return false;
     }
     return self::giveKnow($player, $targets, 'words', $args[1]);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:givekw.php

示例3: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     $argc = count($args);
     if ($argc < 1 || $argc > 2) {
         $player->message(Shadowhelp::getHelp($player, 'givekp'));
         return false;
     }
     if ($argc === 2) {
         if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
             $player->msg('1028', array($args[0]));
             // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
             return false;
         }
         $place = $args[1];
         $targets = array($target);
     } else {
         $place = $args[0];
         $targets = $player->getParty()->getMembers();
     }
     if (false === ($tlc = Shadowcmd_goto::getTLCByArgMulticity($player, $place))) {
         $player->msg('1023');
         return false;
     }
     return self::giveKnow($player, $targets, 'places', $tlc);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:30,代码来源:givekp.php

示例4: execute

 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply(Shadowhelp::getHelp($player, 'join'));
         return false;
     }
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0], false))) {
         self::rply($player, '1028', array($args[0]));
         // 			$bot->reply(sprintf('%s is not here or you are in his/her party already.', $args[0]));
         return false;
     }
     if ($target->getParty()->getLeader()->isNPC()) {
         self::rply($player, '1085');
         // 			$bot->reply('You cannot join NPC parties.');
         return false;
     }
     if ($target->getPartyID() === $player->getPartyID()) {
         self::rply($player, '1086');
         // 			$bot->reply('You cannot join your own party.');
         return false;
     }
     $p = $player->getParty();
     $ep = $target->getParty();
     if ($ep->hasBanned($player)) {
         self::rply($player, '1087');
         // 			$bot->reply(sprintf('The party does not want you to join.'));
         return false;
     }
     if ($ep->isFull()) {
         self::rply($player, '1088', array(SR_Party::MAX_MEMBERS));
         // 			$bot->reply('The party has reached the maximum membercount of '.SR_Party::MAX_MEMBERS.'.');
         return false;
     }
     $p->kickUser($player, true);
     $ep->addUser($player, true);
     $p->ntice('5135', array($player->getName()));
     $ep->ntice('5136', array($player->getName()));
     // 		$p->notice(sprintf('%s left the party.', $player->getName()));
     // 		$ep->notice(sprintf('%s joined the party.', $player->getName()));
     if ($p->isTalking() && $p->getMemberCount() === 0) {
         $p->popAction(true);
         $ep->popAction(true);
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:46,代码来源:join.php

示例5: execute

 public static function execute(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->msg('1036');
         // 			$player->message('This does not work in combat');
         return false;
     }
     if (count($args) !== 2) {
         $player->message(Shadowhelp::getHelp($player, 'giveny'));
         return false;
     }
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
         $player->msg('1028', array($args[0]));
         // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
         return false;
     }
     return self::giveNuyen($player, $target, 'nuyen', $args[1]);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:giveny.php

示例6: execute

 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) < 2 || count($args) > 3) {
         $player->message(Shadowhelp::getHelp($player, 'give'));
         return false;
     }
     if (false === ($target = Shadowfunc::getFriendlyTarget($player, $args[0]))) {
         $player->msg('1028', array($args[0]));
         // 			$player->message(sprintf('%s is not here or the name is ambigous.', $args[0]));
         return false;
     }
     if ($target->getID() === $player->getID()) {
         $player->msg('1061');
         // 			$player->message('Funny. You give something to yourself. Problem?');
         return false;
     }
     return self::giveItem($player, $target, $args[1], isset($args[2]) ? intval($args[2], 10) : 1);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:give.php

示例7: getFriendlyTarget

 /**
  * @param SR_Player $player
  * @param array $args
  * @return SR_Player
  */
 public function getFriendlyTarget(SR_Player $player, $arg)
 {
     return Shadowfunc::getFriendlyTarget($player, $arg);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:SR_Usable.php

示例8: getTarget

 /**
  * @param SR_Player $player
  * @param array $args
  * @return SR_Player
  */
 public function getTarget(SR_Player $player, array $args, $verbose = true)
 {
     if ($this->isOffensive()) {
         $target = Shadowfunc::getOffensiveTarget($player, $args[0]);
     } else {
         $target = Shadowfunc::getFriendlyTarget($player, $args[0]);
     }
     if ($target === false) {
         if (true === $verbose) {
             $player->msg('1012');
         }
         // 			$player->message('The target is unknown');
     }
     return $target;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:SR_Spell.php


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