cyzhao пре 2 месеци
родитељ
комит
c8cecdfe77

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

@@ -367,6 +367,46 @@ class CmdCode {
      */
     const store_equip_downGradingQual = 6420;
     
+    /**
+     * 移除宠物上的新的标志
+     */
+    const store_pet_removeNewTip = 6421;
+
+    /**
+     * 出战/替换/上阵  6422 
+     */
+    const store_pet_changeFightPosition = 6422;
+    
+    /**
+     * 展示空闲灵宠  6423
+     */
+    const store_pet_selectShowPet = 6423;
+
+    /**
+     * 灵宠等级提升  6424
+     */
+    const store_pet_levelUpgrade = 6424;
+    
+    /**
+     * 宠物合成
+     */
+    const store_pet_compose = 6425;
+
+    /**
+     * 宠物一键合成
+     */
+    const store_pet_onekeyCompose = 6426;
+    
+    /**
+     * 宠物降级
+     */
+    const store_pet_downGradingLevel = 6427;
+
+    /**
+     *  宠物降品
+     */
+    const store_pet_downGradingQual = 6428;
+    
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="商城操作码 - 65xx">
 

+ 29 - 9
Gameserver/App/base/ErrCode.php

@@ -488,9 +488,9 @@ class ErrCode {
     const user_store_NoFindPredicate = 3309;
 
     /**
-     * 装备等级已经达到最大值
+     * 等级已经达到最大值
      */
-    const user_store_equipLevelLimit = 3310;
+    const user_store_LevelLimit = 3310;
 
     /**
      * 不存在该装备
@@ -503,39 +503,59 @@ class ErrCode {
     const user_store_PositionNotFit = 3312;
 
     /**
-     * 装备材料类型错误
+     * 合成材料类型错误
      */
     const user_store_equipMaterialTypeErr = 3313;
 
     /**
-     * 装备材料品阶错误
+     * 品阶错误
      */
     const user_store_equipMaterialQualErr = 3314;
 
     /**
-     * 装备材料数量错误
+     * 合成材料数量错误
      */
     const user_store_equipMaterialNumErr = 3315;
 
     /**
-     * 装备已经在最低等级
+     * 已经在最低等级
      */
     const user_store_equip_minlevel = 3316;
 
     /**
-     * 装备已经在最低品阶
+     * 已经在最低品阶
      */
     const user_store_equip_minQual = 3317;
 
     /**
-     * 装备合成材料不能参与此次合成
+     * 合成材料不能参与此次合成
      */
     const user_store_equip_composeMaterialErr = 3318;
     
     /**
-     * 该装备已达最高品阶
+     * 已达最高品阶
      */
     const user_store_equip_qualMaxLimit = 3319;
+    
+    /**
+     * 不存在该灵宠
+     */
+    const user_store_NotExistPet = 3320;
+
+    /**
+     * 该灵宠已被选择出战
+     */
+    const user_store_NotSelectPet_fight = 3321;
+    
+    /**
+     * 该灵宠已被选择助战
+     */
+    const user_store_NotSelectPet_supportfight = 3322;
+
+    /**
+     * 该区域最多展示8个灵宠
+     */
+    const user_store_ShowPetNumLimit = 3323;
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-13 10:56:43
+ // 日期: 2025-03-17 17:53:19
 ////////////////////
 
 namespace loyalsoft;
@@ -1256,6 +1256,22 @@ class GameConfig {
         return self::get_hash_item('pet_levelupgrade', "$rarity-$qual-$level");
     }
     /**
+    * 宠物合成表
+    * @return \pet_compose
+    */
+    public static function pet_compose()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'pet_compose');
+    }
+    /**
+    * @return \sm_pet_compose pet_compose item数据 
+    */
+    public static function pet_compose_getItem($itemid)
+    { 
+        return self::get_hash_item('pet_compose', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-13 10:56:43
+ // 日期: 2025-03-17 17:53:19
 ////////////////////
 
 /**
@@ -1254,6 +1254,22 @@ class GameConfig {
         return self::get_hash_item('pet_levelupgrade', "$rarity-$qual-$level");
     }
     /**
+    * 宠物合成表
+    * @return \pet_compose
+    */
+    public static function pet_compose()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'pet_compose');
+    }
+    /**
+    * @return \sm_pet_compose pet_compose item数据 
+    */
+    public static function pet_compose_getItem($itemid)
+    { 
+        return self::get_hash_item('pet_compose', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-06 15:02:47
+ // 日期: 2025-03-14 16:22:01
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-06 15:02:47
+ // 日期: 2025-03-14 16:22:01
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-06 14:52:01
+ // 日期: 2025-03-17 09:59:53
 ////////////////////
 
 
@@ -108,5 +108,10 @@ class sm_glc2
     */
     public $WorldBoss_gateId;
 
+    /**
+    * @var Int32 该区域最多展示8个灵宠  
+    */
+    public $Pet_MainShowPetList;
+
 }
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-13 10:00:53
+ // 日期: 2025-03-14 15:22:01
 ////////////////////
 
 

+ 34 - 0
Gameserver/App/model/Const/sm_pet_compose.php

@@ -0,0 +1,34 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2025-03-17 16:37:28
+////////////////////
+
+
+/**
+ * Static Model pet_compose 宠物合成表
+ */
+class sm_pet_compose
+{
+
+    /**
+    * @var Int32 自增  
+    */
+    public $id;
+
+    /**
+    * @var Int32 品阶  
+    */
+    public $qual;
+
+    /**
+    * @var String 合成需要的装备条件;1:本体类型  2:同部位类型(含合成材料)
+    *  品阶要求
+    *  数量  
+    */
+    public $compose_condition;
+
+}
+

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-03-13 10:07:50
+ // 日期: 2025-03-14 15:22:01
 ////////////////////
 
 

+ 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 
- // 日期: 2025-03-12 15:20:22
+ // 日期: 2025-03-17 17:39:47
 ////////////////////
 
 

+ 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 
- // 日期: 2025-03-12 15:20:22
+ // 日期: 2025-03-17 17:39:47
 ////////////////////
 
 

+ 28 - 2
Gameserver/App/model/User/Info_Store.php

@@ -74,7 +74,31 @@ class Info_Store extends Object_ext {
     /**
      * @var int current UID
      */
-    public $cuid = 10000;
+    public $cuid = 10000;   
+    
+    /**
+     *  宠物背包数据
+     */
+    public $pet;
+
+    /**
+     * 选中要在主界面显示的灵宠
+     */
+    #[ArrayType]
+    public $mainShowPetList = array();
+
+    /**
+     * 出战位置 宠物id
+     * @var type
+     */
+    public $petUid_fight_position = 0;
+
+    /**
+     * 助战
+     * @var type
+     */
+    public $petUids_supportFight_position;
+    
 
     public function initialize() {
         StoreProc::AddMultiItemInStore(glc()->Init_Packet_Items, "UsrInit");
@@ -82,11 +106,13 @@ class Info_Store extends Object_ext {
 
     public function __construct($arg = null) {
         if ($arg == null) {
+            $this->petUids_supportFight_position = new \stdClass();
+                       
             $this->items = new \stdClass();
             $this->gemStore = new \stdClass();
             $this->equip = new \stdClass();
             $this->equipLocation = new \stdClass();
-
+            $this->pet = new \stdClass();
             $this->equipPosition = new \stdClass();
             for ($i = 1; $i <= 6; $i++) {
                 $equip = new Ins_EquipPosition();

+ 92 - 0
Gameserver/App/model/User/Ins_Pet.php

@@ -0,0 +1,92 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Ins_Equip
+ *
+ * @author c'y'zhao
+ */
+class Ins_Pet extends Object_ext{
+    
+    /**
+     * 实例唯一编号
+     */
+    public $uid = 0;       
+    
+    /*
+     * 模板数据编号
+     */
+    public $typeId = 0;    
+    
+    /*
+     * 等级
+     */
+    public $level = 1;
+    
+    /**
+     * 品质
+     * @var type
+     */
+    public $qual;
+
+    /**
+     * 是否是新得到的 1:是的
+     * @var type
+     */
+    public $isNew = 1;
+
+
+    /**
+     * 构造函数
+     * @param type $args
+     */
+    public function __construct($args = null) {
+        if($args !=null){
+            parent::__construct($args);
+        } else {        
+        }                
+    }
+    
+    /**
+     * 配置
+     * @return sm_pet
+     */
+    public function mo() {
+        $mo = GameConfig::pet_getItem($this->typeId);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
+    
+    public function petLevelMo() {
+        $mo = GameConfig::pet_levelupgrade_getItem($this->mo()->rarity, $this->qual,$this->level);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
+    
+    
+    /*
+     * 装备最大等级
+     */
+    public function Pet_MaxLevel() {
+        $rarity = $this->mo()->rarity;
+        $qual = $this->qual;     
+        $dic = GameConfig::pet_levelupgrade();
+        $max = 0;
+        foreach ($dic as $str => $mo) {
+            if($mo->rarity == $rarity && $mo->qual == $qual){
+                if($mo->level > $max){
+                    $max = $mo->level;
+                }
+            }
+        }
+        return $max;
+    }
+    
+}

+ 4 - 3
Gameserver/App/process/EmailProc.php

@@ -596,9 +596,10 @@ class EmailProc {
 
 // <editor-fold defaultstate="collapsed" desc="   世界boss邮件 ">    
     
-    public static function SendWorldBossRewardMail($zoneid, $uid, $reward) {
-        $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "世界boss当前轮次排名奖励", #
-                "世界boss当前轮次排名奖励!", $reward);
+    public static function SendWorldBossRewardMail($zoneid, $uid, $reward,$index) {
+        $str = "恭喜您在本轮世界BOSS战中获得第".$index."名,相关排名奖励已通过邮件发放给您,请注意查收";
+        $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "世界boss排名奖励", #
+                $str, $reward);
         self::InsertMail($zoneid, $uid, $mail);
     }
     

+ 4 - 4
Gameserver/App/process/FightProc.php

@@ -1432,7 +1432,7 @@ class FightProc {
             $lv = gMem()->zrevrank($memKey, $uid);
         }
 
-        if ($lv == null) {
+        if ($lv === null) {
             $lv = -1;
         }
 
@@ -1937,10 +1937,10 @@ class FightProc {
             if (count($list) == 0) {
                 continue;
             }
-
-            $index += 1;
+           
             foreach ($list as $uid => $score) {
-                EmailProc::SendWorldBossRewardMail(req()->zoneid, $uid, $mo->reward);
+                $index += 1;
+                EmailProc::SendWorldBossRewardMail(req()->zoneid, $uid, $mo->reward,$index);
             }
         }
         

+ 424 - 14
Gameserver/App/process/StoreProc.php

@@ -60,10 +60,415 @@ class StoreProc {
                 return StoreProc::Equip_DownGradingLevel();
             case CmdCode::store_equip_downGradingQual:                          # 6420 降品
                 return StoreProc::Equip_DownGradingQual();
+
+            case CmdCode::store_pet_removeNewTip:                               # 6421 移除宠物上的新的标志
+                return StoreProc::Pet_RemoveNewTip();
+            case CmdCode::store_pet_changeFightPosition:                        # 6422 出战/替换/上阵
+                return StoreProc::Pet_ChangeFightPosition();
+            case CmdCode::store_pet_selectShowPet:                              # 6423 展示空闲灵宠
+                return StoreProc::Pet_SelectShowPet();
+            case CmdCode::store_pet_levelUpgrade:                               # 6424 灵宠等级提升   
+                return StoreProc::Pet_LevelUpgrade();
+            case CmdCode::store_pet_compose:                                    # 6425 宠物合成    
+                return StoreProc::Pet_Compose();
+            case CmdCode::store_pet_onekeyCompose:                              # 6426 宠物一键合成    
+                return StoreProc::Pet_OnekeyCompose();              
+            case CmdCode::store_pet_downGradingLevel:                           # 6427 宠物降级
+                return StoreProc::Pet_DownGradingLevel();              
+            case CmdCode::store_pet_downGradingQual:                            # 6428 宠物降品   
+                return StoreProc::Pet_DownGradingQual();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6428 宠物降品   
+     */
+    public static function Pet_DownGradingQual() {
+        list($uid) = req()->paras;
+
+        $petDic = ctx()->store->pet;
+        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+        $ins_pet = new Ins_Pet($petDic->$uid);
+
+        $NotDownGradingList = explode(',', glc()->equipQual_NotDownGrading);
+        my_Assert(!in_array($ins_pet->qual, $NotDownGradingList), ErrCode::user_store_equip_minQual);
+
+        $itemNum = 0;
+        for ($i = 1; $i < $ins_pet->level; $i++) {
+            $mo = GameConfig::pet_levelupgrade_getItem($ins_pet->mo()->rarity, $ins_pet->qual, $i);       
+            $itemNum += $mo->costItem;
+        }       
+        StoreProc::AddMultiItemInStore(6 . ',' . $itemNum);
+               
+        self::ComposeMaterial_Fallback_Pet($ins_pet->mo()->petType, $ins_pet->qual);
+
+        $ins_pet->level = 1;
+        $sList2 = explode(';', glc()->equipQualUnlockSkillId);
+        foreach ($sList2 as $str3) {
+            $s = explode(',', $str3);
+            if (in_array($ins_pet->qual, $s)) {
+                $ins_pet->qual = $s[0];
+                break;
+            }
+        }
+
+        ctx()->store->pet->$uid = $ins_pet;
+        //FightProc::Ranking_FightPower();
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    //'gold' => ctx()->baseInfo->gold,
+                    'store' => ctx()->store,
+        ));
+    }
+
+    private static function ComposeMaterial_Fallback_Pet($type, $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; $i < $max; $i++) {
+                    $mo = GameConfig::pet_compose_getItem($i);
+                    $num += explode(',', $mo->compose_condition)[2];
+                }
+
+                $typeId = self::ComposeMaterial($type, $min,902);
+                StoreProc::AddMultiItemInStore($typeId . ',' . $num);
+                break;
+            }
+        }
+    }
+    
+    
+    /*
+     * 6427 宠物降级
+     */
+
+    public static function Pet_DownGradingLevel() {
+        list($uid) = req()->paras; //宠物uid
+
+        $petDic = ctx()->store->pet;
+        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+        $ins_pet = new Ins_Pet($petDic->$uid);
+
+        my_Assert($ins_pet->level > 1, ErrCode::user_store_equip_minlevel);      
+     
+        $itemNum = 0;
+        for ($i = 1; $i < $ins_pet->level; $i++) {
+            $mo = GameConfig::pet_levelupgrade_getItem($ins_pet->mo()->rarity, $ins_pet->qual, $i);       
+            $itemNum += $mo->costItem;
+        }       
+        StoreProc::AddMultiItemInStore(6 . ',' . $itemNum);
+
+       
+        
+        $ins_pet->level = 1;
+        ctx()->store->pet->$uid = $ins_pet;
+
+        //FightProc::Ranking_FightPower();
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    //'gold' => ctx()->baseInfo->gold,
+                    'store' => ctx()->store,
+        ));
+    }
+    
+    /**
+     * 6426 宠物一键合成    
+     * @return type
+     */
+    public static function Pet_OnekeyCompose() {
+        $store = ctx()->store(true);
+        $petDic = $store->pet;
+        $arr = array();                                                         # 待处理装备临时数组
+        $composePet = array();                                                  # 合成记录
+        foreach ($petDic as $pet) {
+            if ($pet->qual < 4) {                                               # 4 品以上的不参与合成
+                $arr[] = new Ins_Pet($pet);
+            }
+        }      
+
+        while (count($arr) > 0) {                                               # 循环处理每一个装备
+            $pet_compose = array_pop($arr);                                     # 从末尾弹出一个元素做合成运算
+            if (null == $pet_compose) {                                         # 防御空对象
+                break;
+            }
+            $eqQualCfg = GameConfig::pet_compose_getItem($pet_compose->qual); # 按照品阶查询合成配置数据
+            my_Assert(null != $eqQualCfg, ErrCode::err_const_no);               # 防御配置数据错误
+            list($type, $costQual, $num) = explode(',', $eqQualCfg->compose_condition); # 从配置提取合成条件
+            $composeArr = array();                                              # 消耗集合
+            foreach ($arr as $v) {                                              # 从剩余元素中查找合成所需
+                if ($v->qual == $costQual) {                                    # 同品阶
+                    if (($type == 1) ? $v->typeId == $pet_compose->typeId #     # type: 1 与本体相同 2 同部位即可
+                                    : $v->mo()->petType == $pet_compose->mo()->petType) {
+                        $composeArr[] = $v;                                     # 成为消耗品
+                    }
+                    if (count($composeArr) >= $num) {                           # 达到消耗数量就停
+                        break;
+                    }
+                }
+            }
+            if (count($composeArr) >= $num) {                                   # 合成的回收 不合成的可不能给回收了
+                $uid = $pet_compose->uid;
+                $newPet = self::ComposeNewPet($pet_compose);                    # 原地合成
+                self::petLevelChange_Material_Recovery($newPet->mo()->rarity, $newPet->qual, $newPet->level); # 回收材料
+                $newPet->level = 1;
+                $petDic->$uid = $newPet;
+                               
+                $composePet[] = $uid;                                           # 添加合成记录
+                foreach ($composeArr as $val) {                                 # 回收消耗的装备中所含材料
+                    self::petLevelChange_Material_Recovery($val->mo()->rarity, $val->qual, $val->level); # 回收材料
+                    StlUtil::dictRemove(ctx()->store(true)->pet, $val->uid);    # 背包删除
+                    if(ctx()->store(true)->petUid_fight_position == $val->uid){
+                        ctx()->store(true)->petUid_fight_position = 0;
+                    }                 
+                    foreach (ctx()->store(true)->petUids_supportFight_position as $k => $pUid) {
+                        if($pUid == $val->uid){
+                            StlUtil::dictRemove(ctx()->store(true)->petUids_supportFight_position, $k);                            
+                            break;
+                        }
+                    }
+                                      
+                    StlUtil::arrayRemove($arr, $val); # 从arr中删掉已消耗装备
+                }
+            }
+        }
+
+       
+        UserProc::updateUserInfo();                                             # 回存玩家数据
+        return Resp::ok(array(#                                                 # 返回给客户端的数据                   
+                    'store' => ctx()->store,
+                    'composeEquip' => $composePet,
+                    'task' => ctx()->task,
+        ));
+    }
+    
+    /**
+     * 6425 宠物合成    
+     * @return Resp
+     */
+    public static function Pet_Compose() {
+        list($uid, $petUids_cost, $composeMaterial_typeIds) = req()->paras;
+       
+        $petDic = ctx()->store->pet;
+        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+        $ins_pet = new Ins_Pet($petDic->$uid);
+
+        my_Assert($ins_pet->qual < 11, ErrCode::user_store_equip_qualMaxLimit);
+        $composeMo = GameConfig::pet_compose_getItem($ins_pet->qual);
+        my_Assert(null != $composeMo, ErrCode::err_const_no);
+        $arr = explode(',', $composeMo->compose_condition);
+
+        $type = $arr[0];
+        $costQual = $arr[1];
+        $num = $arr[2];
+
+        $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_pet->mo()->petType, $costQual,902);
+                my_Assert($composeMaterial_itemTypeId == $s, ErrCode::user_store_equip_composeMaterialErr);
+                $all_num += 1;
+            }
+        }
+
+        if ($petUids_cost != null) {
+            $costPetsArr = explode(',', $petUids_cost);
+            $all_num += count($costPetsArr);
+
+            foreach ($costPetsArr as $pUid) {
+                my_Assert(StlUtil::dictHasProperty($petDic, $pUid), ErrCode::user_store_NotExistPet);
+
+                my_Assert(ctx()->store(true)->petUid_fight_position != $pUid, ErrCode::user_store_NotSelectPet_fight);
+                my_Assert(!in_array($pUid, ctx()->store(true)->petUids_supportFight_position), ErrCode::user_store_NotSelectPet_supportfight);
+                
+                $costIns_pet = new Ins_Pet($petDic->$pUid);
+                my_Assert($costIns_pet->qual == $costQual, ErrCode::user_store_equipMaterialQualErr);
+                if ($type == 1) {//本体                
+                    my_Assert($costIns_pet->typeId == $ins_pet->typeId, ErrCode::user_store_equipMaterialTypeErr);
+                } else {
+                    my_Assert($costIns_pet->mo()->petType == $ins_pet->mo()->petType, ErrCode::user_store_equipMaterialTypeErr);
+                }
+            }
+        }
+        my_Assert($all_num == $num, ErrCode::user_store_equipMaterialNumErr);
+        ctx()->store(true)->pet->$uid = self::ComposeNewPet($ins_pet);
+
+        //消耗的装备 回收         
+        if ($petUids_cost != null) {
+            $costPetsArr = explode(',', $petUids_cost);
+            foreach ($costPetsArr as $pUid) {
+                $costIns_Equip = new Ins_Pet($petDic->$pUid);
+                self::petLevelChange_Material_Recovery($costIns_Equip->mo()->rarity, $costIns_Equip->qual, $costIns_Equip->level);
+                StlUtil::dictRemove(ctx()->store(true)->pet, $pUid);              
+            }
+        }
+
+        if ($materialItemType != 0) {
+            ctx()->store(true)->removeItem($materialItemType, $materialItemNum);
+        }
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array(                 
+                    'store' => ctx()->store,
+                    'task' => ctx()->task,
+        ));
+    }
+    
+    /**
+     * 装备等级提升 消耗的金币图纸回收
+     * @param type $rarity
+     * @param type $qual
+     * @param type $posId
+     * @param type $level
+     */
+    public static function petLevelChange_Material_Recovery($rarity, $qual,$level) {    
+        $num = 0;
+       
+        for ($i = 1; $i <= $level - 1; $i++) {
+            $mo = GameConfig::pet_levelupgrade_getItem($rarity, $qual, $i);         
+            $num += $mo->costItem;
+        }
+        if ($num > 0) {        
+            StoreProc::AddMultiItemInStore(6 . ',' . $num);
+        }
+    }
+    
+    /**
+     * 合成一个新的装备
+     * @param type Ins_Equip
+     */
+    public static function ComposeNewPet(&$ins_pet) {
+        $newPetTypeId = $ins_pet->typeId;
+        $qual = $ins_pet->qual + 1;
+        if ($ins_pet->qual < 4) {
+            //$newEquipTypeId = substr($ins_pet->typeId, 0, strlen($ins_equip->typeId) - 5);
+            $rarity = substr($ins_pet->typeId, -3);
+            $mo = GameConfig::pet_getItem($ins_pet->typeId);
+            $newPetTypeId = $mo->type. "0" . $qual . $rarity;
+        }
+
+        $ins_pet->typeId = $newPetTypeId;
+        $ins_pet->qual = $qual;
+
+        return $ins_pet;
+    }
+    
+    
+    /**
+     *6424 灵宠等级提升   
+     * @return Resp
+     */
+    public static function Pet_LevelUpgrade(){
+        list($uid) = req()->paras; //装备uid
+
+        my_Assert(StlUtil::dictHasProperty(ctx()->store->pet, $uid), ErrCode::user_store_NotExistPet);
+        $ins_pet = new Ins_Pet(ctx()->store->pet->$uid);
+        my_Assert($ins_pet->level < $ins_pet->Pet_MaxLevel(), ErrCode::user_store_LevelLimit);
+
+        $mo = $ins_pet->petLevelMo();
+
+        $costTuzhiId = 6;
+        $tuzhiNum = 0;
+        if (StlUtil::dictHasProperty(ctx()->store->items, $costTuzhiId)) {
+            $tuzhiNum = ctx()->store->items->$costTuzhiId;
+        }
+        my_Assert($tuzhiNum >= $mo->costItem, ErrCode::notenough_item);
+
+        ctx()->store(true)->removeItem($costTuzhiId,$mo->costItem);
+     
+        $ins_pet->level += 1;
+        ctx()->store->pet->$uid = $ins_pet;
+     
+        UserProc::updateUserInfo();
+        return Resp::ok(array(                   
+                    'store' => ctx()->store,              
+        ));
+    }
+    
+    /**
+     * 6423 展示空闲灵宠
+     * @return Resp
+     */
+    public static function Pet_SelectShowPet(){
+        list($uid) = req()->paras;
+        
+        $petDic = ctx()->store->pet;
+        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+        
+        my_Assert(count(ctx()->store()->mainShowPetList)< GameConfig::glc2()->Pet_MainShowPetList , ErrCode::user_store_ShowPetNumLimit);
+        
+        my_Assert(ctx()->store->petUid_fight_position != $uid, ErrCode::user_store_NotSelectPet_fight);
+        my_Assert(!in_array($uid, ctx()->store->petUids_supportFight_position), ErrCode::user_store_NotSelectPet_supportfight);
+        
+        if(in_array($uid,ctx()->store()->mainShowPetList)){
+            StlUtil::arrayRemove(ctx()->store()->mainShowPetList, $uid);
+        } else {
+            ctx()->store()->mainShowPetList[] = $uid;
+        }
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array());
+    }
+
+    /**
+     * 6422 出战/替换/上阵
+     */
+    public static function Pet_ChangeFightPosition() {
+        list($type, $uid, $index) = req()->paras;
+
+        if ($type == 1) {//出战、替换
+            ctx()->store(true)->petUid_fight_position = $uid;
+        } else if ($type == 2) {
+            ctx()->store(true)->petUids_supportFight_position->$index = $uid;
+        }
+
+        if ($type == 0 && $index == 0 && $uid != 0) {//上阵点击空白的地方
+            if (ctx()->store(true)->petUid_fight_position == 0) {
+                ctx()->store(true)->petUid_fight_position = $uid;
+            } else {
+                if (count(StlUtil::dictToArray(ctx()->store(true)->petUids_supportFight_position)) == 0) {
+                    $key = 1;
+                    ctx()->store(true)->petUids_supportFight_position->$key = $uid;
+                } else {
+                    for ($i = 1; $i <= 2; $i++) {
+                        if (!StlUtil::dictHasProperty(ctx()->store(true)->petUids_supportFight_position, $i) || ctx()->store(true)->petUids_supportFight_position->$i == 0) {
+                            ctx()->store(true)->petUids_supportFight_position->$i = $uid;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array());
+    }
+
+    /**
+     * 6421 移除宠物上的新的标志
+     */
+    public static function Pet_RemoveNewTip() {
+        list($uid) = req()->paras;
+
+        $petDic = ctx()->store->pet;
+        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+
+        ctx()->store->pet->$uid->isNew = 0;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array());
+    }
 
     /**
      * 6420 降品
@@ -120,10 +525,10 @@ class StoreProc {
         }
     }
 
-    private static function ComposeMaterial($posId, $qual) {
+    private static function ComposeMaterial($posId, $qual,$type = 901) {
         $itemDic = GameConfig::item();
         foreach ($itemDic as $typeId => $mo) {
-            if ($mo->itemType == 901 && $typeId % 100 == $posId && floor($typeId / 100) % 100 == $qual) {
+            if ($mo->itemType == $type && $typeId % 100 == $posId && floor($typeId / 100) % 100 == $qual) {
                 return $typeId;
             }
         }
@@ -162,7 +567,7 @@ class StoreProc {
 
         $ins_equip->level = 1;
         ctx()->store->equip->$uid = $ins_equip;
-        
+
         FightProc::Ranking_FightPower();
         UserProc::updateUserInfo();
         return Resp::ok(array(
@@ -182,7 +587,7 @@ class StoreProc {
         my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
         $ins_equip = new Ins_Equip($equipDic->$uid);
 
-        my_Assert($ins_equip->qual<16, ErrCode::user_store_equip_qualMaxLimit);
+        my_Assert($ins_equip->qual < 16, ErrCode::user_store_equip_qualMaxLimit);
         $composeMo = GameConfig::equip_compose_getItem($ins_equip->qual);
         my_Assert(null != $composeMo, ErrCode::err_const_no);
         $arr = explode(',', $composeMo->compose_condition);
@@ -246,7 +651,7 @@ class StoreProc {
 
         TaskProc::OnEquipComposeNum();
         FightProc::Ranking_FightPower();
-        
+
         UserProc::updateUserInfo();
         return Resp::ok(array(
                     'gold' => ctx()->baseInfo->gold,
@@ -343,7 +748,12 @@ class StoreProc {
             }
             if (count($composeArr) >= $num) {                                   # 合成的回收 不合成的可不能给回收了
                 $uid = $equip_compose->uid;
-                $equipDic->$uid = self::ComposeNewEquip($equip_compose);        # 原地合成
+                $newEquip = self::ComposeNewEquip($equip_compose);        # 原地合成
+                self::equipLevelUp_Material_Recovery($newEquip->mo()->rarity, $newEquip->qual, $newEquip->mo()->position, $newEquip->level); # 回收材料
+                $newEquip->level = 1;
+                $equipDic->$uid = $newEquip;
+                
+                
                 $composeEquip[] = $uid;                                         # 添加合成记录
                 foreach ($composeArr as $val) {                                 # 回收消耗的装备中所含材料
                     self::equipLevelUp_Material_Recovery($val->mo()->rarity, $val->qual, $val->mo()->position, $val->level); # 回收材料
@@ -357,7 +767,7 @@ class StoreProc {
                 }
             }
         }
-        
+
         TaskProc::OnEquipComposeNum();
         FightProc::Ranking_FightPower();
         UserProc::updateUserInfo();                                             # 回存玩家数据
@@ -513,7 +923,7 @@ class StoreProc {
         $posId = $ins_equip->mo()->position;
         ctx()->store(true)->equipLocation->$posId = $uid;
         FightProc::Ranking_FightPower();
-        
+
         GuideProc::GateFight_Guide_Trigger();
         UserProc::updateUserInfo();
         return Resp::ok(array());
@@ -1013,7 +1423,7 @@ class StoreProc {
 
         my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $uid), ErrCode::user_store_NoEquip);
         $ins_equip = new Ins_Equip(ctx()->store->equip->$uid);
-        my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_equipLevelLimit);
+        my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_LevelLimit);
 
         $mo = GameConfig::equip_levelupgrade_getItem($ins_equip->mo()->rarity, $ins_equip->qual, $ins_equip->mo()->position, $ins_equip->level);
         my_Assert(null != $mo, ErrCode::err_const_no);
@@ -1055,7 +1465,7 @@ class StoreProc {
         my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $uid), ErrCode::user_store_NoEquip);
         $ins_equip = new Ins_Equip(ctx()->store->equip->$uid);
         $maxLevel = $ins_equip->Equip_MaxLevel();
-        my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_equipLevelLimit);
+        my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_LevelLimit);
 
         $tuzhiId = GameConfig::equip_position_getItem($ins_equip->mo()->position)->costTuzhiId;
         $itemNum_store = 0;
@@ -1084,10 +1494,10 @@ class StoreProc {
             $up_lv = $i;
             if (ctx()->baseInfo->gold >= $up_Gold && $itemNum_store >= $up_needItem) {
                 $need_gold = $up_Gold;
-                $need_item = $up_needItem;               
+                $need_item = $up_needItem;
                 continue;
             }
-            
+
             break;
         }
 
@@ -1209,10 +1619,10 @@ class StoreProc {
                     //self::PutEquipInStore($itemId, $num);
                     for ($i = 0; $i < $num; $i++) {
                         FightProc::funUnlock_equip_firstTime();
-                        
+
                         $equip = self::initEquip($itemId);
                         $uid = $equip->uid;
-                        ctx()->store(true)->equip->$uid = $equip;                       
+                        ctx()->store(true)->equip->$uid = $equip;
                         self::$reward_equip[] = $uid;
                     }
                     break;