cyzhao 3 жил өмнө
parent
commit
bc5979e97c

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

@@ -680,6 +680,16 @@ class CmdCode {
      * 
      * 
      */
      */
     public const map_buySupplies = 6431;
     public const map_buySupplies = 6431;
+    
+    /*
+     * 扩容第三个格子
+     */
+    public const map_expandStorage = 6432;
+    
+    /*
+     * 放入和移除储物间
+     */
+    public const map_changeStorage = 6433;
 
 
 // </editor-fold>
 // </editor-fold>
     //
     //

+ 2 - 0
Gameserver/Amfphp/base/ErrCode.php

@@ -590,6 +590,8 @@ class ErrCode {
     const store_YanLingHaveGem = 3423;
     const store_YanLingHaveGem = 3423;
     
     
     const store_weaponCantBuy = 3424;
     const store_weaponCantBuy = 3424;
+    
+    const store_expandStorage = 3425;
 // </editor-fold>
 // </editor-fold>
     //  
     //  
     // <editor-fold defaultstate="collapsed" desc="   任务错误码 35xx系列   ">
     // <editor-fold defaultstate="collapsed" desc="   任务错误码 35xx系列   ">

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
  // author: gwang 
- // 日期: 2022-04-13 09:54:52
+ // 日期: 2022-04-13 17:31:50
 ////////////////////
 ////////////////////
 
 
 /**
 /**

+ 6 - 1
Gameserver/Amfphp/model/Const/globalsettings.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
  // author: gwang 
- // 日期: 2021-12-21 14:42:27
+ // 日期: 2022-04-13 17:30:04
 ////////////////////
 ////////////////////
 
 
 
 
@@ -480,5 +480,10 @@ class globalsettings
     */
     */
     public $limitTsActiveGiftEndTs;
     public $limitTsActiveGiftEndTs;
 
 
+    /**
+    * @var Object 扩容第三个格子的花费  
+    */
+    public $expandStorageCost;
+
 }
 }
 
 

+ 12 - 0
Gameserver/Amfphp/model/User/Info_Store.php

@@ -64,6 +64,11 @@ class Info_Store extends Object_ext {
     public $weaponReward = null;
     public $weaponReward = null;
 
 
 
 
+    /*
+     * 储物间
+     */
+    public $storage = null;
+    
     /**
     /**
      * 玩家注册时初始化
      * 玩家注册时初始化
      */
      */
@@ -78,6 +83,13 @@ class Info_Store extends Object_ext {
         
         
         $this->weaponPool = ObjectInit();
         $this->weaponPool = ObjectInit();
         $this->weaponReward = ObjectInit();
         $this->weaponReward = ObjectInit();
+        
+        $this->$storage = ObjectInit();
+        $key = 1;
+        $key2 = 2;
+        $this->$storage->$key = array();
+        $this->$storage->$key2 = array();
+        
     }
     }
 
 
     /**
     /**

+ 51 - 9
Gameserver/Amfphp/process/StoreProc.php

@@ -79,14 +79,55 @@ class StoreProc {
                 return self::buyWeapon();
                 return self::buyWeapon();
             case CmdCode::map_getShopWeapon:                                    # 6430                                      
             case CmdCode::map_getShopWeapon:                                    # 6430                                      
                 return self::getShopWeapon();
                 return self::getShopWeapon();
-
             case CmdCode::map_buySupplies:                                      #6431 购买补给品
             case CmdCode::map_buySupplies:                                      #6431 购买补给品
                 return self::buySupplies();
                 return self::buySupplies();
-
+            case CmdCode::map_expandStorage:                                    # 6432                                      
+                return self::expandStorage();
+            case CmdCode::map_changeStorage:                                    # 6433 
+                return self::changeStorage();
             default:
             default:
                 Err(ErrCode::cmd_err);
                 Err(ErrCode::cmd_err);
         }
         }
     }
     }
+    /**
+     * 6432
+     * @return type
+     */
+    public static function changeStorage() {
+        $type = req()->paras[0];       # 1:放入 2移除到背包
+        $index = req()->paras[1];      #放入第几个格子
+        $itemid = req()->paras[2];      # itemid
+        
+        $store = ctx()->store(true);
+       
+        
+        ctx()->store(true)->storage->$key = array();
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array("store"=>$store,));
+    }
+    
+    public static function expandStorage() {
+        $cost = GameConfig::globalsettings()->expandStorageCost;
+        $list = explode(',', $cost);
+        
+        $key = 3;
+        my_Assert(StlUtil::dictHasProperty(!ctx()->store(true)->storage, $key), ErrCode::store_expandStorage);
+           
+        if($list[0] == 1){
+            my_Assert(ctx()->base(true)->gold >= $list[1], ErrCode::notenough_gold_msg);
+            ctx()->base(true)->Consume_Gold($list[1]);
+        } elseif ($list[0] == 2) {
+            my_Assert(ctx()->base(true)->cash >= $list[1], ErrCode::notenough_cash_msg);
+            ctx()->base(true)->Consume_Cash($list[1]);
+        }
+        
+        ctx()->store(true)->storage->$key = array();
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array("storage"=>ctx()->store(true)->storage,));
+    }
+    
 
 
     /**
     /**
      * 6431 购买补给品
      * 6431 购买补给品
@@ -100,6 +141,8 @@ class StoreProc {
         my_Assert($mo != null, ErrCode::err_const_no);
         my_Assert($mo != null, ErrCode::err_const_no);
 
 
         my_Assert($num <= $mo->num, ErrCode::err_const_no);
         my_Assert($num <= $mo->num, ErrCode::err_const_no);
+        
+        my_Assert(ctx()->base(true)->gold >= $mo->cost * $num, ErrCode::notenough_gold_msg);
 
 
         req()->userInfo->game->base(true)->Consume_Gold($mo->cost * $num);
         req()->userInfo->game->base(true)->Consume_Gold($mo->cost * $num);
         $goodsStr = $itemid . ',' . $num;
         $goodsStr = $itemid . ',' . $num;
@@ -137,19 +180,17 @@ class StoreProc {
         $type = 0;
         $type = 0;
 
 
         $tag = true;
         $tag = true;
-        if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
+        if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {          
             $dic = $store->weaponReward->$npcid;
             $dic = $store->weaponReward->$npcid;
-            foreach ($dic as $k => $list) {
-                if (in_array($weaponId, $list)) {
+            foreach ($dic as $k => $list) {             
+                if (in_array($weaponId, $list)) {                    
                     $tag = false;
                     $tag = false;
                     break;
                     break;
                 }
                 }
             }
             }
-        } else {
-            $tag = false;
         }
         }
 
 
-        my_Assert($tag == false, ErrCode::store_weaponCantBuy);
+        my_Assert($tag == true, ErrCode::store_weaponCantBuy);
 
 
         $list = GameConfig::shop_weapon_getItemArray($npcid);
         $list = GameConfig::shop_weapon_getItemArray($npcid);
         $cost = 0;
         $cost = 0;
@@ -164,7 +205,8 @@ class StoreProc {
                 }
                 }
             }
             }
         }
         }
-
+        
+        my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
         ctx()->base(true)->Consume_Gold($cost);
         ctx()->base(true)->Consume_Gold($cost);
 
 
         $store->weaponReward->$npcid->$type[] = $weaponId;
         $store->weaponReward->$npcid->$type[] = $weaponId;