Explorar el Código

装备降级降品

cyzhao hace 6 meses
padre
commit
0d01ca867a

+ 10 - 0
Gameserver/App/base/CmdCode.php

@@ -296,6 +296,16 @@ class CmdCode {
      */
     const store_equip_OnekeyCompose = 6418;
     
+    /**
+     * 降级
+     */
+    const store_equip_downGradingLevel = 6419;
+
+    /**
+     * 降品
+     */
+    const store_equip_downGradingQual = 6420;
+    
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="商城操作码 - 65xx">
 

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

@@ -501,6 +501,16 @@ class ErrCode {
      * 装备材料数量错误
      */
     const user_store_equipMaterialNumErr = 3315; 
+    
+    /**
+     * 装备已经在最低等级
+     */
+    const user_store_equip_minlevel = 3316; 
+    
+    /**
+     * 装备已经在最低品阶
+     */
+    const user_store_equip_minQual = 3317; 
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 16:04:13
+ // 日期: 2024-11-11 17:21:24
 ////////////////////
 
 /**

+ 1 - 1
Gameserver/App/model/Const/sm_equip.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-05 10:55:37
+ // 日期: 2024-11-11 15:10:25
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_equip_position.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-25 16:35:48
+ // 日期: 2024-11-11 11:05:53
 ////////////////////
 
 

+ 6 - 1
Gameserver/App/model/Const/sm_globalsettings.php

@@ -24,7 +24,7 @@ class sm_globalsettings
     public $equipLeveUpTuzhi;
 
     /**
-    * @var String [废弃]  
+    * @var String   
     */
     public $equipQualUnlockSkillId;
 
@@ -318,5 +318,10 @@ class sm_globalsettings
     */
     public $MailData_RemainSeconds;
 
+    /**
+    * @var String 不能降品的品阶  
+    */
+    public $equipQual_NotDownGrading;
+
 }
 

+ 1 - 1
Gameserver/App/model/Const/sm_hero.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 15:35:53
+ // 日期: 2024-11-11 17:05:53
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_heroType_typeId.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 15:35:53
+ // 日期: 2024-11-11 17:05:53
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_item.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-07 16:35:53
+ // 日期: 2024-11-11 15:33:17
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_skills.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 15:08:29
+ // 日期: 2024-11-11 11:35:53
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_waveItem.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 16:04:15
+ // 日期: 2024-11-11 17:01:00
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_waves.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-08 16:04:15
+ // 日期: 2024-11-11 17:01:00
 ////////////////////
 
 

+ 113 - 0
Gameserver/App/process/StoreProc.php

@@ -56,10 +56,122 @@ class StoreProc {
                 return StoreProc::Equip_Compose();
             case CmdCode::store_equip_OnekeyCompose:                            # 6418 装备一键合成
                 return StoreProc::Equip_OnekeyCompose();
+            case CmdCode::store_equip_downGradingLevel:                         # 6419 降级
+                return StoreProc::Equip_DownGradingLevel(); 
+            case CmdCode::store_equip_downGradingQual:                          # 6420 降品
+                return StoreProc::Equip_DownGradingQual();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6420 降品
+     */
+    public static function Equip_DownGradingQual() {
+        list($uid) = req()->paras;
+        
+        $equipDic = ctx()->store->equip;
+        my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
+        $ins_equip = new Ins_Equip($equipDic->$uid);
+        
+        $NotDownGradingList = explode(',', glc()->equipQual_NotDownGrading);       
+        my_Assert(!in_array($ins_equip->qual, $NotDownGradingList), ErrCode::user_store_equip_minQual);
+        
+        self::GoldTuzhi_Fallback_Level($ins_equip);
+        self::ComposeMaterial_Fallback($ins_equip->mo()->position,$ins_equip->qual);
+        
+        $ins_equip->level = 1;
+        $sList2 = explode(';',glc()->equipQualUnlockSkillId);
+        foreach ($sList2 as $str3)
+        {
+            $s = explode(',', $str3);
+            if (in_array($ins_equip->qual, $s))
+            {
+                $ins_equip->qual = $s[0];        
+                break;
+            }
+        }
+
+        ctx()->store->equip->$uid = $ins_equip;
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'store' => ctx()->store,
+        ));
+    }
+    
+    private static function ComposeMaterial_Fallback($posId,$qual) {
+        $sList2 = explode(';',glc()->equipQualUnlockSkillId); 
+        foreach ($sList2 as $str) {
+            $s = explode(',', $str);
+            if(in_array($qual, $s)){
+                $max = $qual;
+                $min = $s[0];
+                $num = 0;
+                for ($i = $min+1; $i <= $max; $i++) {
+                    $mo = GameConfig::equip_compose_getItem($i);
+                    $num += explode(',', $mo->compose_condition)[2];                                                       
+                }
+                
+                $typeId = self::ComposeMaterial($posId, $min);                
+                StoreProc::AddMultiItemInStore($typeId.','.$num);
+                break;
+            }
+            
+        }
+    }
+    
+    private static function ComposeMaterial($posId,$qual) {
+        $itemDic = GameConfig::item();
+        foreach ($itemDic as $typeId => $mo) {
+            if($mo->itemType == 901 && $typeId % 100 == $posId && floor($typeId/100)%100 == $qual){                               
+                return $typeId;
+            }
+        }
+                       
+        return null;           
+    }
+
+    
+    private static function GoldTuzhi_Fallback_Level($ins_equip){
+        $gold = 0;
+        $itemNum = 0;
+        for ($i = 1; $i < $ins_equip->level; $i++) {
+            $mo = GameConfig::equip_levelupgrade_getItem($ins_equip->mo()->rarity, $ins_equip->qual,$ins_equip->mo()->position,$ins_equip->level);
+            $gold += $mo->needGold;
+            $itemNum +=$mo->needItemNum;
+        }
+        
+        $tuzhiId = GameConfig::equip_position_getItem($ins_equip->mo()->position)->costTuzhiId;
+        StoreProc::AddMultiItemInStore($tuzhiId.','.$itemNum);
+        
+        ctx()->base(true)->Add_Gold($gold);
+    }
+
+
+    /*
+     * 6419 降级
+     */
+    public static function Equip_DownGradingLevel() {
+        list($uid) = req()->paras;//装备uid
+        
+        $equipDic = ctx()->store->equip;
+        my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
+        $ins_equip = new Ins_Equip($equipDic->$uid);
+        
+        my_Assert($ins_equip->level > 1, ErrCode::user_store_equip_minlevel);
+        self::GoldTuzhi_Fallback_Level($ins_equip);
+                
+        $ins_equip->level = 1;
+        ctx()->store->equip->$uid = $ins_equip;
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'store' => ctx()->store,
+        ));
+    }
 
     /**
      * 6417 装备合成
@@ -949,6 +1061,7 @@ class StoreProc {
                 case 501://人物碎片
                 case 601://人身果  
                 case 801://寻宝券  
+                case 901:    
                     self::PutItemsInStore($itemId, $num);
 //                    if ($itemMo->itemType == 100) {//图纸
 //                        self::checkEquipUpgradeTip();//废弃