Pārlūkot izejas kodu

宝石合成加校验

cyzhao 1 gadu atpakaļ
vecāks
revīzija
230ca46b5d

+ 1 - 1
Gameserver/App/base/ErrCode.php

@@ -382,7 +382,7 @@ class ErrCode {
     const user_store_SameGemCanotEquip= 3305;
     
     /**
-     * 前端给的宝石合成数量对不上
+     * 前端给的宝石存在不能合成的宝石
      */
     const user_store_GemCanotCompose = 3306;
 // </editor-fold>

+ 18 - 2
Gameserver/App/process/StoreProc.php

@@ -240,18 +240,34 @@ class StoreProc {
         krsort($list);             
         
         foreach ($list as $str) {
-            $gemUidList = explode(',', $str);
+            $gemUidList = explode(',', $str);                      
             $firstGemUId = $gemUidList[0];
             $qual = 0;
             $posId = 0;
-            if(StlUtil::dictHasProperty($user->store->gemStore, $gemUidList[0])){
+            if(StlUtil::dictHasProperty($user->store->gemStore, $firstGemUId)){
                 $ins_gem = $user->store->gemStore->$firstGemUId;
                 $mo = GameConfig::gem_getItem($ins_gem->typeId);
                 $qual = $mo->qual;
                 $posId = $mo->position;
             }    
+            $isCompose = true;
+            //在做一次校验
+            foreach ($gemUidList as $uid) {
+                if(StlUtil::dictHasProperty($user->store->gemStore, $uid)){
+                    $ins_gem = $user->store->gemStore->$uid;
+                    $mo = GameConfig::gem_getItem($ins_gem->typeId);
+                    
+                    if($mo->qual != $qual || $mo->position != $posId){
+                        $isCompose = false;
+                        break;
+                    }                                      
+                }  
+            }
+            my_Assert($isCompose == true, ErrCode::user_store_GemCanotCompose);
+            
             //查找要合成的宝石配置信息
             $gemConf = self::GemComposeSynthesis($qual, $posId);
+            my_Assert($gemConf != null, ErrCode::err_const_no);
             $synthesisList = explode('_', $gemConf->synthesis);
             $composePosition = $synthesisList[0];
             $composeQual = $synthesisList[1];