|
@@ -58,11 +58,43 @@ class StoreProc {
|
|
|
return self::MergeYanlingBook($req);
|
|
|
case CmdCode::cmd_store_callyanling: # 6419 利用言灵召唤书召唤言灵
|
|
|
return self::CallYanlingByBook($req);
|
|
|
+ case CmdCode::cmd_store_yanling_upgrade: # 6420 言灵进阶
|
|
|
+ return self::YanlingUpgrade($req);
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * [6420] 言灵进阶
|
|
|
+ * @param req $req
|
|
|
+ */
|
|
|
+ static function YanlingUpgrade($req) {
|
|
|
+ list($yanlingUid) = $req->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
+ $user = $req->userInfo->game;
|
|
|
+ my_Assert(property_exists($user->store->yanling, $yanlingUid), "找不到这个言灵");
|
|
|
+ $yanlingObj = $user->store->yanling->$yanlingUid;
|
|
|
+ $yanlingMoId = $yanlingObj->typeId;
|
|
|
+ $curGrade = property_exists($yanlingObj, "grade") ? $yanlingObj->grade : 1; # 当前等阶
|
|
|
+ $toGrade = $curGrade + 1; # 下一等阶
|
|
|
+ my_Assert($toGrade <= 5, ErrCode::store_yanlingGrade_max); # 已经进阶到最高
|
|
|
+ $toGradeCfg = GameConfig::yanling_upgrade_getItem($yanlingMoId, $toGrade); # 下一阶配置
|
|
|
+ my_Assert(null != $toGradeCfg, ErrCode::err_const_no); # 找不到言灵进阶常量
|
|
|
+ $costs = explode(';', $toGradeCfg->cost_materials);
|
|
|
+ my_Assert(count($costs) > 0, ErrCode::store_yanlingGrade_cfg); # 言灵进阶数据有误
|
|
|
+ foreach ($costs as $c) {
|
|
|
+ list($itemId, $num) = explode(',', $c); # 解析材料
|
|
|
+ $err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
|
|
|
+ my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
|
|
|
+ }
|
|
|
+ $yanlingObj->grade = $toGrade; # 修改进阶
|
|
|
+ $user->store->yanling->$yanlingUid = $yanlingObj; # 回写言灵数据
|
|
|
+ UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "store" => $req->userInfo->game->store, # # 目前来看只涉及到items变化
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* [6418] 利用言灵召唤书碎片合成召唤书
|
|
|
* @param req $req
|
|
@@ -87,11 +119,6 @@ class StoreProc {
|
|
|
* @param req $req
|
|
|
*/
|
|
|
static function CallYanlingByBook($req) {
|
|
|
- // 参数: 言灵id
|
|
|
- // 扣除并检查召唤书数量
|
|
|
- // 扣除并检查消耗材料数量
|
|
|
- // 添加言灵
|
|
|
- // 返回 新的store->item数据
|
|
|
list($bookId) = $req->paras; # 参数 利用的言灵召唤书id
|
|
|
$user = $req->userInfo->game;
|
|
|
$bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
|
|
@@ -101,13 +128,11 @@ class StoreProc {
|
|
|
$costs = explode(';', $bookIdCfg->cost_materials);
|
|
|
my_Assert(count($costs) > 0, ErrCode::store_book_info); # 召唤书数据有误
|
|
|
foreach ($costs as $c) {
|
|
|
- list($itemId, $num) = explode(',', $c); # 消耗材料
|
|
|
+ list($itemId, $num) = explode(',', $c); # 解析材料
|
|
|
$err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
|
|
|
my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
|
|
|
}
|
|
|
-// var_dump($req->userInfo->game->store->items);
|
|
|
- self::PutYanLingInStore($bookIdCfg->yanling_id, $req); # 添加言灵
|
|
|
-// var_dump($req->userInfo->game->store->items);
|
|
|
+ self::PutYanLingInStore($bookIdCfg->yanling_id, $req); # 添加言灵
|
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
|
return Resp::ok(array(
|
|
|
"store" => $req->userInfo->game->store, # # 目前来看只涉及到items变化
|