|
@@ -37,9 +37,13 @@ class StoreProc {
|
|
|
//
|
|
|
case CmdCode::cmd_store_WearEquip: # 6410 给英雄穿装备
|
|
|
return StoreProc::WearEquipToHero($req);
|
|
|
- case CmdCode::cmd_store_UnWield: # 6411 将该装备从指定英雄上脱下
|
|
|
+ case CmdCode::cmd_store_UnWieldEquip: # 6411 将该装备从指定英雄上脱下
|
|
|
return StoreProc::UnWieldEquip($req);
|
|
|
-//
|
|
|
+ case CmdCode::cmd_store_WearYanling: # 6416 装备言灵
|
|
|
+ return StoreProc::WearYanlingToHero($req);
|
|
|
+ case CmdCode::cmd_store_UnWieldYanling: # 6417 卸下言灵
|
|
|
+ return StoreProc::UnWieldYanling($req);
|
|
|
+//
|
|
|
case CmdCode::cmd_store_AddMaxPacketNum: # 6412 扩展包裹格子数量
|
|
|
return StoreProc::AddPacketNum($req);
|
|
|
case CmdCode::cmd_store_MeltEquip: # 6413 装备融合
|
|
@@ -801,15 +805,15 @@ class StoreProc {
|
|
|
*/
|
|
|
static function PutEquipInStore($itemId, &$req) {
|
|
|
$privateState = $req->userInfo->game->privateState;
|
|
|
- if (!CommUtil::isPropertyExists($privateState, "currentId")) {// 如果仓库中已经有这种元素,则其数目+1
|
|
|
+ if (!CommUtil::isPropertyExists($privateState, "currentId")) { // 如果仓库中已经有这种元素,则其数目+1
|
|
|
$req->userInfo->game->privateState->currentId = 1;
|
|
|
}
|
|
|
$cid = $req->userInfo->game->privateState->currentId++;
|
|
|
$equip = ObjectInit();
|
|
|
$equip->typeId = $itemId;
|
|
|
$req->userInfo->game->store->equipment->$cid = $equip;
|
|
|
-
|
|
|
- SystemProc::GetEquip($req->zoneid, $req->userInfo->game, $itemId); # 添加获得装备的消息
|
|
|
+ return $cid;
|
|
|
+// SystemProc::GetEquip($req->zoneid, $req->userInfo->game, $itemId); # 添加获得装备的消息
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -890,6 +894,74 @@ class StoreProc {
|
|
|
// self::checkActiveItem($req, $itemModel);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * [6417] 给英雄装上言灵
|
|
|
+ * @param req $req
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ static function WearYanlingToHero($req) {
|
|
|
+ $user = $req->userInfo->game; # user引用
|
|
|
+ list($itemtype, $yanling_uid, $herouid) = $req->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
|
|
|
+
|
|
|
+ if (!CommUtil::isPropertyExists($user->store->yanling, $yanling_uid)) { # 检测是否存在该言灵
|
|
|
+ Err(ErrCode::store_itemno_err);
|
|
|
+ }
|
|
|
+ $yanlingVo = $user->store->yanling->$yanling_uid; # 取言灵对象
|
|
|
+ if ($yanlingVo->herouid > 0 && $yanlingVo->herouid != $herouid) { # 检测该言灵是否装备到其他英雄身上
|
|
|
+ Err(ErrCode::store_equipWeared_err);
|
|
|
+ }
|
|
|
+ $collectHeros = $user->heros->collectHeros; # 英雄集合
|
|
|
+ if (!$collectHeros) { # 防御对象为空
|
|
|
+ Err(ErrCode::err_innerfault);
|
|
|
+ }
|
|
|
+ if (!CommUtil::isPropertyExists($collectHeros, $herouid)) { # 检查英雄是否存在
|
|
|
+ Err(ErrCode::hero_no);
|
|
|
+ }
|
|
|
+ $user->store->yanling->$yanling_uid->herouid = $herouid; # 言灵上添加反向引用, 避免查询时的循环
|
|
|
+
|
|
|
+ $collectHeros->$herouid->yanling->$itemtype->itemuid = $yanling_uid; # 英雄身上添加言灵记录
|
|
|
+
|
|
|
+ UserProc::updateUserInfo($req); # 5.回写数据
|
|
|
+ $ret = array('resp' => "succeed!");
|
|
|
+ $resp = Resp::ok($ret); // 返回
|
|
|
+// StoreProc::CheckItemNum($req);
|
|
|
+ return $resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * [6416] 给英雄卸下言灵
|
|
|
+ * @param req $req
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ static function UnWieldYanling($req) {
|
|
|
+ $user = $req->userInfo->game; # user引用
|
|
|
+ list($itemtype, $yanling_uid, $herouid) = $req->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
|
|
|
+
|
|
|
+ $collectHeros = $user->heros->collectHeros;
|
|
|
+ if (!$collectHeros) {
|
|
|
+ Err(ErrCode::err_innerfault);
|
|
|
+ }
|
|
|
+ if (!CommUtil::isPropertyExists($collectHeros, $herouid)) { # 检测是否存在拥有该装备的英雄
|
|
|
+ Err(ErrCode::hero_no);
|
|
|
+ }
|
|
|
+ if (!CommUtil::isPropertyExists($user->store->yanling, $yanling_uid)) { # 检测是否存在该装备
|
|
|
+ Err(ErrCode::store_itemno_err);
|
|
|
+ }
|
|
|
+ if ($user->store->yanling->$yanling_uid->herouid == $herouid) { # 取装备对象
|
|
|
+ $user->store->yanling->$yanling_uid->herouid = 0;
|
|
|
+ }
|
|
|
+ if ($collectHeros->$herouid->yanling->$itemtype->itemuid != $yanling_uid) {
|
|
|
+ Err(ErrCode::store_noequip_err);
|
|
|
+ }
|
|
|
+ $collectHeros->$herouid->equip->weapon->itemuid = 0; # 卸下
|
|
|
+
|
|
|
+ UserProc::updateUserInfo($req); # 回写数据
|
|
|
+ $ret = array('resp' => "succeed!");
|
|
|
+ $resp = Resp::ok($ret); // 返回
|
|
|
+// StoreProc::CheckItemNum($req);
|
|
|
+ return $resp;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* [6410] 给英雄穿装备
|
|
|
* @param req $req
|
|
@@ -897,15 +969,18 @@ class StoreProc {
|
|
|
*/
|
|
|
static function WearEquipToHero($req) {
|
|
|
$user = $req->userInfo->game; # user引用
|
|
|
- list($itemtype, $equipuid, $herouid) = $req->pars; # 提取参数: 装备类型, 装备的UID, 英雄的UID
|
|
|
+ list($itemtype, $equipuid, $herouid) = $req->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
|
|
|
|
|
|
|
|
|
if (!CommUtil::isPropertyExists($user->store->equipment, $equipuid)) { # 检测是否存在该装备
|
|
|
Err(ErrCode::store_itemno_err);
|
|
|
}
|
|
|
$equipVo = $user->store->equipment->$equipuid; # 取装备对象
|
|
|
- if ($equipVo->herouid > 0 && $equipVo->herouid != $herouid) { # 检测该装备是否装备到其他英雄身上
|
|
|
- Err(ErrCode::store_equipWeared_err);
|
|
|
+ if ($equipVo->herouid > 0) { # 检测该装备是否装备到其他英雄身上
|
|
|
+ if ($equipVo->herouid != $herouid) {
|
|
|
+ Err(ErrCode::store_equipWeared_err);
|
|
|
+ }
|
|
|
+ $user->store->equipment->$equipuid->herouid = 0; # 清理原来已经装备的言灵的反指向
|
|
|
}
|
|
|
$collectHeros = $user->heros->collectHeros;
|
|
|
if (!$collectHeros) { # 防御对象为空
|
|
@@ -946,7 +1021,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function UnWieldEquip($req) {
|
|
|
$user = $req->userInfo->game; # user引用
|
|
|
- list($itemtype, $equipuid, $herouid) = $req->pars; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
|
|
|
+ list($itemtype, $equipuid, $herouid) = $req->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
|
|
|
|
|
|
$collectHeros = $user->heros->collectHeros;
|
|
|
if (!$collectHeros) {
|