本文整理汇总了PHP中Shadowrun4::getHumanPlayers方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4::getHumanPlayers方法的具体用法?PHP Shadowrun4::getHumanPlayers怎么用?PHP Shadowrun4::getHumanPlayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowrun4
的用法示例。
在下文中一共展示了Shadowrun4::getHumanPlayers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute(SR_Player $player, array $args)
{
if (count($args) === 0) {
$args[] = '1';
}
if (count($args) !== 1) {
$player->message(Shadowhelp::getHelp($player, 'players'));
return false;
}
$ppp = self::PPP;
$page = (int) $args[0];
$players = Shadowrun4::getHumanPlayers();
$nPlayers = count($players);
$nPages = GWF_PageMenu::getPagecount($ppp, $nPlayers);
$from = GWF_PageMenu::getFrom($page, $ppp);
if ($page < 1 || $page > $nPages) {
$player->msg('1009');
// $player->message(sprintf('Page %d of %d is empty.', $page, $nPages));
return false;
}
$out = '';
$format = $player->lang('fmt_sumlist');
foreach (array_slice($players, $from, $ppp, false) as $p) {
$p instanceof SR_Player;
$summand = sprintf('L%s(%s)', $p->getBase('level'), $p->get('level'));
$out .= sprintf($format, $p->getEnum(), $p->getName(), $summand);
// $out .= sprintf(', %s(L%s(%s))', $p->displayName(), $p->getBase('level'), $p->get('level'));
}
if ($out === '') {
$player->msg('1009');
return false;
}
return self::rply($player, '5247', array($page, $nPages, ltrim($out, ',; ')));
// $out = $out === '' ? 'This page is empty.' : sprintf('Active players (page %d of %d): %s.', $page, $nPages, substr($out, 2));
// self::reply($player, $out);
// return true;
}