Ver código fonte

fixed: 任务卡叠加处理.

gwang 4 anos atrás
pai
commit
ab8d115ead

+ 36 - 14
Gameserver/Amfphp/configs/GameConfig.php

@@ -6,15 +6,15 @@ namespace loyalsoft;
 // 由CodeGenerator创建。
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // author: gwang 
-// 日期: 2020-08-19 09:31:51
+// 日期: 2020-11-12 11:48:48
 ////////////////////
 
 /**
  * 常量配置数据 
  */
 class GameConfig {
-// <editor-fold defaultstate="collapsed" desc="  基础代码 ">    
 
+// <editor-fold defaultstate="collapsed" desc="  基础代码 ">    
     /**
      * 是否启用codegen 
      */
@@ -75,7 +75,6 @@ class GameConfig {
     }
 
 // </editor-fold>
-
     /**
      * 全局参数
      * @return \globalsettings
@@ -374,12 +373,19 @@ class GameConfig {
     }
 
     /**
-     * 抽奖数据
-     * @return \choujiang
+     * 任务卡
+     * @return \item_taskcard
      */
-    public static function choujiang() {
+    public static function item_taskcard() {
         static $a = null;
-        return self::initValue($a, 'choujiang');
+        return self::initValue($a, 'item_taskcard');
+    }
+
+    /**
+     * @return \sm_item_taskcard item_taskcard item数据 
+     */
+    public static function item_taskcard_getItem($itemid) {
+        return self::get_hash_item('item_taskcard', $itemid);
     }
 
     /**
@@ -415,19 +421,19 @@ class GameConfig {
     }
 
     /**
-     * 关卡【副本】
-     * @return \gate_carbon
+     * 言灵附加随机表
+     * @return \item_additional
      */
-    public static function gate_carbon() {
+    public static function item_additional() {
         static $a = null;
-        return self::initValue($a, 'gate_carbon');
+        return self::initValue($a, 'item_additional');
     }
 
     /**
-     * @return \sm_gate_carbon gate_carbon item数据 
+     * @return \sm_item_additional item_additional item数据 
      */
-    public static function gate_carbon_getItem($itemid) {
-        return self::get_hash_item('gate_carbon', $itemid);
+    public static function item_additional_getItem($itemid) {
+        return self::get_hash_item('item_additional', $itemid);
     }
 
     /**
@@ -1328,6 +1334,22 @@ class GameConfig {
         return self::get_hash_item('shop_monthVIP', $itemid);
     }
 
+    /**
+     * 掉落数据表
+     * @return \drop
+     */
+    public static function drop() {
+        static $a = null;
+        return self::initValue($a, 'drop');
+    }
+
+    /**
+     * @return \sm_drop drop item数据 
+     */
+    public static function drop_getItem($itemid) {
+        return self::get_hash_item('drop', $itemid);
+    }
+
     /**
      * 当前版本(时间戳)
      * @return \ver

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-11-12 09:07:08
+ // 日期: 2020-11-12 14:11:05
 ////////////////////
 
 /**

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-11-05 14:22:52
+ // 日期: 2020-11-12 14:10:27
 ////////////////////
 
 

+ 3 - 3
Gameserver/Amfphp/model/User/TaskCardVo.php

@@ -43,17 +43,17 @@ class TaskCardVo {
     /**
      * @var type 这个物品在玩家身上唯一的id
      */
-    public $uid;
+    public $uid = 0;
 
     /**
      * @var type 当前数量
      */
-    public $count;
+    public $count = 1;
 
     /**
      * @var type 查询用的id
      */
-    public $typeId;
+    public $typeId = 0;
 
     /**
      * @var int 任务状态未完成/已完成:0/1

+ 25 - 5
Gameserver/Amfphp/process/StoreProc.php

@@ -512,11 +512,31 @@ class StoreProc {
             $req->userInfo->game->privateState->currentId = 1;
         }
         $cid = $req->userInfo->game->privateState->currentId++;
-        $taskCard = new TaskCardVo();
-        $taskCard->typeId = $itemId;
-        $taskCard->uid = $cid;
-        $req->userInfo->game->store->taskcards->$cid = $taskCard;
-        return $cid;
+        $mo = GameConfig::item_taskcard_getItem($itemId);                       // 任务卡常量
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        $itembaseMo = GameConfig::item_base_getItem($itemId);
+        my_Assert(null != $itembaseMo, ErrCode::err_const_no);
+        if ($itembaseMo->pileNum > 0) {                                         // 可叠加
+            $taskCard = null;
+            foreach ($req->userInfo->game->store->taskcards as $uuid => $val) {
+                isEditor() && $val = new TaskCardVo();
+                if ($val->typeId == $itemId) {
+                    $taskCard = $val;
+                    break;
+                }
+            }
+            if (null == $taskCard) {                                            # 原来么有
+                $taskCard = new TaskCardVo();
+                $taskCard->typeId = $itemId;
+            }
+            $taskCard->count += 1;
+        } else {
+            $taskCard = new TaskCardVo();
+            $taskCard->typeId = $itemId;
+            $taskCard->uid = $cid;
+            $req->userInfo->game->store->taskcards->$cid = $taskCard;
+        }
+//        return $cid;
 //        SystemProc::GetEquip($req->zoneid, $req->userInfo->game, $itemId);      # 添加获得装备的消息
     }