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


PHP Shadowfunc::getTarget方法代码示例

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


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

示例1: execute

 public static function execute(SR_Player $player, array $args)
 {
     $p = $player->getParty();
     if (false === ($location = $p->getLocationClass('outside'))) {
         return self::rply($player, '1031');
         // 			return $player->message('This command only works when you are outside a location.');
     }
     $bot = Shadowrap::instance($player);
     $loc = $location->getName();
     if (count($args) > 1) {
         return $bot->reply(Shadowhelp::getHelp($player, 'hijack'));
     }
     $victims = array();
     foreach (Shadowrun4::getParties() as $pa) {
         $pa instanceof SR_Party;
         if (false === ($city = $pa->getCityClass())) {
             continue;
             # not even city
         }
         # Hax!
         if ($city->isDungeon() && $city->getCityLocation() === $loc || $pa->getLocation('inside') === $loc) {
             foreach ($pa->getMembers() as $pl) {
                 $pl instanceof SR_Player;
                 if ($pl->hasEquipment('mount')) {
                     $victims[] = $pl;
                 }
             }
         }
     }
     if (count($victims) === 0) {
         self::rply($player, '5128');
         return false;
         // 			return $player->message('You see no mounts from other players to rob.');
     }
     $format = $player->lang('fmt_sumlist');
     if (count($args) === 0) {
         $out = '';
         foreach ($victims as $i => $victim) {
             $victim instanceof SR_Player;
             $mount = $victim->getMount();
             $out .= sprintf($format, $i + 1, $victim->getName(), $mount->getName());
             // 				$out .= sprintf(", \x02%s\x02-%s(%s)", ($i+1), $victim->getName(), $mount->getName());
         }
         return self::rply($player, '5130', array(ltrim($out, ',; ')));
         // 			return $bot->reply(substr($out, 2));
     }
     if (false === ($target = Shadowfunc::getTarget($victims, $args[0], true))) {
         self::rply($player, '5128');
         // 			$player->message('You see no mounts from other players to rob.');
         return false;
     }
     $mount = $target->getMount();
     if ($mount->getMountWeight() === 0) {
         self::rply($player, '1037');
         // 			$player->message('This mount cannot store anything.');
         return false;
     }
     return $mount->initHijackBy($player);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:59,代码来源:hijack.php

示例2: getMemberByName

 /**
  * @param string $name
  * @return SR_Player
  */
 public function getMemberByName($name)
 {
     return Shadowfunc::getTarget($this->getMembers(), $name, false);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:SR_Party.php


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