This commit is contained in:
aozhiwei 2022-06-10 16:12:55 +08:00
parent 9c3864c9e5
commit ccf0488b81
3 changed files with 30 additions and 25 deletions

View File

@ -67,6 +67,7 @@ class Hero(object):
'params': [ 'params': [
_common.ReqHead(), _common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'], ['hero_uniid', 0, '英雄唯一id'],
['slot_id', 0, '槽id(0-1)'],
['cost_item_id', 0, '支付方式'], ['cost_item_id', 0, '支付方式'],
], ],
'response': [ 'response': [
@ -95,6 +96,7 @@ class Hero(object):
'params': [ 'params': [
_common.ReqHead(), _common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'], ['hero_uniid', 0, '英雄唯一id'],
['slot_id', 0, '槽id(0-1)'],
['cost_item_id', 0, '支付方式'], ['cost_item_id', 0, '支付方式'],
], ],
'response': [ 'response': [

View File

@ -14,7 +14,9 @@ define('TN_ACTIVE', 8002);
define('TN_SHOP', 8003); define('TN_SHOP', 8003);
define('TN_RECHARGE_UPGRADE_TIMES', 8004); define('TN_RECHARGE_UPGRADE_TIMES', 8004);
define('TN_SHARE_GAMES', 8005); define('TN_SHARE_GAMES', 8005);
define('TN_END', 8005); define('TN_HERO_LEVEL_UP', 8006);
define('TN_HERO_QUALITY_UP', 8007);
define('TN_END', 8007);
define('TN_DAILY_BEGIN', 9001); define('TN_DAILY_BEGIN', 9001);
define('TN_DAILY_LOGINS', 9001); define('TN_DAILY_LOGINS', 9001);

View File

@ -89,6 +89,30 @@ class HeroController extends BaseAuthedController {
public function getUpgradeLevelList() public function getUpgradeLevelList()
{ {
$baseAttrs = mt\Hero::getHeroAttr($heroMeta);
mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs());
$attrs = emptyReplace(json_decode($heroDb['rand_attr'], true), array());
$ret = mt\HeroLevel::addRandAttr($nextLevelMeta, $baseAttrs, $attrs);
if (!$ret) {
$this->_rspErr(2, 'server internal error');
return;
}
Hero::update($heroUniId,
array(
'hero_lv' => $heroDb['hero_lv'] + 1,
'rand_attr' => json_encode($attrs),
'lock_type' => Hero::LEVEL_LOCK,
'unlock_time' => $this->_getNowTime() + $currLevelMeta['time'],
'unlock_trade_time' => $this->_getNowTime() + $currLevelMeta['time'] + mt\Parameter::getVal('hero_lock_transaction_time', 0)
)
);
$rankActivityService = new service\RankActivityService();
$rankActivityService->heroUpgradeLevel($heroDb['hero_lv'] + 1);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));
} }
public function getUpgradeQualityList() public function getUpgradeQualityList()
@ -169,31 +193,8 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return; return;
} }
$baseAttrs = mt\Hero::getHeroAttr($heroMeta);
mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs());
$attrs = emptyReplace(json_decode($heroDb['rand_attr'], true), array());
$ret = mt\HeroLevel::addRandAttr($nextLevelMeta, $baseAttrs, $attrs);
if (!$ret) {
$this->_rspErr(2, 'server internal error');
return;
}
$this->_decItems($costItems); $this->_decItems($costItems);
Hero::update($heroUniId, $this->_setV(TN_HERO_LEVEL_UP);
array(
'hero_lv' => $heroDb['hero_lv'] + 1,
'rand_attr' => json_encode($attrs),
'lock_type' => Hero::LEVEL_LOCK,
'unlock_time' => $this->_getNowTime() + $currLevelMeta['time'],
'unlock_trade_time' => $this->_getNowTime() + $currLevelMeta['time'] + mt\Parameter::getVal('hero_lock_transaction_time', 0)
)
);
$rankActivityService = new service\RankActivityService();
$rankActivityService->heroUpgradeLevel($heroDb['hero_lv'] + 1);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));
} }
public function upgradeQuality() public function upgradeQuality()