本文整理汇总了PHP中Shadowrun4::getCityByAbbrev方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowrun4::getCityByAbbrev方法的具体用法?PHP Shadowrun4::getCityByAbbrev怎么用?PHP Shadowrun4::getCityByAbbrev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowrun4
的用法示例。
在下文中一共展示了Shadowrun4::getCityByAbbrev方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocationByAbbrev
/**
* @param string $cityname
* @param string $arg
* @return SR_Location
*/
public static function getLocationByAbbrev($cityname, $arg)
{
$player = Shadowrun4::getCurrentPlayer();
if (false !== ($c = Common::substrUntil($arg, '_', false))) {
$cityname = $c;
$arg = Common::substrFrom($arg, '_', $arg);
}
if (false === ($city = Shadowrun4::getCityByAbbrev($cityname))) {
self::reply($player, 'Unknown city: ' . $cityname);
return false;
}
$city instanceof SR_City;
return $city->getLocationByAbbrev($arg);
}
示例2: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
$party = $player->getParty();
$city = false;
if (count($args) >= 1) {
if (is_numeric($args[0])) {
$city = Shadowrun4::getCityByID($args[0]);
} else {
$city = Shadowrun4::getCityByAbbrev($args[0]);
}
} else {
$city = $party->getCityClass();
}
if ($city === false) {
return self::reply($player, 'Error: Cannot get city class for your party!');
}
$cityname = $city->getName();
return self::rply($player, '5007', array($cityname, Shadowfunc::getKnownPlaces($player, $cityname)));
// $bot->reply(sprintf('Known Places in %s: %s.', $cityname, Shadowfunc::getKnownPlaces($player, $cityname)));
return true;
}
示例3: displayMissing
/**
* Display classnames of missing quests in a city.
* @param SR_Player $player
* @param array $quests
* @param array $args
* @return true
*/
private static function displayMissing(SR_Player $player, array $quests, array $args)
{
if (count($args) === 1) {
$args[] = $player->getParty()->getCity();
}
if (count($args) !== 2) {
return self::reply($player, Shadowhelp::getHelp($player, 'quests'));
}
if (false === ($city = Shadowrun4::getCityByAbbrev($args[1]))) {
return self::reply($player, Shadowhelp::getHelp($player, 'quests'));
}
$cityname = $city->getName();
$names = array();
$all = SR_Quest::getQuests();
foreach ($all as $classname => $quest) {
$quest instanceof SR_Quest;
if ($quest->getCityName() !== $cityname) {
continue;
}
$q2 = SR_Quest::getQuest($player, $quest->getVar('sr4qu_name'));
if ($q2->isUnknown($player)) {
$names[] = Common::substrFrom($classname, '_', $classname);
}
}
return self::rply($player, '5265', array($cityname, GWF_Array::implodeHuman($names)));
}