1
This commit is contained in:
parent
ab44c2fc0a
commit
b9249a651b
@ -70,4 +70,4 @@ const kHAT_RATE_VAL = 2;
|
||||
const kWantedLockType = 3;
|
||||
|
||||
const kMaxHeroUpLevelNum = 2;
|
||||
const kMaxHeroUpQualityNum = 4;
|
||||
const kMaxHeroUpQualityNum = 2;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user