Browse Source

add 用户任务数据结构.

gwang 5 years ago
parent
commit
b9c2138ee7

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

@@ -237,6 +237,19 @@ class CmdCode {
      */
      */
     const cmd_user_friend_LookFriendInfo = 6118;
     const cmd_user_friend_LookFriendInfo = 6118;
 // </editor-fold>
 // </editor-fold>
+    //
+    // <editor-fold defaultstate="collapsed" desc="任务操作码 - 62xx">
+
+    /**
+     * [6201] 任务 - 拉取最新任务信息
+     */
+    const cmd_task_getInfo = 6201;
+
+    /**
+     * [6202] 任务 - 领取任务奖励
+     */
+    const cmd_task_getReward = 6202;
+    // </editor-fold>
     //
     //
     // <editor-fold defaultstate="collapsed" desc="英雄操作码 - 63xx">
     // <editor-fold defaultstate="collapsed" desc="英雄操作码 - 63xx">
 
 

+ 8 - 17
Gameserver/Amfphp/configs/GameConfig.php

@@ -6,7 +6,7 @@ namespace loyalsoft;
 // 由CodeGenerator创建。
 // 由CodeGenerator创建。
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // author: gwang 
 // author: gwang 
-// 日期: 2020-05-09 14:08:57
+// 日期: 2020-07-08 16:38:44
 ////////////////////
 ////////////////////
 
 
 /**
 /**
@@ -47,9 +47,7 @@ class GameConfig {
         $key = 'gamecfg-' . $modelName . self::zoneid();
         $key = 'gamecfg-' . $modelName . self::zoneid();
         if (is_null($a)) {
         if (is_null($a)) {
             if (self::isCG()) {
             if (self::isCG()) {
-//                var_dump("including " . $key . ".php");
                 $a = include $key . '.php';
                 $a = include $key . '.php';
-//                var_dump($a);
             } else {
             } else {
                 $a = $isHash ? gMem()->hgetall($key) : gMem()->get($key);
                 $a = $isHash ? gMem()->hgetall($key) : gMem()->get($key);
             }
             }
@@ -384,13 +382,6 @@ class GameConfig {
         return self::initValue($a, 'choujiang');
         return self::initValue($a, 'choujiang');
     }
     }
 
 
-    /**
-     * @return \sm_choujiang choujiang item数据 
-     */
-    public static function choujiang_getItem($itemid) {
-        return self::get_hash_item('choujiang', $itemid);
-    }
-
     /**
     /**
      * 无穷无尽关卡模式
      * 无穷无尽关卡模式
      * @return \gate_forever
      * @return \gate_forever
@@ -600,19 +591,19 @@ class GameConfig {
     }
     }
 
 
     /**
     /**
-     * 成就任务
-     * @return \task_achi
+     * 任务节点
+     * @return \task_node
      */
      */
-    public static function task_achi() {
+    public static function task_node() {
         static $a = null;
         static $a = null;
-        return self::initValue($a, 'task_achi');
+        return self::initValue($a, 'task_node');
     }
     }
 
 
     /**
     /**
-     * @return \sm_task_achi task_achi item数据 
+     * @return \sm_task_node task_node item数据 
      */
      */
-    public static function task_achi_getItem($itemid) {
-        return self::get_hash_item('task_achi', $itemid);
+    public static function task_node_getItem($itemid) {
+        return self::get_hash_item('task_node', $itemid);
     }
     }
 
 
     /**
     /**

+ 2 - 2
Gameserver/Amfphp/model/Const/sm_task.php

@@ -45,7 +45,7 @@ class sm_task
     public $taskrank;
     public $taskrank;
 
 
     /**
     /**
-    * @var String 任务类型  
+    * @var String 任务类型:  
     */
     */
     public $tasktype;
     public $tasktype;
 
 
@@ -60,7 +60,7 @@ class sm_task
     public $canshu2;
     public $canshu2;
 
 
     /**
     /**
-    * @var String 完成任务后的奖励物品id,num;id,num;...  
+    * @var String 完成任务后的奖励物品id,num;id,num  
     */
     */
     public $reward;
     public $reward;
 
 

+ 0 - 53
Gameserver/Amfphp/model/Const/sm_task_achi.php

@@ -1,53 +0,0 @@
-<?php
-
-////////////////////
- // 由CodeGenerator创建。
- // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
- // author: gwang 
- // 日期: 2020-02-12 08:05:40
-////////////////////
-
-
-/**
- * Static Model task_achi 成就任务
- */
-class sm_task_achi
-{
-
-    /**
-    * @var String 任务id  
-    */
-    public $typeId;
-
-    /**
-    * @var String 该成就任务是否存在父任务  
-    */
-    public $father;
-
-    /**
-    * @var String 任务名称  
-    */
-    public $name;
-
-    /**
-    * @var String 任务描述  
-    */
-    public $desc;
-
-    /**
-    * @var String 用途未知!!请到数据库中添加字段注释。  
-    */
-    public $tasktype;
-
-    /**
-    * @var String 用途未知!!请到数据库中添加字段注释。  
-    */
-    public $canshu;
-
-    /**
-    * @var String 用途未知!!请到数据库中添加字段注释。  
-    */
-    public $reward;
-
-}
-

+ 68 - 0
Gameserver/Amfphp/model/Const/sm_task_node.php

@@ -0,0 +1,68 @@
+<?php
+
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2020-07-08 11:14:25
+////////////////////
+
+
+/**
+ * Static Model task_node 任务节点
+ */
+class sm_task_node
+{
+
+    /**
+    * @var String 节点id  
+    */
+    public $typeId;
+
+    /**
+    * @var String 该节点的前置节点(解锁)  
+    */
+    public $preNode;
+
+    /**
+    * @var String 节点名称  
+    */
+    public $name;
+
+    /**
+    * @var String 节点描述  
+    */
+    public $desc;
+
+    /**
+    * @var String 任务列表(1~3个)  
+    */
+    public $taskList;
+
+    /**
+    * @var String 指挥官最低等级要求  
+    */
+    public $lvlLimit;
+
+    /**
+    * @var String 提示图标(小)  
+    */
+    public $tipIcon;
+
+    /**
+    * @var String 提示标题  
+    */
+    public $tipTitle;
+
+    /**
+    * @var String 提示卡片(大)  
+    */
+    public $tipCard;
+
+    /**
+    * @var String 提示内容  
+    */
+    public $tipText;
+
+}
+

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

@@ -136,6 +136,11 @@ class UserGameModel extends HashSaver {
      */
      */
     public $gates;
     public $gates;
 
 
+    /**
+     * @var UserTaskInfo 玩家任务数据
+     */
+    public $task;
+
     /**
     /**
      *
      *
      * @var UserPVPModel pvp信息
      * @var UserPVPModel pvp信息
@@ -185,6 +190,7 @@ class UserGameModel extends HashSaver {
         $this->privateState->currentId = count((array) $this->store->equipment) + 1;
         $this->privateState->currentId = count((array) $this->store->equipment) + 1;
         $this->heros->InitializeHero();                                         # 添加初始英雄
         $this->heros->InitializeHero();                                         # 添加初始英雄
         $this->pvp = new UserPVPModel();
         $this->pvp = new UserPVPModel();
+        $this->task->initialize();                                              # 任务初始化
     }
     }
 
 
     /**
     /**
@@ -205,6 +211,7 @@ class UserGameModel extends HashSaver {
             $this->NewbieGuide = ObjectInit();                                  # 初始化新手引导结构
             $this->NewbieGuide = ObjectInit();                                  # 初始化新手引导结构
             $this->pvp = new UserPVPModel();                                    # 初始化pvp模块
             $this->pvp = new UserPVPModel();                                    # 初始化pvp模块
             $this->userSecretshop = new userSecretshopModel();                  # 神秘商店
             $this->userSecretshop = new userSecretshopModel();                  # 神秘商店
+            $this->task = new UserTaskInfo();                                   # 任务数据
         } else {                                                                # 实参
         } else {                                                                # 实参
             parent::__construct($arg);                                          # 调用Object的构造函数
             parent::__construct($arg);                                          # 调用Object的构造函数
         }
         }

+ 66 - 0
Gameserver/Amfphp/model/User/UserTaskInfo.php

@@ -0,0 +1,66 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ * 玩家任务数据
+ * @author wanggangzero@qq.com
+ * @version 1.0.0 2020.7.8 created by gwang
+ */
+class UserTaskInfo {
+
+    /**
+     * 当前任务节点id
+     * @var int
+     */
+    public $curTaskNode;
+
+    /**
+     * 当前关注任务id
+     * @var int
+     */
+    public $curTaskId;
+
+    /**
+     * 剧情任务实例列表 {id:{progress:0.4,rewardgeted:0}...}
+     * @var dict
+     */
+    public $taskListPlot;
+
+    /**
+     * 每日任务实例列表 {id:{progress:0.4,rewardgeted:0}...}
+     * @var dict
+     */
+    public $taskListDaily;
+
+    public function __construct() {
+        $this->curTaskNode = 4000001;
+        $this->curTaskId = 0;
+        $this->taskListDaily = ObjectInit();
+        $this->taskListPlot = ObjectInit();
+    }
+
+    public function initialize() {
+        $nodeCfg = GameConfig::task_node_getItem($this->curTaskNode);
+        $taskArr = explode(',', $nodeCfg->taskList);
+        $this->curTaskId = $taskArr[0];
+    }
+
+}
+
+/**
+ * 任务信息
+ */
+class TaskInfo {
+
+    /**
+     * @var float 任务进度(浮点值好了>=1代表完成)
+     */
+    public $progress;
+
+    /**
+     * @var int 奖励是否已领取 0/1
+     */
+    public $rewardGeted;
+
+}

+ 62 - 3
Gameserver/Amfphp/process/TaskProc.php

@@ -2,6 +2,14 @@
 
 
 namespace loyalsoft;
 namespace loyalsoft;
 
 
+/**
+ * 1. 初始化玩家数据结构
+ * 2. 添加玩家数据同步功能.
+ * 3. API:拉取最新任务数据
+ * 4. API:领取任务奖励
+ * 
+ */
+
 /**
 /**
  * Description of TaskProc
  * Description of TaskProc
  * @version
  * @version
@@ -9,7 +17,58 @@ namespace loyalsoft;
  * @author gwang (mail@wanggangzero.cn)
  * @author gwang (mail@wanggangzero.cn)
  * @copyright ? 2017-11-3, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  * @copyright ? 2017-11-3, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  */
  */
-class TaskProc
-{
-//put your code here
+class TaskProc {
+
+    function procMain($req) {
+        switch ($req->cmd) {
+            case CmdCode::cmd_task_getInfo:                                     # 6201 刷新任务状态
+                return EmailProc::RefreshEmailList($req);
+            case CmdCode::cmd_task_getReward:                                   # 6202 领取任务奖励
+                return EmailProc::ReadEmail($req);
+            default:
+                return Err(ErrCode::cmd_err);
+        }
+    }
+
+    /**
+     * [6201]更新任务状态
+     * @param req $req
+     */
+    static function GetTaskInfo($req) {
+        
+    }
+
+    /**
+     * [6202]领取任务奖励 问:每日任务奖励和剧情任务奖励领取接口是否为一个?
+     * @param req $req
+     */
+    static function GetTaskReward($req) {
+        
+    }
+
+// 每日任务, 自动刷新
+// 
+// 
+
+    /**
+     * 检查任务条件是否达成
+     */
+    static function CheckTaskConditions() {
+        
+    }
+
+// 
+    // <editor-fold defaultstate="collapsed" desc="处理各种任务检测事务">
+    // 
+
+    /**
+     * 例如当指挥官等级提升的时候需要检查是否有任务达成
+     */
+    static function OnUserLevelUp() {
+        
+    }
+
+    // 
+// </editor-fold>
+    //
 }
 }

+ 2 - 0
Gameserver/Amfphp/test.php

@@ -15,3 +15,5 @@ $key_new = "wanggang";
 
 
 echoLine(sprintf("%s:%s", $key, $key_new));
 echoLine(sprintf("%s:%s", $key, $key_new));
 //var_dump(gMem()->zrevrangebyscore($key_new, 100, 1, $withScore));
 //var_dump(gMem()->zrevrangebyscore($key_new, 100, 1, $withScore));
+$arr = explode(',', "4001");
+var_dump($arr);

+ 12 - 1
Gameserver/nbproject/private/private.xml

@@ -12,8 +12,19 @@
     </editor-bookmarks>
     </editor-bookmarks>
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
         <group>
         <group>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/config.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/base/MemKey_Guild.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/UserTaskInfo.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/Const/sm_task.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/base/CmdCode.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/base/CmdCode.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/EmailProc.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/main.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/configs/GameConfig.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/globals.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/TaskProc.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/UserGameModel.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/config.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/ActiveProc/Day7Tasks.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/UserProfile.php</file>
         </group>
         </group>
     </open-files>
     </open-files>
 </project-private>
 </project-private>