|
@@ -71,18 +71,15 @@ class StoreProc {
|
|
|
* 武器升级
|
|
|
*/
|
|
|
static function weaponUpgrade() {
|
|
|
- list($uid,$prizeCtx) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ list($uid,$wuqiList, $items) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
$user = req()->userInfo->game;
|
|
|
$equipment = $user->store->equipment;
|
|
|
|
|
|
my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
$myPacketItems = $user->store->items;
|
|
|
- $list = explode(';', $prizeCtx);
|
|
|
+ //消耗材料道具
|
|
|
$total = 0;
|
|
|
- foreach ($list as $key => $val) {
|
|
|
- $ctxList = explode(',', $val);
|
|
|
- $costItemId = $ctxList[0];
|
|
|
- $costNumber = $ctxList[1];
|
|
|
+ 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);
|
|
@@ -91,10 +88,16 @@ class StoreProc {
|
|
|
StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);
|
|
|
$total += $mo->baseExp*$costNumber;
|
|
|
}
|
|
|
+ //消耗武器
|
|
|
+ foreach ($wuqiList as $wuqiId) {
|
|
|
+ my_Assert(CommUtil::isPropertyExists($equipment, $wuqiId), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
+ StlUtil::dictRemove($user->store->equipment, $wuqiId);
|
|
|
+ $total += GameConfig::item_weapon_getItem($equipment->$wuqiId->typeId)->baseExp;
|
|
|
+ }
|
|
|
|
|
|
$equipVo = new Ins_Weapon($equipment->$uid);
|
|
|
$equipVo->exp += $total;
|
|
|
- $curlevel = self::Upgrade($equipVo->exp);
|
|
|
+ $curlevel = self::Upgrade($equipVo->exp, GameConfig::item_base_getItem($equipVo->typeId)->quality);
|
|
|
$equipVo->level = $curlevel;
|
|
|
$user->store->equipment->$uid = $equipVo;
|
|
|
|
|
@@ -112,9 +115,9 @@ class StoreProc {
|
|
|
* @param type $type
|
|
|
* @return type
|
|
|
*/
|
|
|
- static function Upgrade($xp,$type = 3) {
|
|
|
+ static function Upgrade($xp,$qual) {
|
|
|
$curLv = 0;
|
|
|
- $heroLvDic = GameConfig::weapon_levelexp();
|
|
|
+ $heroLvDic = GameConfig::weapon_levelexp()->$qual;
|
|
|
$f = (array) $heroLvDic;
|
|
|
ksort($f);
|
|
|
foreach ($f as $lv => $mo) {
|
|
@@ -151,16 +154,16 @@ class StoreProc {
|
|
|
my_Assert($equipment->$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);
|
|
|
- $segID = $mo->segID;
|
|
|
- my_Assert(StlUtil::dictHasProperty($user->store->items,$segID) , ErrCode::store_itemnotenough);
|
|
|
- my_Assert($user->store->items->$segID>=$mo->segNum , ErrCode::store_itemnotenough);
|
|
|
+// $segID = $mo->segID;
|
|
|
+// my_Assert(StlUtil::dictHasProperty($user->store->items,$segID) , ErrCode::store_itemnotenough);
|
|
|
+// my_Assert($user->store->items->$segID>=$mo->segNum , ErrCode::store_itemnotenough);
|
|
|
|
|
|
$costItemsList = explode(';',$mo->costItems);
|
|
|
foreach ($costItemsList as $value) {
|
|
|
$list = explode(',', $value);
|
|
|
- StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);
|
|
|
+ StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);
|
|
|
}
|
|
|
- $user->store->items->$segID -= $mo->segNum;
|
|
|
+
|
|
|
$user->baseInfo->gold -= $mo->gold;
|
|
|
$equipment->$uid->starLevel += 1;
|
|
|
|