cyzhao преди 1 година
родител
ревизия
346b5900ff

+ 6 - 1
Gameserver/App/base/CmdCode.php

@@ -155,13 +155,18 @@ class CmdCode {
     /**
      * 合成
      */
-    const cmd_store_equipCompose = 6406;
+    const store_gemCompose = 6406;
     
     /**
      * 消耗体力
      */
     const store_comsumeTili = 6407;
     
+    /**
+     * 切换装备分页
+     */
+    const store_switchEquipPag = 6408;
+          
     /**
      * 移除装备可以升级的提示
      */

+ 14 - 4
Gameserver/App/base/ErrCode.php

@@ -362,14 +362,24 @@ class ErrCode {
     const user_store_NoEquip = 3301;
     
     /**
-     * 该装备降级
+     * 背包
      */
-    const user_store_equipNoFallLevel = 3302;
+    const user_store_NoItem = 3302;
     
     /**
-     * 
+     * 宝石不能被镶嵌
+     */
+    const user_store_GemCanotSet = 3303;
+    
+    /**
+     * 不存在可以替换的宝石
+     */
+    const user_store_NoExistGemReplace = 3304;
+    
+    /**
+     * 同一件装备无法镶嵌多个技能相同的宝石
      */
-    const user_store_equipNoFallQual = 3303;
+    const user_store_SameGemCanotEquip= 3305;
 // </editor-fold>
 //
     

+ 81 - 1
Gameserver/App/configs/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2023-10-12 15:15:03
+ // 日期: 2024-03-28 16:16:40
 ////////////////////
 
 namespace loyalsoft;
@@ -575,6 +575,86 @@ class GameConfig {
         return self::get_hash_item('task_accumulate_week', $itemid);
     }
     /**
+    * 宝石表
+    * @return \gem
+    */
+    public static function gem()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'gem');
+    }
+    /**
+    * @return \sm_gem gem item数据 
+    */
+    public static function gem_getItem($itemid)
+    { 
+        return self::get_hash_item('gem', $itemid);
+    }
+    /**
+    * 秘宝表
+    * @return \gate_sbox
+    */
+    public static function gate_sbox()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'gate_sbox');
+    }
+    /**
+    * @return \sm_gate_sbox gate_sbox itemArray 
+    */
+    public static function gate_sbox_getItemArray($key)
+    { 
+        return self::get_hash_item('gate_sbox', $key);
+    }
+    /**
+    * 最新的成就
+    * @return \achieve_new
+    */
+    public static function achieve_new()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'achieve_new');
+    }
+    /**
+    * @return \sm_achieve_new achieve_new item数据 
+    */
+    public static function achieve_new_getItem($itemid)
+    { 
+        return self::get_hash_item('achieve_new', $itemid);
+    }
+    /**
+    * 人物属性
+    * @return \heroattr
+    */
+    public static function heroattr()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'heroattr');
+    }
+    /**
+    * @return \sm_heroattr heroattr item数据 
+    */
+    public static function heroattr_getItem($itemid)
+    { 
+        return self::get_hash_item('heroattr', $itemid);
+    }
+    /**
+    * 剧情对话
+    * @return \plots
+    */
+    public static function plots()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'plots');
+    }
+    /**
+    * @return \sm_plots plots item数据 
+    */
+    public static function plots_getItem($itemid)
+    { 
+        return self::get_hash_item('plots', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

+ 5 - 5
Gameserver/App/model/User/Info_Store.php

@@ -17,31 +17,31 @@ class Info_Store extends Object_ext {
 
     /**
      * 道具
-     * @var type
+     * @var \stdClass()
      */
     public $items;
     
     /**
      * 宝石背包
-     * @var type
+     * \stdClass() 
      */
     public $gemStore;
     
     /**
      * 装备界面默认页
-     * @var type
+     * @var int
      */
     public $equipPag =1;
 
     /**
      * 装备
-     * @var type
+     * @var \stdClass()
      */
     public $equip;
     
     /**
      * 宝石装备的信息
-     * @var type
+     * @var \stdClass()
      */
     public $gemEquip;
 

+ 28 - 1
Gameserver/App/model/User/Ins_Gem.php

@@ -18,7 +18,13 @@ class Ins_Gem {
      * 索引id
      * @var type
      */
-    public $id = 0;
+    public $uid = 0;
+    
+    /**
+     * 配置表id
+     * @var type
+     */
+    public $typeId = 0;
 
     /**
      * 词条
@@ -37,4 +43,25 @@ class Ins_Gem {
      * @var type
      */
     public $isNew = 0;
+    
+    /**
+     * 配置
+     * @return sm_gem
+     */
+    public function mo() {
+        $mo = GameConfig::gem_getItem($this->typeId);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
+    
+    /**
+     * 
+     * @return sm_predicate
+     */
+    public function predicateMo() {
+        $mo = GameConfig::gem_getItem($this->predicateId);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
+    
 }

+ 130 - 56
Gameserver/App/process/StoreProc.php

@@ -32,8 +32,10 @@ class StoreProc {
                 return StoreProc::equipUpgrade();
             case CmdCode::cmd_store_equipUpgrade_MaxLv:                         # 6405 一键升级(装备)
                 return StoreProc::equipUpgrade_MaxLv();
-            case CmdCode::cmd_store_equipCompose:                               # 6406 装备合成(升阶/进化)
-                return StoreProc::equipCompose(); 
+            case CmdCode::store_gemCompose:                                     # 6406 宝石合成
+                return StoreProc::gemCompose(); 
+            case CmdCode::store_switchEquipPag:                                 # 6408 切换装备分页
+                return StoreProc::switchEquipPag();
             case CmdCode::store_equip_removeEquipUpgradeTip:                    # 6410 移除装备可以升级绿点提示
                 return StoreProc::removeEquipUpgradeTip();       
             case CmdCode::store_equip_removeNewGemTip:                          # 6411 移除是新宝石绿点提示
@@ -45,6 +47,21 @@ class StoreProc {
         }
     }  
     
+    /**
+     * 切换装备分页
+     * @return Resp
+     */
+    public static function switchEquipPag() {
+        list($index) = req()->paras;
+        $user = ctx();
+        
+        $user->store->equipPag = $index;
+       
+        ctx($user);
+        UserProc::updateUserInfo();
+        return Resp::ok(array());
+    }
+    
     /**
      * 
      * @return type
@@ -95,7 +112,7 @@ class StoreProc {
      * 6406 合成
      * @return type
      */
-    public static function equipCompose() {
+    public static function gemCompose() {
         list($uid) = req()->paras;
         $user = ctx();
 
@@ -107,33 +124,83 @@ class StoreProc {
     }
 
     /**
-     * 装备
+     * 装备宝石
      * @return type
      */
     public static function gemSet() {
-        list($uid) = req()->paras;
+        list($uid,$type,$replaceUId) = req()->paras;//宝石uid  手动的时候记得校验u            
         $user = ctx();
 
-        my_Assert(StlUtil::dictHasProperty($user->store->equip, $uid), ErrCode::user_store_NoEquip);
-
-        $mo = GameConfig::equip_getItem($user->store->equip->$uid->typeId);
-        my_Assert($mo != null, ErrCode::err_const_no);
-        $posId = $mo->position;
-
-        $heroId = $user->heros->CurrentHeroId;
-
-        $user->store->equip->$uid->posId = $posId;
-        if ($user->store->equipPosition->$posId > 0) {
-            $oldUid = $user->store->equipPosition->$posId;
-            $user->store->equip->$oldUid->posId = 0;
+        my_Assert(StlUtil::dictHasProperty($user->store->gemStore, $uid), ErrCode::user_store_NoItem);
+        $ins_gem = $user->store->gemStore->$uid;
+        
+        $pag = $user->store->equipPag;
+        $posId = $ins_gem->mo()->position;
+        $dic = $user->store->gemEquip->$pag->$posId;    
+        
+        $tag_index = 0;
+        $tag_gem = null;
+        foreach ($dic as $index => $gem) {
+            if($gem->predicateMo()->uniqueKey == $ins_gem->predicateMo()->uniqueKey){                    
+                $tag_index = $index;
+                $tag_gem = $gem;
+                break;
+            }
         }
-
-        $user->store->equipPosition->$posId = $uid;
+             
+        switch ($type) {
+            case 1://镶嵌                
+                my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
+                for ($i = 1; $i <=5; $i++) {
+                    if(!StlUtil::dictHasProperty($dic, $i)){
+                        $dic->$i = $ins_gem;                       
+                        StlUtil::dictRemove($user->store->gemStore, $uid);
+                        break;
+                    }
+                }
+                //$user->store->gemEquip->$pag->$posId = $dic;
+                break;
+            case 2://替换
+                //满不满都高替低品阶
+                my_Assert(StlUtil::dictHasProperty($dic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
+                $replace_ins_Gem = $dic->$replaceUId; //这个uid是5个坑位的index id
+                my_Assert($replace_ins_Gem->mo()->qual > $ins_gem->mo()->qual, ErrCode::user_store_NoExistGemReplace);
+                $id = $replace_ins_Gem->uid;
+                $user->store->gemStore->$id = $replace_ins_Gem;
+                $dic->$replaceUId = $ins_gem;
+                StlUtil::dictRemove($user->store->gemStore, $uid);
+                //$user->store->gemEquip->$pag->$posId = $dic;
+                break;
+            case 3://手动
+                my_Assert(count((array)$dic)>=5, ErrCode::user_store_GemCanotSet);                
+                my_Assert(StlUtil::dictHasProperty($dic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
+                $replace_ins_Gem = $dic->$replaceUId;
+                $id = $replace_ins_Gem->uid;
+                if($tag_gem != null){//如果有u那
+                    my_Assert($replace_ins_Gem->uid == $tag_gem->uid, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
+                    //有U一样的,则点击正好是这个直接替换                  
+                    $user->store->gemStore->$id = $replace_ins_Gem;
+                    $dic->$replaceUId = $ins_gem;  
+                   
+                } else {
+                    $user->store->gemStore->$id = $replace_ins_Gem;
+                    $dic->$replaceUId = $ins_gem;   
+                }                
+                StlUtil::dictRemove($user->store->gemStore, $uid);
+                break;
+            case 4://不能
+                //1.小品阶替大品阶  或是  相等的,在不满的时候不允许    2. //满的  相等不允许替                      
+                my_Assert($uid == 0, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
+                break;
+            default:
+                break;
+        }
+        
+        $user->store->gemEquip->$pag->$posId = $dic;        
 
         ctx($user);
         UserProc::updateUserInfo();
-        return Resp::ok(array(
-                    'heros' => $user->heros,
+        return Resp::ok(array(                 
                     'store' => $user->store,));
     }
 
@@ -142,19 +209,35 @@ class StoreProc {
      * @return type
      */
     public static function gemRemove() {
-        list($posId) = req()->paras;
+        list($uid) = req()->paras;//装备宝石id
         $user = ctx();
-
-        $heroId = $user->heros->CurrentHeroId;
-        if ($user->store->equipPosition->$posId > 0) {
-            $oldUid = $user->store->equipPosition->$posId;
-            $user->store->equip->$oldUid->posId = 0;
-            $user->store->equipPosition->$posId = 0;
+        
+        $pag = $user->store->equipPag;
+        $posDic = $user->store->gemEquip->$pag;
+      
+        $tag_pos = 0;
+        $tag_index = 0;
+        $tag_gem = null;
+        foreach ($posDic as $posId => $dic) {
+            foreach ($dic as $index => $gem) {
+                if($gem->uid == $uid){       
+                    $tag_pos = $posId;
+                    $tag_index = $index;
+                    $tag_gem = $gem;
+                    break 2;
+                }
+            }           
         }
-
+        
+        if($tag_index >0 && $tag_gem != null){          
+            StlUtil::dictRemove($posDic->$tag_pos, $tag_index);
+            
+            $user->store->gemEquip->$pag = $posDic;
+            $user->store->gemStore->$uid = $tag_gem;
+        }
+        ctx($user);
         UserProc::updateUserInfo();
-        return Resp::ok(array(
-                    'heros' => $user->heros,
+        return Resp::ok(array(                   
                     'store' => $user->store,));
     }
 
@@ -163,31 +246,22 @@ class StoreProc {
      * @return type
      */
     public static function equipUpgrade() {
-        list($uid) = req()->paras; //mask = 1:表示战斗中掉落
+        list($posId) = req()->paras; //装备的部位id
         $user = ctx();
-
-        $lv = $user->store->equip->$uid->level;
-        $Mo = GameConfig::equip_levelupgrade_getItem($lv + 1);
-        my_Assert($user->baseInfo->gold >= $Mo->needGold, ErrCode::notenough_gold_msg);
-
-        $position = GameConfig::equip_getItem($user->store->equip->$uid->typeId)->position; //图纸
-        $typeId = 0;
-        $strArr = explode(';', GameConfig::globalsettings()->equipLeveUpTuzhi);
-        foreach ($strArr as $str) {
-            $list = explode(',', $str);
-            if ($list[0] == $position) {
-                $typeId = $list[1];
-                break;
-            }
-        }
-        
-        $num = $Mo->needItemNum;
-        my_Assert(StlUtil::dictHasProperty($user->store->items, $typeId) && $user->store->items->$typeId >= $num, ErrCode::notenough_item);
-        $user->store->removeItem($typeId, $num);
-
-        $user->store->equip->$uid->level += 1;
-        ctx()->baseInfo->Consume_Gold($Mo->needGold);
+               
+        $lv = $user->store->equip->$posId->level;
+        $mo = GameConfig::equip_levelupgrade_getItem($lv);
+        my_Assert($user->baseInfo->gold >= $mo->needGold, ErrCode::notenough_gold_msg);
+        $costTuzhiId = GameConfig::equip_getItem($posId)->costTuzhiId;
         
+        $tuzhiNum = 0;
+        if(StlUtil::dictHasProperty($user->store->items, $costTuzhiId)){
+            $tuzhiNum = $user->store->items->$costTuzhiId;
+        }    
+        my_Assert($tuzhiNum>= $mo->needItemNum, ErrCode::notenough_item);
+        $user->store->removeItem($costTuzhiId, $mo->needItemNum);
+        ctx()->baseInfo->Consume_Gold($mo->needGold);
+                          
         ctx($user);
         UserProc::updateUserInfo();
         return Resp::ok(array(
@@ -196,11 +270,11 @@ class StoreProc {
     }
 
     /**
-     * 装备一键升级
+     * 单个装备部位一键升级
      * @return type
      */
     public static function equipUpgrade_MaxLv() {
-        list($uid) = req()->paras; //mask = 1:表示战斗中掉落
+        list($posId) = req()->paras; //mask = 1:表示战斗中掉落
         $user = ctx();
 
         $equip = $user->store->equip->$uid;