1
This commit is contained in:
parent
ab44c2fc0a
commit
b9249a651b
@ -70,4 +70,4 @@ const kHAT_RATE_VAL = 2;
|
|||||||
const kWantedLockType = 3;
|
const kWantedLockType = 3;
|
||||||
|
|
||||||
const kMaxHeroUpLevelNum = 2;
|
const kMaxHeroUpLevelNum = 2;
|
||||||
const kMaxHeroUpQualityNum = 4;
|
const kMaxHeroUpQualityNum = 2;
|
||||||
|
@ -169,9 +169,9 @@ class HeroController extends BaseAuthedController {
|
|||||||
$propertyChgService->addHeroChg();
|
$propertyChgService->addHeroChg();
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
$propertyChgService->addUserChg();
|
$propertyChgService->addUserChg();
|
||||||
$currLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv']);
|
$currLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']);
|
||||||
if ($currLevelMeta) {
|
if ($currLevelMeta) {
|
||||||
$nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv'] + 1);
|
$nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv'] + 1);
|
||||||
if ($nextLevelMeta) {
|
if ($nextLevelMeta) {
|
||||||
Hero::update($heroUniId,
|
Hero::update($heroUniId,
|
||||||
array(
|
array(
|
||||||
@ -277,12 +277,12 @@ class HeroController extends BaseAuthedController {
|
|||||||
$this->_rspErr(100, 'server internal error');
|
$this->_rspErr(100, 'server internal error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$currLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv']);
|
$currLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']);
|
||||||
if (!$currLevelMeta) {
|
if (!$currLevelMeta) {
|
||||||
$this->_rspErr(100, 'server internal error');
|
$this->_rspErr(100, 'server internal error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'], $heroDb['hero_lv'] + 1);
|
$nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv'] + 1);
|
||||||
if (!$nextLevelMeta) {
|
if (!$nextLevelMeta) {
|
||||||
$this->_rspErr(5, "It's already the highest level");
|
$this->_rspErr(5, "It's already the highest level");
|
||||||
return;
|
return;
|
||||||
@ -390,7 +390,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
$this->_rspErr(5, "It's already the highest level1");
|
$this->_rspErr(5, "It's already the highest level1");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$nextLevelMeta = mt\HeroLevel::getByQualityLevel($heroDb['quality'] + 1, $heroDb['hero_lv']);
|
$nextLevelMeta = mt\HeroLevel::getByLevel($heroDb['hero_lv']);
|
||||||
if (!$nextLevelMeta) {
|
if (!$nextLevelMeta) {
|
||||||
$this->_rspErr(5, "It's already the highest level2");
|
$this->_rspErr(5, "It's already the highest level2");
|
||||||
return;
|
return;
|
||||||
|
@ -14,19 +14,10 @@ class HeroLevel {
|
|||||||
return getXVal(self::getMetaList(), $id);
|
return getXVal(self::getMetaList(), $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByQualityLevel($quality, $level)
|
public static function getByLevel($level)
|
||||||
{
|
{
|
||||||
self::mustBeQualityLevelHash();
|
self::mustBeLevelHash();
|
||||||
return getXVal(self::$qualityLevelHash, $quality . '_' . $level, null);
|
return getXVal(self::$LevelHash, $$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
@ -37,17 +28,17 @@ class HeroLevel {
|
|||||||
return self::$metaList;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function mustBeQualityLevelHash()
|
protected static function mustBeLevelHash()
|
||||||
{
|
{
|
||||||
if (!self::$qualityLevelHash) {
|
if (!self::$levelHash) {
|
||||||
self::$qualityLevelHash = array();
|
self::$levelHash = array();
|
||||||
foreach (self::getMetaList() as $meta) {
|
foreach (self::getMetaList() as $meta) {
|
||||||
self::$qualityLevelHash[$meta['quality'] . '_' . $meta['level']] = $meta;
|
self::$levelHash[$meta['level']] = $meta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static $metaList;
|
protected static $metaList;
|
||||||
protected static $qualityLevelHash;
|
protected static $LevelHash;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user