cyzhao 1 rok pred
rodič
commit
db71884fdf

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

@@ -126,6 +126,9 @@ class CmdCode {
      */
     const cmd_store_equip = 6402;
     
+    /**
+     * 卸下装备
+     */
     const cmd_store_RemoveEquip = 6403;
 
     /**

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

@@ -336,6 +336,12 @@ class ErrCode {
     const user_Gate_NoUserGateInfo = 3201;
 // </editor-fold>
 //
+    
+//   // <editor-fold defaultstate="collapsed" desc="    store 3300    ">    
+
+    const user_store_NoEquip = 3301;
+// </editor-fold>
+//
 
 // <editor-fold defaultstate="collapsed" desc="    反射方法    ">
 

+ 120 - 40
Gameserver/App/configs/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2023-07-28 10:18:52
+ // 日期: 2023-08-09 15:33:44
 ////////////////////
 
 namespace loyalsoft;
@@ -207,38 +207,6 @@ class GameConfig {
         return self::get_hash_item('skills', $itemid);
     }
     /**
-    * 战斗: 波次表
-    * @return \waves
-    */
-    public static function waves()
-    { 
-        static $a = null; 
-        return self::initValue($a, 'waves');
-    }
-    /**
-    * @return \sm_waves waves itemArray 
-    */
-    public static function waves_getItemArray($key)
-    { 
-        return self::get_hash_item('waves', $key);
-    }
-    /**
-    * 战斗: 怪物表
-    * @return \monster
-    */
-    public static function monster()
-    { 
-        static $a = null; 
-        return self::initValue($a, 'monster');
-    }
-    /**
-    * @return \sm_monster monster item数据 
-    */
-    public static function monster_getItem($itemid)
-    { 
-        return self::get_hash_item('monster', $itemid);
-    }
-    /**
     * 活动: 七日签到
     * @return \activity_day7
     */
@@ -335,20 +303,132 @@ class GameConfig {
         return self::get_hash_item('gate', $itemid);
     }
     /**
-    * 战斗经验表
-    * @return \gate_levelexp
+    * 角色
+    * @return \hero
+    */
+    public static function hero()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'hero');
+    }
+    /**
+    * @return \sm_hero hero item数据 
+    */
+    public static function hero_getItem($itemid)
+    { 
+        return self::get_hash_item('hero', $itemid);
+    }
+    /**
+    * 装备表
+    * @return \equip
+    */
+    public static function equip()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'equip');
+    }
+    /**
+    * @return \sm_equip equip item数据 
+    */
+    public static function equip_getItem($itemid)
+    { 
+        return self::get_hash_item('equip', $itemid);
+    }
+    /**
+    * 装备升级表
+    * @return \equip_levelupgrade
+    */
+    public static function equip_levelupgrade()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'equip_levelupgrade');
+    }
+    /**
+    * @return \sm_equip_levelupgrade equip_levelupgrade item数据 
+    */
+    public static function equip_levelupgrade_getItem($itemid)
+    { 
+        return self::get_hash_item('equip_levelupgrade', $itemid);
+    }
+    /**
+    * 章节礼包表
+    * @return \shop_gategift
+    */
+    public static function shop_gategift()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_gategift');
+    }
+    /**
+    * @return \sm_shop_gategift shop_gategift item数据 
+    */
+    public static function shop_gategift_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_gategift', $itemid);
+    }
+    /**
+    * 每日商店
+    * @return \shop_daily
+    */
+    public static function shop_daily()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_daily');
+    }
+    /**
+    * @return \sm_shop_daily shop_daily item数据 
+    */
+    public static function shop_daily_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_daily', $itemid);
+    }
+    /**
+    * 钻石
+    * @return \shop_cash
+    */
+    public static function shop_cash()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_cash');
+    }
+    /**
+    * @return \sm_shop_cash shop_cash item数据 
+    */
+    public static function shop_cash_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_cash', $itemid);
+    }
+    /**
+    * 金币
+    * @return \shop_gold
+    */
+    public static function shop_gold()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_gold');
+    }
+    /**
+    * @return \sm_shop_gold shop_gold item数据 
+    */
+    public static function shop_gold_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_gold', $itemid);
+    }
+    /**
+    * 
+    * @return \shop_supply
     */
-    public static function gate_levelexp()
+    public static function shop_supply()
     { 
         static $a = null; 
-        return self::initValue($a, 'gate_levelexp');
+        return self::initValue($a, 'shop_supply');
     }
     /**
-    * @return \sm_gate_levelexp gate_levelexp item数据 
+    * @return \sm_shop_supply shop_supply item数据 
     */
-    public static function gate_levelexp_getItem($itemid)
+    public static function shop_supply_getItem($itemid)
     { 
-        return self::get_hash_item('gate_levelexp', $itemid);
+        return self::get_hash_item('shop_supply', $itemid);
     }
     /**
     * 当前版本(时间戳)

+ 11 - 0
Gameserver/App/model/User/Info_Store.php

@@ -40,4 +40,15 @@ class Info_Store extends Object_ext {
             parent::__construct($arg);
         }
     }
+    
+    public function removeItem($itemId,$num) {
+        if(StlUtil::dictHasProperty($this->items, $itemId)){
+            $this->items->$itemId -= $num;
+            if($this->items->$itemId <= 0){
+                unset($this->items->$itemId);
+            }
+        }
+        
+        
+    }
 }

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

@@ -36,61 +36,91 @@ class StoreProc {
         }
     }
     
+    /**
+     * 装备
+     * @return type
+     */
     public static function equip() {
         list($uid) = req()->paras;
         $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;
         
-     
-
-        //my_Assert(ErrCode::ok == $err, $err);
+        $heroId = $user->heros->CurrentHeroId;
+        
+        $user->store->equip->$uid->posId = $posId;             
+        if($user->heros->Dic->$heroId->equipPosition->$posId > 0){
+            $oldUid = $user->heros->Dic->$heroId->equipPosition->$posId;
+            $user->store->equip->$oldUid->posId = 0;            
+        }
         
+        $user->heros->Dic->$heroId->equipPosition->$posId = $uid;
+                      
         UserProc::updateUserInfo();
-        return Resp::ok(array(
-                    //'gold' => $user->baseInfo->gold,
-                    //'tili' => $user->baseInfo->tili,
-                    //'cash' => $user->baseInfo->cash,                   
-                    'store' => $user->store));
+        return Resp::ok(array(                   
+                    'heros' => $user->heros,                   
+                    'store' => $user->store,));
         
     }
     
-    
+    /**
+     * 卸下装备
+     * @return type
+     */
     public static function RemoveEquip() {
-        list($uid) = req()->paras; //mask = 1:表示战斗中掉落
+        list($posId) = req()->paras; 
         $user = ctx();
 
-    
-
-       
-        
+        $heroId = $user->heros->CurrentHeroId;
+        if($user->heros->Dic->$heroId->equipPosition->$posId > 0){
+            $oldUid = $user->heros->Dic->$heroId->equipPosition->$posId;
+            $user->store->equip->$oldUid->posId = 0;      
+            $user->heros->Dic->$heroId->equipPosition->$posId = 0;
+        }
+              
         UserProc::updateUserInfo();
         return Resp::ok(array(
-                    //'gold' => $user->baseInfo->gold,
-                    //'tili' => $user->baseInfo->tili,
-                    //'cash' => $user->baseInfo->cash,                   
-                    'store' => $user->store));
+                    'heros' => $user->heros,                   
+                    'store' => $user->store,));
         
     }
     
     
-    
+    /**
+     * 升级装备
+     * @return type
+     */
     public static function equipUpgrade() {
         list($uid) = req()->paras; //mask = 1:表示战斗中掉落
         $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);                  
+                 
+        $typeId = GameConfig::equip_getItem($user->store->equip->$uid->typeId)->needTuzhiId;//图纸
+        $num = $Mo->needItemNum;
+        if (StlUtil::dictHasProperty($user->store->items,$typeId) && $user->store->items->$typeId >= $num)
+        {
+            $user->store->removeItem($typeId, $num);
+        }                  
+
+        $user->store->equip->$uid->level += 1;       
         
         UserProc::updateUserInfo();
         return Resp::ok(array(
-                    //'gold' => $user->baseInfo->gold,
-                    //'tili' => $user->baseInfo->tili,
-                    //'cash' => $user->baseInfo->cash,                   
+                    'gold' => $user->baseInfo->gold,                         
                     'store' => $user->store));
         
     }
-    
+    /**
+     * 装备一键升级
+     * @return type
+     */
     public static function equipUpgrade_MaxLv() {
         list($uid) = req()->paras; //mask = 1:表示战斗中掉落
         $user = ctx();