|
@@ -721,6 +721,111 @@ class HeroProc {
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array('store' => req()->userInfo->game->store,));
|
|
|
}
|
|
|
+
|
|
|
+ static function StrengthenStar_new() {
|
|
|
+ list($uid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+ $yanling = $user->store->yanling;
|
|
|
+ my_Assert(CommUtil::isPropertyExists($yanling, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
+
|
|
|
+ $typeId = $yanling->$uid->typeId;
|
|
|
+ $curStar = $yanling->$uid->starLv;
|
|
|
+ my_Assert($curStar < 5, ErrCode::hero_yanling_canotTupo);
|
|
|
+
|
|
|
+ $mo = GameConfig::yanlingextra_level_getItem($typeId, $curStar+1);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ my_Assert($yanling->$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;
|
|
|
+ $yanling->$uid->starLv += 1;
|
|
|
+
|
|
|
+ NormalEventProc::OnYanLingLvTuPo($uid, $yanling->$uid->starLv); # 广播英雄升级事件
|
|
|
+
|
|
|
+ $user->store->yanling = $yanling;
|
|
|
+ req()->userInfo->game = $user;
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "store" => $user->store, # # 目前来看只涉及到items变化
|
|
|
+ 'gold' => $user->baseInfo->gold,
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 言灵升级
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ static function YanlinUpLevel_new() {
|
|
|
+ list($uid,$yanlingList, $items) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+ $yanling = $user->store->yanling;
|
|
|
+
|
|
|
+ my_Assert(CommUtil::isPropertyExists($yanling, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
+ $myPacketItems = $user->store->items;
|
|
|
+ //消耗材料道具
|
|
|
+ $total = 0;
|
|
|
+ $totalGold = 0;
|
|
|
+ foreach ($items as $costItemId => $costNumber) {
|
|
|
+ my_Assert(CommUtil::isPropertyExists($myPacketItems,$costItemId), ErrCode::store_itemnotenough); #
|
|
|
+ my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough);# 检查道具的数量,在背包中是否充足
|
|
|
+ $mo = GameConfig::item_stones_getItem($costItemId);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);
|
|
|
+ $total += $mo->baseExp*$costNumber;
|
|
|
+ $totalGold += $mo->costGold*$costNumber;
|
|
|
+ }
|
|
|
+
|
|
|
+ $yanlingExp = 0;
|
|
|
+ //消耗武器
|
|
|
+ foreach ($yanlingList as $yanlingId) {
|
|
|
+ my_Assert(CommUtil::isPropertyExists($yanling, $yanlingId), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
+ $mo = GameConfig::item_yanling_getItem($yanling->$yanlingId->typeId);
|
|
|
+ $baseExp = $mo->baseExp;
|
|
|
+ $yanlingExp += $baseExp + $yanling->$yanlingId->curStarExp *0.75;
|
|
|
+ $totalGold += $mo->costGold;
|
|
|
+ StlUtil::dictRemove($user->store->yanling, $yanlingId);
|
|
|
+ }
|
|
|
+ my_Assert($user->baseInfo->gold >= $totalGold, ErrCode::notenough_gold_msg);
|
|
|
+
|
|
|
+ $equipVo = new Ins_YanLin($yanling->$uid);
|
|
|
+ //$equipVo = new Ins_Weapon($equipment->$uid);
|
|
|
+ $initLevel = $equipVo->level;
|
|
|
+
|
|
|
+ $equipVo->curStarExp += $total+(int)$wuqiExp;
|
|
|
+ $curlevel = self::Upgrade($equipVo->exp, GameConfig::item_base_getItem($equipVo->typeId)->quality);
|
|
|
+ $curStar = $equipVo->starLv ; #当前星级
|
|
|
+ $equipVo->level = $curlevel;
|
|
|
+ if ($curStar < 5) {
|
|
|
+ $starlimitLv = GameConfig::yanlingextra_level_getItem($equipVo->typeId, $curStar + 1)->starlimitLv;
|
|
|
+ if ($starlimitLv < $curlevel) {
|
|
|
+ $equipVo->level = $starlimitLv;
|
|
|
+ $equipVo->curStarExp = GameConfig::yanlingLevel_type_getItem(GameConfig::item_base_getItem($equipVo->typeId)->quality,$starlimitLv)->requiredExp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $user->store->yanling->$uid = $equipVo;
|
|
|
+ $user->baseInfo->gold -= $totalGold;
|
|
|
+ req()->userInfo->game = $user;
|
|
|
+ req()->userInfo->game->store->items = $myPacketItems; # 更新背包数据
|
|
|
+ if ($equipVo->level != $initLevel) {
|
|
|
+ NormalEventProc::OnYanLingLvlUp($uid, $equipVo->level); # 广播英雄升级事件
|
|
|
+ }
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "store" => $user->store, # # 目前来看只涉及到items变化
|
|
|
+ 'gold' => $user->baseInfo->gold,
|
|
|
+ ));
|
|
|
+ }
|
|
|
|
|
|
/** 6327
|
|
|
* 言灵升级 2021.4(cyzhao)
|