本文整理汇总了PHP中Shadowrun4类的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4类的具体用法?PHP Shadowrun4怎么用?PHP Shadowrun4使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shadowrun4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasToLeave
public function hasToLeave()
{
if (!$this->hasConst(self::HIRE_END)) {
return false;
}
return $this->getConst(self::HIRE_END) < Shadowrun4::getTime();
}
示例2: replyTable
/**
* Reply to the current origin and user, display as a table
* @todo Write a class that can display ascii art tables and stuff.
* @author digitalseraphim
* @since Shadowlamb 3.1
* @param array $table where each entry is 'row label' => array(values)
* @return true|false
*/
public function replyTable(array $table, $langkey = '5044')
{
$maxRowLabelWidth = 0;
$maxWidths = array(-1 => 0);
foreach ($table as $key => $value) {
$maxWidths[-1] = max($maxWidths[-1], strlen($key));
foreach ($value as $k => $v) {
$charcounts = count_chars($v, 0);
$vlen = strlen($v) - $charcounts[2];
if (!array_key_exists($k, $maxWidths)) {
$maxWidths[$k] = $vlen;
} else {
$maxWidths[$k] = max($maxWidths[$k], $vlen);
}
}
}
foreach ($table as $key => $value) {
$s = sprintf('%-' . ($maxWidths[-1] + 1) . 's', $key);
foreach ($value as $k => $v) {
$charcounts = count_chars($v, 0);
$s .= sprintf('| %-' . ($maxWidths[$k] + 1 + $charcounts[2]) . 's', $v);
}
$this->reply(Shadowrun4::lang($langkey, array($s)));
// $this->reply($s);
}
}
示例3: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (count($args) !== 2) {
$bot->reply(Shadowhelp::getHelp($player, 'gmloot'));
return false;
}
$target = Shadowrun4::getPlayerByShortName($args[0]);
if ($target === -1) {
$player->message('The username is ambigious.');
return false;
}
if ($target === false) {
$player->message('The player is not in memory or unknown.');
return false;
}
if (false === $target->isCreated()) {
$bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
return false;
}
if (Common::isNumeric($args[1])) {
$target->giveItems(Shadowfunc::randLoot($target, $args[1]), 'gmloot');
} else {
}
return true;
}
示例4: getSlogan
public function getSlogan()
{
if ('' === ($slogan = $this->getVar('sr4bs_message'))) {
return Shadowrun4::lang('stub_shop_slogan', array($this->getVar('sr4bs_pname')));
}
return $slogan;
}
示例5: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (count($args) < 2 || count($args) > 3) {
$bot->reply(Shadowhelp::getHelp($player, 'gmi'));
return false;
}
$target = Shadowrun4::getPlayerByShortName($args[0]);
if ($target === -1) {
$player->message('The username is ambigious.');
return false;
}
if ($target === false) {
$player->message('The player is not in memory or unknown.');
return false;
}
if (false === $target->isCreated()) {
$bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
return false;
}
if (false === ($item = SR_Item::createByName($args[1]))) {
$bot->reply(sprintf('The item %s could not be created.', $args[1]));
return false;
}
if (isset($args[2])) {
if (!$item->isItemStackable()) {
$bot->reply('No amount for equipment!');
return false;
}
$item->saveVar('sr4it_amount', intval($args[2]));
}
$b = chr(2);
$target->giveItems(array($item), sprintf("{$b}[GM]_%s{$b}", $player->getName()));
return true;
}
示例6: 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)));
}
示例7: getRespawnLocation
public function getRespawnLocation(SR_Player $player)
{
if ($player->getNuyen() > 200 && $player->hasKnowledge('places', 'Vegas_Hotel')) {
return 'Vegas_Hotel';
}
return Shadowrun4::getCity('Chicago')->getRespawnLocation($player);
}
示例8: beam
/**
* Beam a party to a target location.
* @param SR_Player $player
* @param string $target
* @param string $action
*/
public function beam(SR_Player $player, $target = 'Redmond_Hotel', $action = 'inside')
{
if (false === ($location = Shadowrun4::getLocationByTarget($target))) {
$player->message('Unknown location to beam to, report to gizmore!');
Dog_Log::error('Unknown $target "' . $target . '" for ' . __METHOD__ . ' in ' . __FILE__ . ' line ' . __LINE__ . '.');
return false;
}
$party = $player->getParty();
# City changed?
$oldcity = $party->getCity();
$party->pushAction($action, $target);
$newcity = $party->getCity();
if ($oldcity !== $newcity) {
$city = $party->getCityClass();
$city->onCityEnter($party);
}
// if ($action === 'inside')
// {
// foreach ($party->getMembers() as $member)
// {
// $member->message($location->getEnterText($member));
// }
// }
$party->giveKnowledge('places', $target);
return true;
}
示例9: 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;
}
示例10: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (count($args) !== 1) {
$bot->reply(Shadowhelp::getHelp($player, 'gmp'));
return false;
}
if (false === ($target = Shadowrun4::getPlayerByShortName($args[0]))) {
$bot->reply(sprintf('The user %s is unknown.', $args[0]));
return false;
} elseif ($target === -1) {
$bot->reply('The player name is ambigious.');
return false;
}
if (false === $target->isCreated()) {
$bot->reply(sprintf('The player %s has not started a game yet.', $args[0]));
return false;
}
$p = $target->getParty();
$a = $p->getAction();
if ($a !== SR_Party::ACTION_INSIDE && $a !== SR_Party::ACTION_OUTSIDE) {
$bot->reply('The party with ' . $args[0] . ' is moving.');
return false;
}
$p->pushAction(SR_Party::ACTION_INSIDE, 'Prison_Block1');
}
示例11: execute
public static function execute(SR_Player $player, array $args)
{
return self::rply($player, '5241', array(SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount(), Shadowcmd::translate('stats')));
// $bot = Shadowrap::instance($player);
// $message = sprintf('In Shadowlamb v3 there are: %s different NPC in %s Areas with %s Locations. %s Items, %s Spells and %s Quests. Try #stats to show how many are playing.', SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount());
// return $bot->reply($message);
}
示例12: 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);
}
示例13: getCity
public function getCity()
{
$arg = $this->getArg(0, 'Redmond');
if (false === ($city = Shadowrun4::getCity($arg))) {
return Shadowrun4::getCity('Redmond');
}
return $city;
}
示例14: setAlert
public function setAlert(SR_Party $party, $duration = 600, $announce = true)
{
$party->setTemp($this->getAlertKey($party), Shadowrun4::getTime() + $duration);
if ($announce) {
$party->ntice('5021');
// $party->notice(sprintf('You hear the alarm sound!'));
}
}
示例15: getRespawnLocation
public function getRespawnLocation(SR_Player $player)
{
if ($player->getNuyen() > 300 && $player->hasKnowledge('places', 'Chicago_Hotel')) {
return 'Chicago_Hotel';
} else {
return Shadowrun4::getCity('Delaware')->getRespawnLocation($player);
}
}