diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index bf007a06..33f90355 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -70,4 +70,4 @@ const kHAT_RATE_VAL = 2; const kWantedLockType = 3; const kMaxHeroUpLevelNum = 2; -const kMaxHeroUpQualityNum = 4; +const kMaxHeroUpQualityNum = 2; diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index e02d1cd4..85f8aaae 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -169,9 +169,9 @@ class HeroController extends BaseAuthedController { $propertyChgService->addHeroChg(); $propertyChgService->addBagChg(); $propertyChgService->addUserChg(); - $currLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv']); + $currLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']); if ($currLevelMeta) { - $nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv'] + 1); + $nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv'] + 1); if ($nextLevelMeta) { Hero::update($heroUniId, array( @@ -277,12 +277,12 @@ class HeroController extends BaseAuthedController { $this->_rspErr(100, 'server internal error'); return; } - $currLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv']); + $currLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']); if (!$currLevelMeta) { $this->_rspErr(100, 'server internal error'); return; } - $nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv'] + 1); + $nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv'] + 1); if (!$nextLevelMeta) { $this->_rspErr(5, "It's already the highest level"); return; @@ -390,7 +390,7 @@ class HeroController extends BaseAuthedController { $this->_rspErr(5, "It's already the highest level1"); return; } - $nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'] + 1, $heroDb['hero_lv']); + $nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']); if (!$nextLevelMeta) { $this->_rspErr(5, "It's already the highest level2"); return; diff --git a/webapp/mt/HeroLevel.php b/webapp/mt/HeroLevel.php index e54145fc..66a74ada 100644 --- a/webapp/mt/HeroLevel.php +++ b/webapp/mt/HeroLevel.php @@ -14,19 +14,10 @@ class HeroLevel { return getXVal(self::getMetaList(), $id); } - public static function getByQualityLevel($quality, $level) + public static function getByLevel($level) { - self::mustBeQualityLevelHash(); - return getXVal(self::$qualityLevelHash, $quality . '_' . $level, null); - } - - public static function addRandAttr($levelMeta, $baseAttrs, &$dbAttrs) - { - $nums = explode(':', $levelMeta['rand_attrs_num']); - $num = rand($nums[0], $nums[1]); - $cfgAttrs = StrHelper::parseList($levelMeta['rand_attrs'], array('|', ':')); - AttrHelper::addRandAttrs($cfgAttrs, $num, $baseAttrs, $dbAttrs); - return true; + self::mustBeLevelHash(); + return getXVal(self::$LevelHash, $$level, null); } protected static function getMetaList() @@ -37,17 +28,17 @@ class HeroLevel { return self::$metaList; } - protected static function mustBeQualityLevelHash() + protected static function mustBeLevelHash() { - if (!self::$qualityLevelHash) { - self::$qualityLevelHash = array(); + if (!self::$levelHash) { + self::$levelHash = array(); foreach (self::getMetaList() as $meta) { - self::$qualityLevelHash[$meta['quality'] . '_' . $meta['level']] = $meta; + self::$levelHash[$meta['level']] = $meta; } } } protected static $metaList; - protected static $qualityLevelHash; + protected static $LevelHash; }