|
@@ -218,11 +218,16 @@ class HeroProc {
|
|
|
my_Assert($targetHero->HeroCanLevelUp(), "请提升指挥官等级."); # 2. 检查玩家等级是否可以继续升级, Ps. 全局限制 + 指挥官等级限制
|
|
|
$myPacketItems = $user->store->items; # 检查道具的数量,在背包中是否充足
|
|
|
my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
|
|
|
- my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough);
|
|
|
+ my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough);
|
|
|
$initLevel = $targetHero->level; # 初始等级
|
|
|
$totalEXP = 0; # 4.计算消耗的道具一共给多少经验值以及 一共要消耗多少金币
|
|
|
$costItemConst = GameConfig::item_stones_getItem($costItemId);
|
|
|
my_Assert(null != $costItemConst, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ $totalGold = $costItemConst->costGold * $costNumber; #验证金币是否充足
|
|
|
+ my_Assert($user->baseInfo->gold >= $totalGold, ErrCode::notenough_gold_msg);
|
|
|
+ $user->baseInfo->gold -= $totalGold;
|
|
|
+
|
|
|
$totalEXP += $costItemConst->baseExp;
|
|
|
$heroConst = GameConfig::hero_getItem($targetHero->typeId); # 英雄模板数据
|
|
|
my_Assert(null != $heroConst, ErrCode::err_const_no, "英雄 模板数据");
|
|
@@ -245,7 +250,8 @@ class HeroProc {
|
|
|
self::CalcUserFightPower(req()->zoneid, req()->uid, req()->userInfo->game); # 跟新战力统计
|
|
|
$ret = array(
|
|
|
'hero' => $targetHero,
|
|
|
- 'store' => $user->store
|
|
|
+ 'store' => $user->store,
|
|
|
+ 'gold'=>$user->baseInfo->gold,
|
|
|
);
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
@@ -253,14 +259,41 @@ class HeroProc {
|
|
|
/**
|
|
|
* 突破
|
|
|
*/
|
|
|
- static function tupo() {
|
|
|
- list($huid) = req()->paras;
|
|
|
+ static function tupo() {
|
|
|
+ list($uid) = req()->paras;
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+ $collectHeros = $user->heros->collectHeros; # 1. 检查是否存在要升级的英雄
|
|
|
+ my_default_Obj($collectHeros);
|
|
|
+ my_Assert(StlUtil::dictHasProperty($collectHeros, $uid), ErrCode::hero_no); # 参数合法性判断
|
|
|
+
|
|
|
+ $typeId = $collectHeros->$uid->typeId;
|
|
|
+ $curStar = $collectHeros->$uid->curStar;
|
|
|
+ my_Assert($curStar < 5, ErrCode::hero_yanling_canotTupo);
|
|
|
|
|
|
+ $mo = GameConfig::heroextra_level_tupo_getItem($typeId, $curStar+1);
|
|
|
+ my_Assert($mo == null, ErrCode::err_const_no);
|
|
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
+ my_Assert($collectHeros->$uid->level >= $mo->starlimitLv, ErrCode::hero_yanling_canotTupo);
|
|
|
+ my_Assert($user->baseInfo->level >= $mo->userlvLimit, ErrCode::hero_yanling_canotTupo);
|
|
|
+ my_Assert($user->baseInfo->gold >= $mo->gold , ErrCode::notenough_gold_msg);
|
|
|
+
|
|
|
+ $costItemsList = explode(';',$mo->costItems);
|
|
|
+ foreach ($costItemsList as $value) {
|
|
|
+ $list = explode(',', $value);
|
|
|
+ StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $user->baseInfo->gold -= $mo->gold;
|
|
|
+ $collectHeros->$uid->curStar+=1;
|
|
|
+ $user->heros->collectHeros=$collectHeros;
|
|
|
+ req()->userInfo->game = $user;
|
|
|
+ $targetHero = new Ins_UserHero($collectHeros->$uid);
|
|
|
+
|
|
|
+ UserProc::updateUserInfo();# 回写玩家数据
|
|
|
$ret = array(
|
|
|
'hero' => $targetHero,
|
|
|
- 'store' => $user->store
|
|
|
+ 'store' => $user->store,
|
|
|
+ 'gold' => req()->userInfo->game->baseInfo->gold,
|
|
|
);
|
|
|
return Resp::ok($ret);
|
|
|
}
|