浏览代码

血瓶蓝瓶接口

cyzhao 3 年之前
父节点
当前提交
b2be7119bb

+ 16 - 1
Gameserver/Amfphp/base/CmdCode.php

@@ -690,7 +690,22 @@ class CmdCode {
      * 放入和移除储物间
      */
     public const cmd_store_changeStorage = 6433;
-
+    
+    /**
+     * 添加、移除血瓶
+     */
+    public const cmd_store_changeBettleItem = 6434;
+    
+    /*
+     * 道具全部使用,删除
+     */
+    public const cmd_store_removeBettleItem = 6435;
+    
+    /**
+     * 血瓶或蓝瓶自动使用条件设置
+     */
+    public const cmd_store_setBettleItemUseVal = 6436;
+    
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 65xx">

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

@@ -596,6 +596,8 @@ class ErrCode {
     const store_NotHaveStorage = 3426;
     
     const store_StorageEnough= 3427;
+    
+    const store_bettleitemNumNotEnough= 3427;
 // </editor-fold>
     //  
     // <editor-fold defaultstate="collapsed" desc="   任务错误码 35xx系列   ">

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

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

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-04-13 17:30:04
+ // 日期: 2022-04-21 14:19:31
 ////////////////////
 
 
@@ -485,5 +485,10 @@ class globalsettings
     */
     public $expandStorageCost;
 
+    /**
+    * @var Object 战斗槽位冷却时间  
+    */
+    public $caoWeiCoolTs;
+
 }
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-23 14:24:20
+ // 日期: 2022-04-15 10:33:02
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:33
+ // 日期: 2022-04-13 10:19:02
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-23 14:25:11
+ // 日期: 2022-04-14 16:01:59
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-23 14:25:11
+ // 日期: 2022-04-14 16:01:59
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-31 15:31:23
+ // 日期: 2022-04-14 11:45:33
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:43
+ // 日期: 2022-04-14 11:45:00
 ////////////////////
 
 

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

@@ -69,6 +69,12 @@ class Info_Store extends Object_ext {
      */
     public $storage = null;
     
+    /*
+     * 战斗中使用的血瓶等消耗品
+     */
+    public $battleItem = null;
+
+
     /**
      * 玩家注册时初始化
      */
@@ -90,6 +96,7 @@ class Info_Store extends Object_ext {
         $this->storage->$key = new Ins_storage();
         $this->storage->$key2 = new Ins_storage();
               
+        $this->battleItem = ObjectInit();       
     }
 
     /**

+ 27 - 0
Gameserver/Amfphp/model/User/Ins_battleItem.php

@@ -0,0 +1,27 @@
+<?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_battleItem
+ *
+ * @author c'y'zhao
+ */
+class Ins_battleItem extends Object_ext{
+    public $id = 0;
+
+    public $num = 0;
+    public $isAuto = 0;//默认不是
+    
+    public $attrVal = 0;//默认不是
+
+    public function __construct($arg = null) {
+        parent::__construct($arg);   
+    }
+}

+ 75 - 0
Gameserver/Amfphp/process/StoreProc.php

@@ -85,11 +85,86 @@ class StoreProc {
                 return self::expandStorage();
             case CmdCode::cmd_store_changeStorage:                              # 6433 
                 return self::changeStorage();
+            case CmdCode::cmd_store_changeBettleItem:                           # 6434
+                return self::changeBettleItem();    
+            case CmdCode::cmd_store_removeBettleItem:                           # 6435
+                return self::removeBettleItem();
+            case CmdCode::cmd_store_setBettleItemUseVal:                        # 6436
+                return self::setBettleItemUseVal();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6436
+     * @return type
+     */
+    public static function setBettleItemUseVal() {
+        $index = req()->paras[0];        # 提取参数      
+        $val = req()->paras[1];        # 提取参数    
+        
+        $store = ctx()->store(true);
+        
+        //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
+        $store->battleItem->$index->isAuto = 1;  
+        $store->battleItem->$index->attrVal = $val;  
+        
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array("store" => ctx()->store(),));
+    }
+    
+    /**
+     * 6435
+     * @return type
+     */
+    public static function removeBettleItem() {
+        $index = req()->paras[0];        # 提取参数      
+        
+        $store = ctx()->store(true);
+        
+        my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
+        $store->battleItem->$index->num -= 1;  
+        if($store->battleItem->$index->num <= 0){
+            unset($store->battleItem->$index);
+        }           
+        
+        UserProc::updateUserInfo();
 
+        return Resp::ok(array("store" => ctx()->store(),));
+    }
+    
+    /**
+     * 6434
+     * @return type
+     */
+    public static function changeBettleItem() {
+        $type = req()->paras[0];        # 提取参数       
+        $itemid = req()->paras[1];      # 提取参数
+        $index = req()->paras[2];      # 提取参数
+        
+        $store = ctx()->store(true);
+        if($type == 0){//添加          
+            $item = new Ins_battleItem();
+            $item->id = $itemid;
+            $item->num = $store->items->$itemid;
+            $store->battleItem->$index = $item;
+            unset($store->items->$itemid);  
+        } else {
+            $id = $store->battleItem->$index->id;
+            $num = $store->battleItem->$index->num;          
+            $store->items->$itemid = $num;
+            
+            unset($store->battleItem->$index);  
+        } 
+            
+
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array("store" => ctx()->store(),));
+    }
+        
     /**
      * 6432
      * @return type

+ 17 - 10
Gameserver/Amfphp/process/UserProc.php

@@ -386,16 +386,8 @@ class UserProc {
                 'isNewUser' => true
             );
             return Resp::ok($ret);
-        } else {                                                                # 2.如果玩家已存在,则处理普通登录流程
-            if ($game->store->storage == null) {
-                $key = 1;
-                $key2 = 2;
-
-                $game->store->storage = ObjectInit();
-                $game->store->storage->$key = new Ins_storage();
-                $game->store->storage->$key2 = new Ins_storage();
-            }
-
+        } else {                                                                # 2.如果玩家已存在,则处理普通登录流程           
+            self::newFieldSupplement($game);
 
             req()->game = $game;                                                # 给Req挂载玩家数据
             UserProc::checkContidays();                                         # 连续登录,状态检查
@@ -417,6 +409,21 @@ class UserProc {
         }
         return $resp;
     }
+    
+    public static function newFieldSupplement(&$game) {
+        if($game->store->storage == null){
+            $key = 1;
+            $key2 = 2;
+
+            $game->store->storage = ObjectInit();
+            $game->store->storage->$key = new Ins_storage();
+            $game->store->storage->$key2 = new Ins_storage();
+        }
+        
+        if($game->store->battleItem == null){
+            $game->store->battleItem = ObjectInit();
+        }
+    }
 
     /**
      * 6003 领取连续登录奖励