本文整理汇总了PHP中Shadowrun4类的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4类的具体用法?PHP Shadowrun4怎么用?PHP Shadowrun4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shadowrun4类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: hasToLeave
public function hasToLeave()
{
if (!$this->hasConst(self::HIRE_END)) {
return false;
}
return $this->getConst(self::HIRE_END) < Shadowrun4::getTime();
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SR_HireNPC.php
示例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);
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:34,代码来源:Shadowrap.php
示例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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:gmloot.php
示例4: getSlogan
public function getSlogan()
{
if ('' === ($slogan = $this->getVar('sr4bs_message'))) {
return Shadowrun4::lang('stub_shop_slogan', array($this->getVar('sr4bs_pname')));
}
return $slogan;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SR_BazarShop.php
示例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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:35,代码来源:gmi.php
示例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)));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:parties.php
示例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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Vegas.php
示例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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:SR_Tower.php
示例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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:look.php
示例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');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:gmprison.php
示例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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:world.php
示例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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:59,代码来源:hijack.php
示例13: getCity
public function getCity()
{
$arg = $this->getArg(0, 'Redmond');
if (false === ($city = Shadowrun4::getCity($arg))) {
return Shadowrun4::getCity('Redmond');
}
return $city;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:traveller.php
示例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!'));
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:SR_Dungeon.php
示例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);
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:Chicago.php
示例16: resetTimer
public function resetTimer(SR_Player $player)
{
$time = Seattle::TIME_TO_DELAWARE + 60;
$player->setConst('__AURIS_TIMEOUT', Shadowrun4::getTime() + $time);
$player->message($this->lang('fluid', array(GWF_Time::humanDuration($time))));
// $player->message(sprintf("Your pot of Auris is fluid for %s.", GWF_Time::humanDuration($time)));
return true;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:Delaware_Exams5.php
示例17: ai_tick
public function ai_tick($function, $args = null)
{
if (0 < ($interval = $this->getInterval())) {
if (Shadowrun4::getTime() % $interval === 0) {
call_user_func_array($this->getArg(1), $this->getArg(2, array()));
}
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:interval.php
示例18: checkLocation
public function checkLocation()
{
parent::checkLocation();
if (false !== ($exit_location = $this->getExitLocation())) {
if (false === Shadowrun4::getLocationByTarget($exit_location)) {
die(sprintf("%s has an invalid Exit location!\n", $this->getName()));
}
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:SR_Exit.php
示例19: onHacked
public function onHacked(SR_Player $player, $hits)
{
$party = $player->getParty();
$player->message(sprintf('This computer is able to activate the elevator to floor 2 and 3.'));
$elevator = Shadowrun4::getLocationByTarget('Renraku_Elevator');
$elevator instanceof Renraku_Elevator;
$elevator->setElevatorFlagsParty($party, 6, true);
$party->notice(sprintf('%s managed to unlock the elevator to floor 2 and 3.', $player->getName()));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:Room4.php
示例20: isNoShout
public static function isNoShout($pid)
{
$pid = (int) $pid;
if (false === ($ends = self::table(__CLASS__)->selectVar('sr4ns_ends', "sr4ns_pid={$pid}"))) {
return -1;
}
if ($ends == 0) {
return GWF_Time::ONE_DAY;
}
return $ends - Shadowrun4::getTime();
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:SR_NoShout.php
注:本文中的Shadowrun4类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论