|
@@ -508,7 +508,7 @@ class StoreProc {
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function Gem_BuySlot() {
|
|
|
- list($uid) = req()->paras;
|
|
|
+ list($uid,$slotId) = req()->paras;
|
|
|
|
|
|
$equipDic = ctx()->store->equip;
|
|
|
my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
|
|
@@ -519,16 +519,29 @@ class StoreProc {
|
|
|
$initNum = $mo->initNum_slot;
|
|
|
$buyNum = $mo->buyNum_slot;
|
|
|
|
|
|
+ $maxMo = GameConfig::gem_slotposition_getItem(16);
|
|
|
+// $unlockIndex = 0;
|
|
|
+// if ($buyNum > 0) {
|
|
|
+// for ($i = $initNum + 1; $i <= $initNum + $buyNum; $i++) {
|
|
|
+// if ($slotId == $i && !StlUtil::dictHasProperty($ins_equip->gemSetSlot, $i)) {
|
|
|
+// $ins_equip->gemSetSlot->$i = 0;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// $unlockIndex += 1;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
$unlockIndex = 0;
|
|
|
if ($buyNum > 0) {
|
|
|
- for ($i = $initNum + 1; $i <= $initNum + $buyNum; $i++) {
|
|
|
- if (!StlUtil::dictHasProperty($ins_equip->gemSetSlot, $i)) {
|
|
|
+ for ($i = 1; $i <= $maxMo->initNum_slot + $maxMo->buyNum_slot; $i++) {
|
|
|
+ if ($slotId == $i && $ins_equip->gemSetSlot->$i == 1) {
|
|
|
$ins_equip->gemSetSlot->$i = 0;
|
|
|
break;
|
|
|
}
|
|
|
$unlockIndex += 1;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
$costArr = explode(';', $mo->cost);
|
|
|
$cash = explode(',', $costArr[$unlockIndex]);
|
|
|
my_Assert(ctx()->base(true)->cash >= $cash[1], ErrCode::notenough_cash_msg);
|
|
@@ -951,17 +964,24 @@ class StoreProc {
|
|
|
case 1://镶嵌
|
|
|
my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
|
|
|
$go_index = 1;
|
|
|
- for ($i = 1; $i <= $mo->initNum_slot + $mo->buyNum_slot; $i++) {
|
|
|
- if (!StlUtil::dictHasProperty($gemSetSlotDic, $i)) {
|
|
|
- //$gemSetSlotDic->$i = $ins_gem;
|
|
|
- $go_index = $i;
|
|
|
- break;
|
|
|
- }
|
|
|
- if ($gemSetSlotDic->$i == 0) {
|
|
|
- $go_index = $i;
|
|
|
+ foreach ($gemSetSlotDic as $slotId => $gemUid) {
|
|
|
+ if($gemUid == 0){
|
|
|
+ $go_index = $slotId;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// for ($i = 1; $i <= $mo->initNum_slot + $mo->buyNum_slot; $i++) {
|
|
|
+// if (!StlUtil::dictHasProperty($gemSetSlotDic, $i)) {
|
|
|
+// //$gemSetSlotDic->$i = $ins_gem;
|
|
|
+// $go_index = $i;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// if ($gemSetSlotDic->$i == 0) {
|
|
|
+// $go_index = $i;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
$gemSetSlotDic->$go_index = $uid;
|
|
|
break;
|
|
|
case 2://替换
|
|
@@ -977,7 +997,7 @@ class StoreProc {
|
|
|
//my_Assert(count((array) $gemSetSlotDic) >= $mo->initNum_slot + $mo->buyNum_slot, ErrCode::user_store_GemCanotSet);
|
|
|
my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
$gUid = $gemSetSlotDic->$replaceUId;
|
|
|
- my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
+ //my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
$replace_ins_Gem = new Ins_Gem(ctx()->store->gemStore->$gUid);
|
|
|
//$id = $replace_ins_Gem->uid;
|
|
|
if ($tag_gem != null) {//如果有u那
|
|
@@ -1315,6 +1335,17 @@ class StoreProc {
|
|
|
$ins_equip->uid = $uid;
|
|
|
$ins_equip->typeId = $typeId;
|
|
|
$ins_equip->qual = GameConfig::equip_getItem($typeId)->qual;
|
|
|
+ $mo = GameConfig::gem_slotposition_getItem(16);
|
|
|
+ $initNum_slot = $mo->initNum_slot;
|
|
|
+ $dic = new \stdClass();
|
|
|
+ for ($i = 1; $i <= $initNum_slot; $i++) {
|
|
|
+ $dic->$i = 0;
|
|
|
+ }
|
|
|
+ for ($i = $initNum_slot +1; $i <= $initNum_slot+$mo->buyNum_slot; $i++) {
|
|
|
+ $dic->$i = 1;
|
|
|
+ }
|
|
|
+ $ins_equip->gemSetSlot = $dic;
|
|
|
+
|
|
|
return $ins_equip;
|
|
|
}
|
|
|
|