Преглед на файлове

装备合成添加参数

cyzhao преди 6 месеца
родител
ревизия
bd1a7f46d5
променени са 2 файла, в които са добавени 50 реда и са изтрити 19 реда
  1. 5 0
      Gameserver/App/base/ErrCode.php
  2. 45 19
      Gameserver/App/process/StoreProc.php

+ 5 - 0
Gameserver/App/base/ErrCode.php

@@ -511,6 +511,11 @@ class ErrCode {
      * 装备已经在最低品阶
      * 装备已经在最低品阶
      */
      */
     const user_store_equip_minQual = 3317; 
     const user_store_equip_minQual = 3317; 
+    
+    /**
+     * 装备合成材料不能参与此次合成
+     */
+    const user_store_equip_composeMaterialErr = 3318; 
 // </editor-fold>
 // </editor-fold>
 //
 //
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">

+ 45 - 19
Gameserver/App/process/StoreProc.php

@@ -174,7 +174,7 @@ class StoreProc {
      * @return type
      * @return type
      */
      */
     public static function Equip_Compose() {
     public static function Equip_Compose() {
-        list($uid, $equipUids_cost) = req()->paras;
+        list($uid, $equipUids_cost, $composeMaterial_typeIds) = req()->paras;
 
 
         $equipDic = ctx()->store->equip;
         $equipDic = ctx()->store->equip;
         my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
         my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
@@ -187,29 +187,55 @@ class StoreProc {
         $type = $arr[0];
         $type = $arr[0];
         $costQual = $arr[1];
         $costQual = $arr[1];
         $num = $arr[2];
         $num = $arr[2];
-        $costEquipsArr = explode(',', $equipUids_cost);
-        my_Assert(count($costEquipsArr) == $num, ErrCode::user_store_equipMaterialNumErr);
-        foreach ($costEquipsArr as $eqUid) {
-            my_Assert(StlUtil::dictHasProperty($equipDic, $eqUid), ErrCode::user_store_NotExistEquip);
-
-            $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
-            my_Assert($costIns_Equip->qual == $costQual, ErrCode::user_store_equipMaterialQualErr);
-            if ($type == 1) {//本体                
-                my_Assert($costIns_Equip->typeId == $ins_equip->typeId, ErrCode::user_store_equipMaterialTypeErr);
-            } else {
-                my_Assert($costIns_Equip->mo()->position == $ins_equip->mo()->position, ErrCode::user_store_equipMaterialTypeErr);
+
+        $all_num = 0;
+        
+        $materialItemType = 0;
+        $materialItemNum = 0;
+        if ($type == 2 && $composeMaterial_typeIds != null) {//部位去校验
+            $str = explode(',', $composeMaterial_typeIds);
+            $materialItemType = $str[0];
+            $materialItemNum = count($str);
+            foreach ($str as $s) {
+                $composeMaterial_itemTypeId = self::ComposeMaterial($ins_equip->mo()->position, $costQual);
+                my_Assert($composeMaterial_itemTypeId == $s, ErrCode::user_store_equip_composeMaterialErr);
+                $all_num += 1;
             }
             }
         }
         }
 
 
-        ctx()->store(true)->equip->$uid = self::ComposeNewEquip($ins_equip);
+        if ($equipUids_cost != null) {
+            $costEquipsArr = explode(',', $equipUids_cost);
+            $all_num += count($costEquipsArr);
+
+            foreach ($costEquipsArr as $eqUid) {
+                my_Assert(StlUtil::dictHasProperty($equipDic, $eqUid), ErrCode::user_store_NotExistEquip);
 
 
-        //消耗的装备 回收             
-        foreach ($costEquipsArr as $eqUid) {
-            $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
-            self::equipLevelUp_Material_Recovery($costIns_Equip->mo()->rarity, $costIns_Equip->qual, $costIns_Equip->mo()->position, $costIns_Equip->level);
-            StlUtil::dictRemove(ctx()->store(true)->equip, $eqUid);
+                $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
+                my_Assert($costIns_Equip->qual == $costQual, ErrCode::user_store_equipMaterialQualErr);
+                if ($type == 1) {//本体                
+                    my_Assert($costIns_Equip->typeId == $ins_equip->typeId, ErrCode::user_store_equipMaterialTypeErr);
+                } else {
+                    my_Assert($costIns_Equip->mo()->position == $ins_equip->mo()->position, ErrCode::user_store_equipMaterialTypeErr);
+                }
+            }
         }
         }
+        my_Assert($all_num == $num, ErrCode::user_store_equipMaterialNumErr);
+        ctx()->store(true)->equip->$uid = self::ComposeNewEquip($ins_equip);
 
 
+        //消耗的装备 回收         
+        if ($equipUids_cost != null) {
+            $costEquipsArr = explode(',', $equipUids_cost);
+            foreach ($costEquipsArr as $eqUid) {
+                $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
+                self::equipLevelUp_Material_Recovery($costIns_Equip->mo()->rarity, $costIns_Equip->qual, $costIns_Equip->mo()->position, $costIns_Equip->level);
+                StlUtil::dictRemove(ctx()->store(true)->equip, $eqUid);
+            }
+        }
+        
+        if($materialItemType != 0){
+            ctx()->store(true)->removeItem($materialItemType, $materialItemNum);
+        }
+       
         UserProc::updateUserInfo();
         UserProc::updateUserInfo();
         return Resp::ok(array(
         return Resp::ok(array(
                     'gold' => ctx()->baseInfo->gold,
                     'gold' => ctx()->baseInfo->gold,
@@ -1079,7 +1105,7 @@ class StoreProc {
                         ctx()->store(true)->equip->$uid = $equip;
                         ctx()->store(true)->equip->$uid = $equip;
                         self::$reward_equip[] = $uid;
                         self::$reward_equip[] = $uid;
                     }
                     }
-                    
+
                     break;
                     break;
                 case 701://道具宝箱
                 case 701://道具宝箱
                     for ($i = 0; $i < $num; $i++) {
                     for ($i = 0; $i < $num; $i++) {