本文整理汇总了PHP中Shadowfunc::unshortcutVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Shadowfunc::unshortcutVariable方法的具体用法?PHP Shadowfunc::unshortcutVariable怎么用?PHP Shadowfunc::unshortcutVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shadowfunc
的用法示例。
在下文中一共展示了Shadowfunc::unshortcutVariable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSurgeryB
private function onSurgeryB(SR_Player $player, $field)
{
echo "Got {$field}\n";
$field = Shadowfunc::unshortcutVariable($player, $field);
# rü => armor
echo "Got {$field}\n";
$field = Shadowfunc::untranslateVariable($player, $field);
# rüstung => armor
echo "Got {$field}\n";
if ($field === 'essence') {
$player->msg('1176', array($field));
# You cannot do surgery on your %s.
return false;
}
if (true === in_array($field, SR_Player::$ATTRIBUTE)) {
$price = $this->getAttributePrice($field);
$section = 'attribute';
} elseif (true === in_array($field, SR_Player::$SKILL)) {
$price = $this->getSkillPrice($field);
$section = 'skill';
} elseif (Shadowfunc::isSpell($field)) {
if ($player->getSpellBaseLevel($field) === -1) {
$player->msg('1048');
# You don't have this spell.
return false;
}
$price = $this->getSpellPrice($field);
$section = 'spell';
} elseif (true === in_array($field, SR_Player::$KNOWLEDGE)) {
$price = $this->getKnowledgePrice($field);
$section = 'knowledge';
} elseif ($field === 'male' || $field === 'female') {
$price = $this->getGenderPrice($field);
$section = 'gender';
} elseif (true === in_array($field, array_keys(SR_Player::$RACE))) {
$price = $this->getRacePrice($field);
$section = 'race';
} else {
$player->msg('1176', array($field));
# You cannot do surgery on your %s.
return false;
}
if ($price === false) {
$player->msg('1176', array($field));
# You cannot do surgery on your %s.
return false;
}
$dprice = Shadowfunc::displayNuyen($price);
if ($price > $player->getNuyen()) {
$player->msg('1063', array($dprice, $player->displayNuyen()));
return false;
}
if (false === ($cost = Shadowcmd_lvlup::getKarmaCostFactor($field))) {
// $player->message('Database error 1!');
// return false;
}
$karma_back = 0;
switch ($section) {
case 'skill':
case 'knowledge':
case 'attribute':
if ($cost === false) {
$player->message('Database error 2.2!');
return false;
}
# Get the minimum base
if (0 > ($racebase = $player->getRaceBaseVar($field, -1))) {
$racebase = 0;
// $player->message('Database error 2!');
// return false;
}
# Get current base
if (false === ($current = $player->getBase($field))) {
$player->message('Database error 3!');
return false;
}
# Reached min?
if ($current <= $racebase) {
$player->msg('1177', array($field, $racebase));
return false;
}
$karma_back = $cost * $current;
if (false === $player->increaseField($field, -1)) {
$player->message('Database error 5!');
return false;
}
$current--;
break;
case 'spell':
if ($cost === false) {
$player->message('Database error 2.2!');
return false;
}
# Get current base
if (-1 === ($current = $player->getSpellBaseLevel($field))) {
$player->message('Database error 3!');
return false;
}
# Reached min?
if ($current <= 0) {
//.........这里部分代码省略.........