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


PHP Shadowrun4::getParties方法代码示例

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


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

示例1: executeLook

 public static function executeLook(SR_Player $player, $command_mode = true)
 {
     $bot = Shadowrap::instance($player);
     $p = $player->getParty();
     $pid = $player->getPartyID();
     $format = $player->lang('fmt_list');
     $back = '';
     foreach (Shadowrun4::getParties() as $party) {
         $party instanceof SR_Party;
         if ($party->getID() === $pid) {
             continue;
         }
         if (!$party->sharesLocation($p)) {
             continue;
         }
         foreach ($party->getMembers() as $member) {
             $member instanceof SR_Player;
             $back .= sprintf($format, $member->getName());
         }
     }
     if ($back === '') {
         # You see no other players.
         return $command_mode ? self::rply($player, '5120') : true;
     }
     // 		$player->setOption(SR_Player::RESPONSE_PLAYERS);
     # You see these players: %s.
     if ($command_mode) {
         self::rply($player, '5121', array(ltrim($back, ',; ')));
     } else {
         $player->msg('5121', array(ltrim($back, ',; ')));
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:look.php

示例2: execute

 public static function execute(SR_Player $player, array $args)
 {
     $pp = Shadowrun4::getParties();
     foreach ($pp as $i => $p) {
         $p instanceof SR_Party;
         if (!$p->isHuman()) {
             unset($pp[$i]);
         }
     }
     $page = isset($args[0]) ? intval($args[0]) : 1;
     $nItems = count($pp);
     $nPages = GWF_PageMenu::getPagecount(self::PPP, $nItems);
     $page = Common::clamp($page, 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, self::PPP);
     $slice = array_slice($pp, $from, self::PPP);
     $out = '';
     $format = $player->lang('fmt_list');
     foreach ($slice as $p) {
         $p instanceof SR_Party;
         $leader = $p->getLeader()->displayName();
         $l = $p->getSum('level', true);
         $ll = $p->getSum('level', false);
         $mc = $p->getMemberCount();
         $item = sprintf('%s(L%s(%s))(M%s)', $leader, $l, $ll, $mc);
         $out .= sprintf($format, $item);
         // 			$out .= sprintf(', %s(L%s(%s))(M%s)', $leader, $l, $ll, $mc);
     }
     return self::rply($player, '5248', array($page, $nPages, ltrim($out, ',; ')));
     // 		$bot = Shadowrap::instance($player);
     // 		$bot->reply(sprintf('Parties page %s from %s: %s.', $page, $nPages, substr($out, 2)));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:parties.php

示例3: 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

示例4: onLocationGlobalMessage

 public static function onLocationGlobalMessage(SR_Player $player, $key, $args = NULL)
 {
     $server = Dog::getServer();
     $channel = Dog::getChannel();
     $sid = $server->getID();
     //		$cid = $channel->getID();
     $party = $player->getParty();
     //		$b = chr(2);
     //		$message = sprintf('%s in %s: "%s".', $player->getName(), $party->getLocation(), $message);
     // 		$sent = 0;
     foreach (Shadowrun4::getParties() as $pid => $p) {
         // 			echo "party $pid\n";
         if ($party->sharesLocation($p)) {
             // 				echo "partyy $pid\n";
             foreach ($p->getMembers() as $m) {
                 $m instanceof SR_Player;
                 if ($m->isCreated()) {
                     // 						if (false === ($u = $m->getUser()))
                     // 						{
                     // 							continue;
                     // 						}
                     // 						if (false === ($s = $u->getServer()))
                     // 						{
                     // 							continue;
                     // 						}
                     // 						$c = $s->getChannelByName('#shadowlamb');
                     // 						if ($sid === $s->getID())
                     // 						{
                     // 							if ( ($channel !== false) && ($channel->getUserByName($u->getName()) !== false) )
                     // 							{
                     // 								# TODO: fix this
                     // //								continue; # player already read it in irc.
                     // 							}
                     // 						}
                     # send to player.
                     echo "Sending to {$m->getName()}\n";
                     $m->msg($key, $args);
                     // 						$m->message($message);
                     // 						$sent++;
                 }
             }
         }
     }
     //		if ($sent > 0)
     //		{
     //			$player->message(sprintf('%s players on cross servers read your message inside the same location. Use #exit or privmsg/query/pm with the bot.'));
     //		}
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:48,代码来源:Shadowshout.php

示例5: execute

 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     $parties = $human = $npc = 0;
     foreach (Shadowrun4::getParties() as $party) {
         $parties++;
         foreach ($party->getMembers() as $member) {
             if ($member->isHuman()) {
                 $human++;
             } else {
                 $npc++;
             }
         }
     }
     return $bot->rply('5244', array($human, $npc, $parties));
     // 		$bot->reply(sprintf('Currently there are %s Human, %s NPC and %s parties in memory.', $human, $npc, $parties));
     // 		return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:stats.php

示例6: partyContact

 private function partyContact(SR_Party $p)
 {
     if (rand(0, 60) > 0) {
         return false;
         # fail
     }
     foreach (Shadowrun4::getParties() as $ep) {
         if ($ep->isMoving() && $p->getCity() === $ep->getCity() && $ep->getID() !== $p->getID()) {
             $p->talk($ep, true);
             return true;
         }
     }
     return false;
     //		$sqkm = $this->getSquareKM();
     //		$possible = array();
     //		$total = 0;
     //		$total_sqkm = $sqkm * 3; // total slots in city
     //
     //		foreach (Shadowrun4::getParties() as $ep)
     //		{
     //			if ( ($ep->isMoving()) && ($p->getCity() === $ep->getCity()) && ($ep->getID() !== $p->getID()) )
     //			{
     ////				$total += 50;
     ////				$possible[] = array($ep, 50);
     //				$possible[] = array($ep, 1);
     //			}
     //		}
     //
     ////		$chance_none = $sqkm * 30 - count($possible);
     ////		$chance_none = Common::clamp($chance_none, 50);
     //
     //		$chance_none = $total_sqkm - count($possible);
     //		$chance_none = Common::clamp($chance_none, round($sqkm*2.5)); // at least N empty slots
     //
     //		if (false === ($ep = Shadowfunc::randomData($possible, $total, $chance_none))) {
     //			return false;
     //		}
     //
     //		$p->talk($ep, true);
     //
     //		return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:42,代码来源:SR_City.php

示例7: getPlayersInLocation

 public static function getPlayersInLocation(SR_Player $player, $own_members = true)
 {
     $p = $player->getParty();
     $a = $p->getAction();
     $back = $own_members ? $p->getMembers() : array();
     switch ($a) {
         case SR_Party::ACTION_TALK:
         case SR_Party::ACTION_FIGHT:
             // we can see enemy party
             $back = array_merge($back, $p->getEnemyParty()->getMembers());
             break;
         case SR_Party::ACTION_INSIDE:
         case SR_Party::ACTION_OUTSIDE:
             // we can see other parties
             $pid = $p->getID();
             $loc = $p->getLocation($a);
             foreach (Shadowrun4::getParties() as $party) {
                 $party instanceof SR_Party;
                 if ($party->getID() !== $pid) {
                     if ($party->getLocation($a) === $loc) {
                         $back = array_merge($back, $party->getMembers());
                     }
                 }
             }
             break;
             // we see no other parties
         // we see no other parties
         case SR_Party::ACTION_DELETE:
         case SR_Party::ACTION_SLEEP:
         case SR_Party::ACTION_TRAVEL:
         case SR_Party::ACTION_EXPLORE:
         case SR_Party::ACTION_GOTO:
         case SR_Party::ACTION_HUNT:
         default:
             break;
     }
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:38,代码来源:Shadowfunc.php

示例8: onPartyArrivedLeftEvents

 private function onPartyArrivedLeftEvents(SR_Location $location, array $actions, $key)
 {
     $loc = $location->getName();
     $args = array('___LOCNAME', $this->displayMembers(false, true));
     foreach (Shadowrun4::getParties() as $p) {
         $p instanceof SR_Party;
         if ($p->getID() === $this->getID() || !in_array($p->getAction(), $actions, true) || $p->getLocation() !== $loc) {
             continue;
         }
         foreach ($p->getMembers() as $member) {
             $member instanceof SR_Player;
             if (!$member->isOptionEnabled(SR_Player::NO_AUTO_LOOK)) {
                 $args[0] = $location->displayName($member);
                 $member->msg($key, $args);
             }
         }
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:18,代码来源:SR_Party.php


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