This commit is contained in:
aozhiwei 2022-06-14 15:42:36 +08:00
parent c3a9e20061
commit a4111eabc9

View File

@ -221,9 +221,24 @@ class HeroController extends BaseAuthedController {
$propertyChgService->addBagChg();
$propertyChgService->addUserChg();
$currQualityMeta = mt\HeroQuality::getByQuality($heroDb['quality']);
$nextQualityMeta = null;
if ($currQualityMeta) {
$nextQualityMeta = mt\HeroQuality::getByQuality($heroDb['quality'] + 1);
if ($nextQualityMeta) {
$rnd = rand(1, 100);
if ($rand > $nextQualityMeta['success_rate']) {
Hero::update($heroUniId,
array(
'advanced_count' => $heroDb['advanced_count'] + 1,
'lock_type' => 0,
'unlock_time' => 0,
)
);
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));
return;
}
Hero::update($heroUniId,
array(
'quality' => $heroDb['quality'] + 1,
@ -237,6 +252,10 @@ class HeroController extends BaseAuthedController {
$rankActivityService->heroUpgradeLevel($heroDb['quality'] + 1);
}
}
if (!$nextQualityMeta) {
$this->_rspErr(1, 'quality is full');
return;
}
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
'old_hero' => $oldHero,
@ -342,7 +361,7 @@ class HeroController extends BaseAuthedController {
array(
'hero_lv' => $heroDb['hero_lv'] + 1,
'lock_type' => Hero::LEVEL_LOCK,
'unlock_time' => $this->_getNowTime() + $currLevelMeta['time'],
'unlock_time' => $this->_getNowTime() + $nextLevelMeta['time'],
)
);
}
@ -452,7 +471,7 @@ class HeroController extends BaseAuthedController {
array(
'hero_lv' => $heroDb['hero_lv'],
'lock_type' => Hero::QUALITY_LOCK,
'unlock_time' => $this->_getNowTime() + $currQualityMeta['time'],
'unlock_time' => $this->_getNowTime() + $nextQualityMeta['time'],
)
);
$this->_setV(TN_HERO_QUALITY_UP, (int)$slotId, (int)$heroDb['idx']);