本文整理汇总了PHP中Shadowrun4::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4::lang方法的具体用法?PHP Shadowrun4::lang怎么用?PHP Shadowrun4::lang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowrun4
的用法示例。
在下文中一共展示了Shadowrun4::lang方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSlogan
public function getSlogan()
{
if ('' === ($slogan = $this->getVar('sr4bs_message'))) {
return Shadowrun4::lang('stub_shop_slogan', array($this->getVar('sr4bs_pname')));
}
return $slogan;
}
示例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: displayBadKarmaParty
public static function displayBadKarmaParty(SR_Party $party)
{
$back = '';
foreach ($party->getMembers() as $member) {
$member instanceof SR_Player;
$bk = $member->getBase('bad_karma');
if ($bk > 0) {
$back .= Shadowrun4::lang('info_bk', array($member->getName(), $bk));
// $back .= sprintf(', %s has %d bad_karma', $member->getName(), $bk);
}
}
return $back === '' ? '' : sprintf(' %s.', substr($back, 2));
}
示例4: displayBountyParty
public static function displayBountyParty(SR_Party $party)
{
$back = '';
$format = Shadowrun4::lang('fmt_sumlist');
foreach ($party->getMembers() as $member) {
$member instanceof SR_Player;
$bounty = $member->getBase('bounty');
if ($bounty > 0) {
$back .= sprintf($format, $member->getEnum(), $member->getName(), Shadowfunc::displayNuyen($bounty));
// $back .= sprintf(", {$b}%s{$b}-%s(%s)", $i++, $member->getName(), Shadowfunc::displayNuyen($bounty));
}
}
return $back === '' ? '' : Shadowrun4::lang('meet_bounty', array(ltrim($back, ',; ')));
// return $back === '' ? '' : sprintf(" There is a {$b}bounty{$b} on %s.", substr($back, 2));
}
示例5: display
public function display()
{
$eta = $this->getETA();
$e = $eta > 0 ? GWF_Time::humanDuration($eta) : Shadowrun4::lang('over');
$e = "({$e})";
switch ($this->mode) {
case self::MODE_REPEAT:
return Shadowrun4::lang('unknown');
case self::MODE_ONCE:
case self::MODE_ONCE_EXTEND:
return Shadowfunc::getModifiers($this->modifiers) . $e;
case self::MODE_TRIGGER:
return Shadowrun4::lang('unknown');
}
}
示例6: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
$party = $player->getParty();
$members = $party->getMembers();
$format = Shadowrun4::lang('fmt_sumlist');
$total = 0;
$back = '';
foreach ($members as $member) {
$member instanceof SR_Player;
$ny = $member->getBase('nuyen');
$total += $ny;
$back .= sprintf($format, $member->getEnum(), $member->getName(), Shadowfunc::displayNuyen($ny));
}
$bot->reply(Shadowrun4::lang('5008', array(Shadowfunc::displayNuyen($total), ltrim($back, ',; '))));
// $bot->reply(sprintf('Your party has %s: %s.', Shadowfunc::displayNuyen($total), substr($back, 2)));
return true;
}
示例7: displaySets
private static function displaySets(SR_Player $player, $page)
{
$ipp = 10;
$sets = SR_SetItems::getSetNames();
$nItems = count($sets);
$from = GWF_PageMenu::getFrom($page, $ipp);
$nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
if ($page < 1 || $page > $nPages) {
return self::rply($player, '1009');
}
$sets = array_slice($sets, $from, $ipp);
$n = GWF_PageMenu::getFrom($page, $ipp);
$out = '';
$format = Shadowrun4::lang('fmt_list');
foreach ($sets as $set) {
$out .= sprintf($format, $set);
$n++;
}
$out = trim($out, ',; ');
return self::rply($player, '5295', array($page, $nPages, $out));
}
示例8: onDisplayQuest
private static function onDisplayQuest(SR_Player $player, SR_Quest $quest, $id)
{
if ($quest->isUnknown($player)) {
return $player->msg('1010');
// return self::reply($player, 'This quest is unknown to you.');
}
// questid, city, status, questname, description,
$message = Shadowrun4::lang('5011', array($id, $quest->getCityName(), $quest->getStatusString($player), $quest->getQuestName(), $quest->getQuestDescription()));
// $message = sprintf('%d: %s - %s (%s)', $id, $quest->getQuestName(), $quest->getQuestDescription(), $quest->getStatusString($player));
return self::reply($player, $message);
}
示例9: getGenericView
private static function getGenericView(SR_Player $player, array $items, array $args, $is_store, $text, $raw = true)
{
$bot = Shadowrap::instance($player);
if (count($args) > 2) {
return self::arrayGet($text, 'usage', Shadowhelp::getHelp($player, 'view'));
// $bot->reply(self::arrayGet($text, 'usage', Shadowhelp::getHelp($player, 'viewi')));
// return false;
}
$items = Shadowfunc::getItemsIndexed($items, $is_store, $raw);
# Setup pattern and args
if (count($args) === 2) {
$pattern = $args[0];
$page = (int) $args[1];
} elseif (count($args) === 1) {
if (Common::isNumeric($args[0])) {
$pattern = NULL;
$page = (int) $args[0];
} else {
$pattern = $args[0];
$page = 1;
}
} else {
$pattern = NULL;
$page = 1;
}
# Filter on pattern
if ($pattern !== NULL) {
$items = Shadowfunc::filterIndexedBySubstring($args[0], $items);
}
# Display page
if (count($items) === 0) {
if ($pattern !== NULL) {
return self::arrayGet($text, 'empty_search', Shadowrun4::lang('1007'));
// $bot->reply(self::arrayGet($text, 'empty_search', Shadowrun4::lang('1007')));
} else {
return self::arrayGet($text, 'empty', Shadowrun4::lang('1008'));
// $bot->reply(self::arrayGet($text, 'empty', Shadowrun4::lang('1008')));
}
// return true;
}
if (false === ($pageStr = Shadowfunc::getItemPage($page, $items, $is_store))) {
return self::arrayGet($text, 'no_page', Shadowrun4::lang('1009'));
// $bot->reply(self::arrayGet($text, 'no_page', Shadowrun4::lang('1009')));
// return false;
}
$code = self::arrayGet($text, 'code', '5276');
return $player->lang($code, array(sprintf('%s%s', self::arrayGet($text, 'prefix', Shadowrun4::lang('items')), $pageStr)));
// return sprintf('%s, %s', self::arrayGet($text, 'prefix', Shadowrun4::lang('items')), $pageStr);
}
示例10: displayWeightB
private function displayWeightB()
{
return '' === ($s = $this->displayWeight()) ? '' : Shadowrun4::lang('weight', array($s));
// $b = chr(2);
// return ('' === ($s = $this->displayWeight())) ? '' : " {$b}Weight{$b}: {$s}.";
}
示例11: displayMaxMembercount
public function displayMaxMembercount()
{
return Shadowrun4::lang('members', array($this->getMaxMembercount()));
}
示例12: getComparisonMatrix
private static function getComparisonMatrix(SR_Player $player, SR_Item $item1, SR_Item $item2)
{
$titles = array();
$item1Stuff = array();
$item2Stuff = array();
$b = chr(2);
$type = $item1->getItemType();
// $titles[] = 'Type';
$titles[] = Shadowfunc::translateVariable($player, 'Type');
$item1Stuff[] = str_replace(" Weapon", "", $player->lang($item1->displayType()));
$item2Stuff[] = str_replace(" Weapon", "", $player->lang($item2->displayType()));
// $titles[] = 'Lvl';
$titles[] = Shadowfunc::shortcutVariable($player, 'Level');
$item1Lvl = $item1->getItemLevel();
$item2Lvl = $item2->getItemLevel();
if ($item1Lvl == $item2Lvl) {
$item1Stuff[] = $b . $item1Lvl . $b;
$item2Stuff[] = $b . $item2Lvl . $b;
} else {
if ($item2Lvl > $item1Lvl) {
$item1Stuff[] = $item1Lvl;
$item2Stuff[] = $b . $item2Lvl . $b;
} else {
$item1Stuff[] = $b . $item1Lvl . $b;
$item2Stuff[] = $item2Lvl;
}
}
// $item1ModA = $item1->getItemModifiersA($player);
// $item2ModA = $item2->getItemModifiersA($player);
$item1ModA = $item1->getItemModifiers($player);
$item2ModA = $item2->getItemModifiers($player);
unset($item1ModA['weight']);
unset($item2ModA['weight']);
if ($item1ModA || $item2ModA) {
if (array_key_exists('min_dmg', $item1ModA) || array_key_exists('min_dmg', $item2ModA)) {
// $titles[] = 'dmg';
$titles[] = Shadowfunc::shortcutVariable($player, 'Damage');
$item1min = false;
$item1max = false;
$item2min = false;
$item2max = false;
if (array_key_exists('min_dmg', $item1ModA)) {
$item1min = $item1ModA['min_dmg'];
$item1max = $item1ModA['max_dmg'];
unset($item1ModA['min_dmg']);
unset($item1ModA['max_dmg']);
}
if (array_key_exists('min_dmg', $item2ModA)) {
$item2min = $item2ModA['min_dmg'];
$item2max = $item2ModA['max_dmg'];
unset($item2ModA['min_dmg']);
unset($item2ModA['max_dmg']);
}
if ($item1min == $item2min) {
$item1min = $b . $item1min . $b;
$item2min = $b . $item2min . $b;
} else {
if ($item1min > $item2min) {
$item1min = $b . $item1min . $b;
} else {
$item2min = $b . $item2min . $b;
}
}
if ($item1max == $item2max) {
$item1min = $b . $item1min . $b;
$item2min = $b . $item2min . $b;
} else {
if ($item1max > $item2max) {
$item1max = $b . $item1max . $b;
} else {
$item2max = $b . $item2max . $b;
}
}
if ($item1max) {
$item1Stuff[] = $item1min . '-' . $item1max;
} else {
$item1Stuff[] = "";
}
if ($item2max) {
$item2Stuff[] = $item2min . '-' . $item2max;
} else {
$item2Stuff[] = "";
}
}
$keys = array_unique(array_merge(array_keys($item1ModA ? $item1ModA : array()), array_keys($item2ModA ? $item2ModA : array())));
foreach ($keys as $k => $v) {
// $titles[] = Shadowfunc::longModifierToShort($v);
$titles[] = Shadowfunc::shortcutVariable($player, $v);
$item1V = $item1ModA && array_key_exists($v, $item1ModA) ? $item1ModA[$v] : false;
$item2V = $item2ModA && array_key_exists($v, $item2ModA) ? $item2ModA[$v] : false;
if ($item1V && $item2V && $item1V == $item2V) {
$item1V = $b . $item1V . $b;
$item2V = $b . $item2V . $b;
} else {
if (!$item1V || $item2V > $item1V) {
$item2V = $b . $item2V . $b;
} else {
if (!$item2V || $item1V > $item2V) {
$item1V = $b . $item1V . $b;
}
//.........这里部分代码省略.........
示例13: onASLShowPartyB
public static function onASLShowPartyB(SR_Player $player, $field)
{
$out = '';
$sum = 0;
$format = Shadowrun4::lang('fmt_sumlist');
foreach ($player->getParty()->getMembers() as $member) {
$member instanceof SR_Player;
$val = Common::clamp(intval($member->getBase($field)), 0);
$sum += $val;
switch ($field) {
case 'age':
$out2 = "{$val}y";
break;
case 'bmi':
$out2 = Shadowfunc::displayWeight($val);
break;
case 'height':
$out2 = Shadowfunc::displayDistance($val, 2);
break;
default:
self::reply($player, 'Error unknown field in onASLShowPartyB()');
return false;
}
$out .= sprintf($format, $member->getEnum(), $member->getName(), $out2);
}
switch ($field) {
case 'age':
$sumtxt = "{$sum}y";
break;
case 'bmi':
$sumtxt = Shadowfunc::displayWeight($sum);
break;
case 'height':
$sumtxt = Shadowfunc::displayDistance($sum, 2);
break;
default:
self::reply($player, 'Error unknown field2 in onASLShowPartyB()');
return false;
}
self::rply($player, '', array(Shadowrun4::lang('sum_' . $field), $sumtxt, ltrim($out, ',; ')));
return true;
}