diff --git a/doc/Hero.py b/doc/Hero.py index fda7df4c..8fba639c 100644 --- a/doc/Hero.py +++ b/doc/Hero.py @@ -146,9 +146,7 @@ class Hero(object): 'response': [ _common.RspHead(), ['ceg', 0, 'ceg'], - ['gold', 0, 'gold'], - ['piece', 0, '碎片'], - ['serum', 0, '材料'], + ['!cost', [_common.AwardItem()], '返还资源'] ] },{ 'name': 'heroResetLevel', diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 8259215c..f78a0be3 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -359,6 +359,10 @@ class HeroController extends BaseAuthedController { $this->_rspErr(1, "param hero_unnid error"); return; } + if ($heroDb['hero_lv'] == 1){ + $this->_rspErr(1, "Level 1 hero cannot operate"); + return; + } $paramMeta = \mt\Parameter::getListValue('hero_reset_cost'); if (!$paramMeta){ $this->_rspErr(1, "parameter hero_reset_cost is null "); @@ -380,11 +384,29 @@ class HeroController extends BaseAuthedController { $serum += $heroLevelMeta['serum']; $gold += $heroLevelMeta['gold']; } + $costItems = array( + array( + 'item_id' => V_ITEM_GOLD, + 'item_num' => $gold, + ), + array( + 'item_id' => V_ITEM_HERO_META, + 'item_num' => $serum, + ), + + ); + $metaList = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE); + foreach ($metaList as $meta){ + if ($meta['relationship'] == $heroDb['hero_id']) { + array_push($costItems,array( + 'item_id' => $meta['id'], + 'item_num' => $piece, + )); + } + } $this->_rspData(array( 'ceg' => $actual_price, - 'gold' => $gold, - 'piece' => $piece, - 'serum' => $serum, + "cost" => $costItems )); } /*