Browse Source

fixed: 修缮使用包裹中道具的接口.

王刚 3 years ago
parent
commit
48e420d6a4

+ 4 - 4
Gameserver/Amfphp/base/CmdCode.php

@@ -356,6 +356,7 @@ class CmdCode {
      * 任务卡商城 - 手动刷新
      */
     const cmd_taskcard_shop_refresh = 6233;
+
 //
 // </editor-fold>
     // </editor-fold>
@@ -1190,17 +1191,16 @@ class CmdCode {
      *  领取课程奖励
      */
     const cmd_college_ReceiveCourseReward = 7303;
-    
+
     /**
      * 积分兑换道具
      */
     const cmd_college_ScoreExchangeItem = 7304;
-    
+
     /**
-     * 
+     *
      */
     //const cmd_college_GetCollegeTaskCardData = 7305;
-
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="Auction操作码 - 74xx">
 

+ 13 - 2
Gameserver/Amfphp/model/User/Info_Store.php

@@ -16,7 +16,7 @@ class Info_Store extends Object_ext {
     public $items;
 
     /**
-     * 任务卡道具(存在叠加) 
+     * 任务卡道具(存在叠加)
      * @var array
      */
     public $taskcards;
@@ -67,8 +67,19 @@ class Info_Store extends Object_ext {
         return 0;
     }
 
+    function RemoveItemFromStore($typeId, $num) {
+        my_Assert(CommUtil::isPropertyExists($this->items, $typeId), ErrCode::store_itemno_err); # 没有这个道具
+        my_Assert($this->items->$typeId >= $num, ErrCode::store_itemnotenough); # 数量不足
+        $this->items->$typeId -= $num;
+        if ($this->items->$typeId == 0) {
+            unset($this->items->$typeId);
+        }
+        NormalEventProc::OnBag_Remove_Item($typeId, $num);                      # 插入事件
+        return ErrCode::ok;
+    }
+
     /**
-     * 扣除玩家碎片 
+     * 扣除玩家碎片
      * @param int $segmentId 碎片ID
      * @param int $amt  数量
      * @return boolean true 成功, false 失败

+ 1 - 1
Gameserver/Amfphp/process/EmailProc.php

@@ -156,7 +156,7 @@ class EmailProc {
             TaskProc::OnDrawSysMail($mail->sender_uid);
         }
         self::logMailDrawed(array($mailId), $uid, $zoneid);                     # 更新数据库中邮件的领取记录
-        UserProc::updateUserInfo();
+//        UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 同步数据
                     'store' => ctx()->store,
                     'hero' => ctx()->heros,

+ 19 - 1
Gameserver/Amfphp/process/StoreProc.php

@@ -323,7 +323,25 @@ class StoreProc {
      * [6404] 使用仓库道具
      */
     static function useItem() {
-        Err(ErrCode::msg_method_obsoleted, "代码需更新");
+        list($itemType, $num) = req()->paras;                                   # 提取参数
+        $mo = GameConfig::item_base_getItem($itemType);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        switch ($mo->subType) {
+            case 601:                                                           # 任务卡
+                my_Assert($num == 1, "任务卡一次只能使用一张!");
+                $store = req()->userInfo->game->store();
+                $err = $store->RemoveItemFromStore($itemType, $num);            # 扣除任务卡
+                my_Assert(ErrCode::ok == $err, $err);
+                StoreProc::PutTaskCardInStore($itemType);
+                req()->userInfo->game->store = $store;
+                break;
+            default :
+                break;
+        }
+        UserProc::updateUserInfo();
+        return Resp::ok(array('store' => req()->userInfo->game->store));
+
+//        Err(ErrCode::msg_method_obsoleted, "代码需更新");
     }
 
     /**