本文整理汇总了PHP中SR_Player::isOptionEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP SR_Player::isOptionEnabled方法的具体用法?PHP SR_Player::isOptionEnabled怎么用?PHP SR_Player::isOptionEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SR_Player
的用法示例。
在下文中一共展示了SR_Player::isOptionEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onEnable
protected static function onEnable(SR_Player $player, $bit, $bool, $name)
{
$text = $bool === true ? 'enabled' : 'disabled';
$text = $player->lang($text);
$old = $player->isOptionEnabled($bit);
if ($bool === $old) {
$player->msg('5070', array($name, $text));
// $player->message(sprintf('%s has been already %s.', $name, $text));
return true;
}
if (false === $player->saveOption($bit, $bool)) {
return false;
}
$player->msg('5071', array($name, $text));
// $player->message(sprintf('%s has been %s for your character.', $name, $text));
$player->modify();
return true;
}
示例2: getCurrentCommands
public static function getCurrentCommands(SR_Player $player, $show_hidden = true, $boldify = false, $long_versions = true, $translate = false, $filter_hidden = false, $hidden_only = false)
{
if ($player->isOptionEnabled(SR_Player::DEAD)) {
return array_merge(self::$CMDS_ALWAYS_CREATE, array('reset'));
}
if (false === $player->isCreated()) {
return self::$CMDS_ALWAYS_CREATE;
}
if (false === ($party = $player->getParty())) {
return array();
}
$action = $party->getAction();
$leader = $player->isLeader();
$commands = array();
# Allways commands
if (!$hidden_only) {
$commands = array_merge($commands, self::$CMDS_ALWAYS);
}
# Always
if ($show_hidden) {
$commands = array_merge($commands, self::$CMDS_ALWAYS_CREATE);
}
# GM commands
if ($show_hidden && $player->isGM()) {
$commands = array_merge($commands, self::$CMDS_GM);
}
# Hidden commands
if ($show_hidden) {
$commands = array_merge($commands, self::$CMDS_ALWAYS_HIDDEN);
}
# Player actions
if (!$hidden_only) {
$commands = array_merge($commands, self::$CMDS[$action]);
if (false !== ($scanner = $player->getInvItemByName('Scanner_v6', false))) {
$commands[] = 'spy';
}
if ($player->getBase('alchemy') >= 0) {
$commands[] = 'brew';
}
}
# Leader actions
if ($leader) {
if ($show_hidden) {
$commands = array_merge($commands, self::$CMDS_LEADER_ALWAYS);
}
if (!$hidden_only) {
# Outside location?
if (false !== ($location = $party->getLocationClass('outside'))) {
if ($location->isEnterAllowed($player)) {
# We can enter
$commands[] = 'enter';
}
}
# Action
$commands = array_merge($commands, self::$CMDS_LEADER[$action]);
}
}
# Location commands
if (!$hidden_only) {
if (false !== ($location = $party->getLocationClass('inside'))) {
# Leader
if ($leader === true) {
// $commands = array_merge($commands, self::shortcutArray($location->getLeaderCommands($player)));
$commands = array_merge($commands, $location->getLeaderCommands($player));
if ($location->isPVP()) {
$commands[] = 'fight';
}
}
# Talk
$commands = array_merge($commands, $location->getNPCTalkCommands($player));
# Special
// $commands = array_merge($commands, self::shortcutArray($location->getCommands($player)));
$commands = array_merge($commands, $location->getCommands($player));
} elseif (false !== ($location = $party->getLocationClass('outside'))) {
if ($location->isHijackable()) {
$commands[] = 'hijack';
}
// if ($location->isPVP())
// {
$commands[] = 'fight';
// }
}
}
// if ($long_versions === false)
// {
// $commands = array_map(array(__CLASS__, 'shortcut'), $commands);
// }
// if ($long_versions === true)
// {
// $commands = array_map(array(__CLASS__, 'unshortcut'), $commands);
// }
##############
### FORMAT ###
##############
if ($filter_hidden) {
$commands = array_values(array_diff($commands, self::$REALLY_HIDDEN));
}
if ($boldify) {
// if ($long_versions === true)
// {
//.........这里部分代码省略.........