|
@@ -32,8 +32,10 @@ class StoreProc {
|
|
|
return StoreProc::equipUpgrade();
|
|
|
case CmdCode::cmd_store_equipUpgrade_MaxLv: # 6405 一键升级(装备)
|
|
|
return StoreProc::equipUpgrade_MaxLv();
|
|
|
- case CmdCode::cmd_store_equipCompose: # 6406 装备合成(升阶/进化)
|
|
|
- return StoreProc::equipCompose();
|
|
|
+ case CmdCode::store_gemCompose: # 6406 宝石合成
|
|
|
+ return StoreProc::gemCompose();
|
|
|
+ case CmdCode::store_switchEquipPag: # 6408 切换装备分页
|
|
|
+ return StoreProc::switchEquipPag();
|
|
|
case CmdCode::store_equip_removeEquipUpgradeTip: # 6410 移除装备可以升级绿点提示
|
|
|
return StoreProc::removeEquipUpgradeTip();
|
|
|
case CmdCode::store_equip_removeNewGemTip: # 6411 移除是新宝石绿点提示
|
|
@@ -45,6 +47,21 @@ class StoreProc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 切换装备分页
|
|
|
+ * @return Resp
|
|
|
+ */
|
|
|
+ public static function switchEquipPag() {
|
|
|
+ list($index) = req()->paras;
|
|
|
+ $user = ctx();
|
|
|
+
|
|
|
+ $user->store->equipPag = $index;
|
|
|
+
|
|
|
+ ctx($user);
|
|
|
+ UserProc::updateUserInfo();
|
|
|
+ return Resp::ok(array());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @return type
|
|
@@ -95,7 +112,7 @@ class StoreProc {
|
|
|
* 6406 合成
|
|
|
* @return type
|
|
|
*/
|
|
|
- public static function equipCompose() {
|
|
|
+ public static function gemCompose() {
|
|
|
list($uid) = req()->paras;
|
|
|
$user = ctx();
|
|
|
|
|
@@ -107,33 +124,83 @@ class StoreProc {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 装备
|
|
|
+ * 装备宝石
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function gemSet() {
|
|
|
- list($uid) = req()->paras;
|
|
|
+ list($uid,$type,$replaceUId) = req()->paras;//宝石uid 手动的时候记得校验u
|
|
|
$user = ctx();
|
|
|
|
|
|
- my_Assert(StlUtil::dictHasProperty($user->store->equip, $uid), ErrCode::user_store_NoEquip);
|
|
|
-
|
|
|
- $mo = GameConfig::equip_getItem($user->store->equip->$uid->typeId);
|
|
|
- my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
- $posId = $mo->position;
|
|
|
-
|
|
|
- $heroId = $user->heros->CurrentHeroId;
|
|
|
-
|
|
|
- $user->store->equip->$uid->posId = $posId;
|
|
|
- if ($user->store->equipPosition->$posId > 0) {
|
|
|
- $oldUid = $user->store->equipPosition->$posId;
|
|
|
- $user->store->equip->$oldUid->posId = 0;
|
|
|
+ my_Assert(StlUtil::dictHasProperty($user->store->gemStore, $uid), ErrCode::user_store_NoItem);
|
|
|
+ $ins_gem = $user->store->gemStore->$uid;
|
|
|
+
|
|
|
+ $pag = $user->store->equipPag;
|
|
|
+ $posId = $ins_gem->mo()->position;
|
|
|
+ $dic = $user->store->gemEquip->$pag->$posId;
|
|
|
+
|
|
|
+ $tag_index = 0;
|
|
|
+ $tag_gem = null;
|
|
|
+ foreach ($dic as $index => $gem) {
|
|
|
+ if($gem->predicateMo()->uniqueKey == $ins_gem->predicateMo()->uniqueKey){
|
|
|
+ $tag_index = $index;
|
|
|
+ $tag_gem = $gem;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- $user->store->equipPosition->$posId = $uid;
|
|
|
+
|
|
|
+ switch ($type) {
|
|
|
+ case 1://镶嵌
|
|
|
+ my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
|
|
|
+ for ($i = 1; $i <=5; $i++) {
|
|
|
+ if(!StlUtil::dictHasProperty($dic, $i)){
|
|
|
+ $dic->$i = $ins_gem;
|
|
|
+ StlUtil::dictRemove($user->store->gemStore, $uid);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //$user->store->gemEquip->$pag->$posId = $dic;
|
|
|
+ break;
|
|
|
+ case 2://替换
|
|
|
+ //满不满都高替低品阶
|
|
|
+ my_Assert(StlUtil::dictHasProperty($dic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
+ $replace_ins_Gem = $dic->$replaceUId; //这个uid是5个坑位的index id
|
|
|
+ my_Assert($replace_ins_Gem->mo()->qual > $ins_gem->mo()->qual, ErrCode::user_store_NoExistGemReplace);
|
|
|
+ $id = $replace_ins_Gem->uid;
|
|
|
+ $user->store->gemStore->$id = $replace_ins_Gem;
|
|
|
+ $dic->$replaceUId = $ins_gem;
|
|
|
+ StlUtil::dictRemove($user->store->gemStore, $uid);
|
|
|
+ //$user->store->gemEquip->$pag->$posId = $dic;
|
|
|
+ break;
|
|
|
+ case 3://手动
|
|
|
+ my_Assert(count((array)$dic)>=5, ErrCode::user_store_GemCanotSet);
|
|
|
+ my_Assert(StlUtil::dictHasProperty($dic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
+ $replace_ins_Gem = $dic->$replaceUId;
|
|
|
+ $id = $replace_ins_Gem->uid;
|
|
|
+ if($tag_gem != null){//如果有u那
|
|
|
+ my_Assert($replace_ins_Gem->uid == $tag_gem->uid, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
|
|
|
+ //有U一样的,则点击正好是这个直接替换
|
|
|
+ $user->store->gemStore->$id = $replace_ins_Gem;
|
|
|
+ $dic->$replaceUId = $ins_gem;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $user->store->gemStore->$id = $replace_ins_Gem;
|
|
|
+ $dic->$replaceUId = $ins_gem;
|
|
|
+ }
|
|
|
+ StlUtil::dictRemove($user->store->gemStore, $uid);
|
|
|
+ break;
|
|
|
+ case 4://不能
|
|
|
+ //1.小品阶替大品阶 或是 相等的,在不满的时候不允许 2. //满的 相等不允许替
|
|
|
+ my_Assert($uid == 0, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ $user->store->gemEquip->$pag->$posId = $dic;
|
|
|
|
|
|
ctx($user);
|
|
|
UserProc::updateUserInfo();
|
|
|
- return Resp::ok(array(
|
|
|
- 'heros' => $user->heros,
|
|
|
+ return Resp::ok(array(
|
|
|
'store' => $user->store,));
|
|
|
}
|
|
|
|
|
@@ -142,19 +209,35 @@ class StoreProc {
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function gemRemove() {
|
|
|
- list($posId) = req()->paras;
|
|
|
+ list($uid) = req()->paras;//装备宝石id
|
|
|
$user = ctx();
|
|
|
-
|
|
|
- $heroId = $user->heros->CurrentHeroId;
|
|
|
- if ($user->store->equipPosition->$posId > 0) {
|
|
|
- $oldUid = $user->store->equipPosition->$posId;
|
|
|
- $user->store->equip->$oldUid->posId = 0;
|
|
|
- $user->store->equipPosition->$posId = 0;
|
|
|
+
|
|
|
+ $pag = $user->store->equipPag;
|
|
|
+ $posDic = $user->store->gemEquip->$pag;
|
|
|
+
|
|
|
+ $tag_pos = 0;
|
|
|
+ $tag_index = 0;
|
|
|
+ $tag_gem = null;
|
|
|
+ foreach ($posDic as $posId => $dic) {
|
|
|
+ foreach ($dic as $index => $gem) {
|
|
|
+ if($gem->uid == $uid){
|
|
|
+ $tag_pos = $posId;
|
|
|
+ $tag_index = $index;
|
|
|
+ $tag_gem = $gem;
|
|
|
+ break 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if($tag_index >0 && $tag_gem != null){
|
|
|
+ StlUtil::dictRemove($posDic->$tag_pos, $tag_index);
|
|
|
+
|
|
|
+ $user->store->gemEquip->$pag = $posDic;
|
|
|
+ $user->store->gemStore->$uid = $tag_gem;
|
|
|
+ }
|
|
|
+ ctx($user);
|
|
|
UserProc::updateUserInfo();
|
|
|
- return Resp::ok(array(
|
|
|
- 'heros' => $user->heros,
|
|
|
+ return Resp::ok(array(
|
|
|
'store' => $user->store,));
|
|
|
}
|
|
|
|
|
@@ -163,31 +246,22 @@ class StoreProc {
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function equipUpgrade() {
|
|
|
- list($uid) = req()->paras; //mask = 1:表示战斗中掉落
|
|
|
+ list($posId) = req()->paras; //装备的部位id
|
|
|
$user = ctx();
|
|
|
-
|
|
|
- $lv = $user->store->equip->$uid->level;
|
|
|
- $Mo = GameConfig::equip_levelupgrade_getItem($lv + 1);
|
|
|
- my_Assert($user->baseInfo->gold >= $Mo->needGold, ErrCode::notenough_gold_msg);
|
|
|
-
|
|
|
- $position = GameConfig::equip_getItem($user->store->equip->$uid->typeId)->position; //图纸
|
|
|
- $typeId = 0;
|
|
|
- $strArr = explode(';', GameConfig::globalsettings()->equipLeveUpTuzhi);
|
|
|
- foreach ($strArr as $str) {
|
|
|
- $list = explode(',', $str);
|
|
|
- if ($list[0] == $position) {
|
|
|
- $typeId = $list[1];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $num = $Mo->needItemNum;
|
|
|
- my_Assert(StlUtil::dictHasProperty($user->store->items, $typeId) && $user->store->items->$typeId >= $num, ErrCode::notenough_item);
|
|
|
- $user->store->removeItem($typeId, $num);
|
|
|
-
|
|
|
- $user->store->equip->$uid->level += 1;
|
|
|
- ctx()->baseInfo->Consume_Gold($Mo->needGold);
|
|
|
+
|
|
|
+ $lv = $user->store->equip->$posId->level;
|
|
|
+ $mo = GameConfig::equip_levelupgrade_getItem($lv);
|
|
|
+ my_Assert($user->baseInfo->gold >= $mo->needGold, ErrCode::notenough_gold_msg);
|
|
|
+ $costTuzhiId = GameConfig::equip_getItem($posId)->costTuzhiId;
|
|
|
|
|
|
+ $tuzhiNum = 0;
|
|
|
+ if(StlUtil::dictHasProperty($user->store->items, $costTuzhiId)){
|
|
|
+ $tuzhiNum = $user->store->items->$costTuzhiId;
|
|
|
+ }
|
|
|
+ my_Assert($tuzhiNum>= $mo->needItemNum, ErrCode::notenough_item);
|
|
|
+ $user->store->removeItem($costTuzhiId, $mo->needItemNum);
|
|
|
+ ctx()->baseInfo->Consume_Gold($mo->needGold);
|
|
|
+
|
|
|
ctx($user);
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array(
|
|
@@ -196,11 +270,11 @@ class StoreProc {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 装备一键升级
|
|
|
+ * 单个装备部位一键升级
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function equipUpgrade_MaxLv() {
|
|
|
- list($uid) = req()->paras; //mask = 1:表示战斗中掉落
|
|
|
+ list($posId) = req()->paras; //mask = 1:表示战斗中掉落
|
|
|
$user = ctx();
|
|
|
|
|
|
$equip = $user->store->equip->$uid;
|