當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Shadowfunc::untranslateVariable方法代碼示例

本文整理匯總了PHP中Shadowfunc::untranslateVariable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shadowfunc::untranslateVariable方法的具體用法?PHP Shadowfunc::untranslateVariable怎麽用?PHP Shadowfunc::untranslateVariable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Shadowfunc的用法示例。


在下文中一共展示了Shadowfunc::untranslateVariable方法的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) {
//.........這裏部分代碼省略.........
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:101,代碼來源:SR_Hospital.php


注:本文中的Shadowfunc::untranslateVariable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。