|
@@ -59,10 +59,91 @@ class StoreProc {
|
|
|
return self::CallYanlingByBook();
|
|
|
case CmdCode::cmd_store_yanling_upgrade: # 6420 言灵进阶
|
|
|
return self::YanlingUpgrade();
|
|
|
+ case CmdCode::cmd_store__weapon_upgrade: # 6421武器升级
|
|
|
+ return self::weaponUpgrade();
|
|
|
+ case CmdCode::cmd_store__weapon_tupo: # 6421武器升级
|
|
|
+ return self::weaponTupo();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 武器升级
|
|
|
+ */
|
|
|
+ static function weaponUpgrade() {
|
|
|
+ list($uid,$prizeCtx) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+ $equipment = $user->store->equipment;
|
|
|
+
|
|
|
+ my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::hero_no); # 玩家拥有此英雄
|
|
|
+ $myPacketItems = $user->store->items;
|
|
|
+ $list = explode(';', $prizeCtx);
|
|
|
+ $total = 0;
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $ctxList = explode(',', $val);
|
|
|
+ $costItemId = $ctxList[0];
|
|
|
+ $costNumber = $ctxList[1];
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ $equipVo = new Ins_Weapon($equipment->$uid);
|
|
|
+ $equipVo->exp += $total;
|
|
|
+ $curlevel = self::Upgrade($equipVo->exp);
|
|
|
+ $equipVo->level = $curlevel;
|
|
|
+ $user->store->equipment->$uid = $equipVo;
|
|
|
+
|
|
|
+ req()->userInfo->game->store->items = $myPacketItems; # 更新背包数据
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "store" => $user->store, # # 目前来看只涉及到items变化
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param type $xp
|
|
|
+ * @param type $type
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ static function Upgrade($xp,$type = 3) {
|
|
|
+ $curLv = 0;
|
|
|
+ $heroLvDic = GameConfig::weapon_levelexp();
|
|
|
+ $f = (array) $heroLvDic;
|
|
|
+ ksort($f);
|
|
|
+ foreach ($f as $lv => $mo) {
|
|
|
+ if($xp < $mo->needExp){
|
|
|
+ $curLv = $lv-1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if($lv>=glc()->Weapon_Upgrade_BasicMaxLevel){
|
|
|
+ $curLv = glc()->Weapon_Upgrade_BasicMaxLevel;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $curLv;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 武器突破
|
|
|
+ */
|
|
|
+ static function weaponTupo() {
|
|
|
+ list($yanlingUid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "store" => $user->store, # # 目前来看只涉及到items变化
|
|
|
+ ));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* [6420] 言灵进阶
|