Kaynağa Gözat

宝石开锁bug修复

cyzhao 2 gün önce
ebeveyn
işleme
017a5132a7

+ 1 - 1
Gameserver/App/process/FightPower_Calculate.php

@@ -71,7 +71,7 @@ class FightPower_Calculate {
             //宝石
             if ($ins_Equip->qual >= 4 && $ins_Equip->gemSetSlot != null) {
                 foreach ($ins_Equip->gemSetSlot as $index => $gemUid) {
-                    if ($gemUid != 0) {
+                    if ($gemUid > 1) {
                         $gem_predicateId = ctx()->store->gemStore->$gemUid->predicateId;
                         self::predicateActionParamVal($gem_predicateId, $dic);
                     }

+ 43 - 12
Gameserver/App/process/StoreProc.php

@@ -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;
     }