From a4111eabc903aaeed46d02da7fe83e8e1edb5dfe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 14 Jun 2022 15:42:36 +0800 Subject: [PATCH] 1 --- webapp/controller/HeroController.class.php | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 1449842f..60c31432 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -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']);