Przeglądaj źródła

添加任务卡激活和领取奖励接口.

gwang 4 lat temu
rodzic
commit
b59462ba84
30 zmienionych plików z 2473 dodań i 287 usunięć
  1. 15 0
      Gameserver/Amfphp/base/CmdCode.php
  2. 10 0
      Gameserver/Amfphp/base/ErrCode.php
  3. 1 1
      Gameserver/Amfphp/model/Const/GameConfig.php
  4. 1 1
      Gameserver/Amfphp/model/Const/sm_errmsg.php
  5. 1 1
      Gameserver/Amfphp/model/Const/sm_gatelevel.php
  6. 1 1
      Gameserver/Amfphp/model/Const/sm_hero.php
  7. 1 1
      Gameserver/Amfphp/model/Const/sm_item_base.php
  8. 1 1
      Gameserver/Amfphp/model/Const/sm_item_taskcard.php
  9. 4 4
      Gameserver/Amfphp/model/Const/sm_task_step.php
  10. 6 6
      Gameserver/Amfphp/model/User/Data_UserGame.php
  11. 66 0
      Gameserver/Amfphp/model/User/Enum_EventType.php
  12. 38 0
      Gameserver/Amfphp/model/User/Enum_PropelType.php
  13. 36 0
      Gameserver/Amfphp/model/User/Enum_TaskCardStateType.php
  14. 1 33
      Gameserver/Amfphp/model/User/Enum_TaskCmdType.php
  15. 20 20
      Gameserver/Amfphp/model/User/Info_UserTask.php
  16. 44 0
      Gameserver/Amfphp/model/User/Ins_TaskEventArgs.php
  17. 0 6
      Gameserver/Amfphp/model/User/Ins_TaskParams.php
  18. 84 49
      Gameserver/Amfphp/model/User/Ins_TaskStep.php
  19. 128 0
      Gameserver/Amfphp/model/User/del_Info_MissInfo.php
  20. 64 0
      Gameserver/Amfphp/model/User/del_Ins_MisCardIns.php
  21. 159 0
      Gameserver/Amfphp/model/User/del_Ins_MisStatus.php
  22. 386 0
      Gameserver/Amfphp/model/User/del_Ins_MissEventCode.php
  23. 54 0
      Gameserver/Amfphp/model/User/del_Ins_MissEventInfo.php
  24. 28 62
      Gameserver/Amfphp/process/EventProc/NormalEventProc.php
  25. 1 1
      Gameserver/Amfphp/process/HeroProc.php
  26. 2 1
      Gameserver/Amfphp/process/StoreProc.php
  27. 124 81
      Gameserver/Amfphp/process/TaskProc.php
  28. 1166 0
      Gameserver/Amfphp/process/del_MissProc.php
  29. 16 12
      Gameserver/Amfphp/test.php
  30. 15 6
      Gameserver/nbproject/private/private.xml

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

@@ -271,6 +271,7 @@ class CmdCode {
     const cmd_Task_getActiveReward = 6204;
     // <editor-fold defaultstate="collapsed" desc="任务卡相关通讯">
     // 
+
     /**
      * 任务卡 - 剧情触发任务结束
      */
@@ -278,16 +279,19 @@ class CmdCode {
 
     /**
      * 任务卡 - 剧情回收任务卡
+     * @deprecated since version 2020.12.12
      */
     const cmd_taskCard_PlotExchangeTaskCard = 6211;
 
     /**
      * 任务卡 - 剧情赠与任务卡
+     * @deprecated since version 2020.12.12
      */
     const cmd_taskCard_PlotPresentTaskCard = 6212;
 
     /**
      * 任务卡 - 即时结算
+     * @deprecated since version 2020.12.12
      */
     const cmd_taskCard_FinishAndReward = 6213;
 
@@ -295,6 +299,17 @@ class CmdCode {
      * 任务卡 - 杀死怪物事件
      */
     const cmd_taskCard_onKillMonster = 6214;
+
+    /**
+     * 任务卡 - 激活
+     */
+    const cmd_taskCard_active = 6215;
+
+    /**
+     * 任务卡 - 领取奖励
+     */
+    const cmd_taskCard_reward = 6216;
+
     // 
 // </editor-fold>
     // </editor-fold>

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

@@ -551,6 +551,16 @@ class ErrCode {
      * 任务卡未找到
      */
     const taskCard_no = 3510;
+
+    /**
+     * 任务卡-不可堆叠
+     */
+    const taskCard_no_pile = 3511;
+
+    /**
+     * 任务卡-状态错误
+     */
+    const taskCard_state = 3512;
 // </editor-fold>
     // 
     // <editor-fold defaultstate="collapsed" desc="    交互操作 36xx    ">

+ 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-12-11 10:14:50
+ // 日期: 2020-12-12 14:33:24
 ////////////////////
 
 /**

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-11-17 14:22:46
+ // 日期: 2020-12-12 13:41:59
 ////////////////////
 
 

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-12-04 10:40:53
+ // 日期: 2020-12-11 16:41:52
 ////////////////////
 
 

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-11-23 19:05:41
+ // 日期: 2020-12-11 16:39:36
 ////////////////////
 
 

+ 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-26 18:01:52
+ // 日期: 2020-12-12 13:38:39
 ////////////////////
 
 

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-11-19 21:45:21
+ // 日期: 2020-12-11 15:28:27
 ////////////////////
 
 

+ 4 - 4
Gameserver/Amfphp/model/Const/sm_task_step.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-12-09 13:52:40
+ // 日期: 2020-12-11 16:59:25
 ////////////////////
 
 
@@ -35,7 +35,7 @@ class sm_task_step
     public $minlv;
 
     /**
-    * @var Int32 任务品质: 1白色, 2绿色, 3蓝色, 4紫色, 5橙色, 6红色 default(0) 
+    * @var Int32 【用于任务卡任务时未启用】任务品质: 1白色, 2绿色, 3蓝色, 4紫色, 5橙色, 6红色 default(0) 
     */
     public $qual;
 
@@ -70,12 +70,12 @@ class sm_task_step
     public $cmd;
 
     /**
-    * @var String 参数 (若参数为多个,需要自己跟策划约定好解析规则)  
+    * @var String 参数 (若参数为多个,需要自己跟策划约定好解析规则)这里面都是用的==判断  
     */
     public $paras;
 
     /**
-    * @var Int32 条件计数 (max) default(0) 
+    * @var Int32 条件计数 (max)(>=max) default(1) 
     */
     public $num;
 

+ 6 - 6
Gameserver/Amfphp/model/User/Data_UserGame.php

@@ -49,10 +49,10 @@ class Data_UserGame extends HashSaver {
      */
     public $gates;
 
-    /**
-     * @var Info_UserTask 玩家任务数据
-     */
-    public $task;
+//    /**
+//     * @var Info_UserTask 玩家任务数据
+//     */
+//    public $task;
 
     /**
      *
@@ -98,7 +98,7 @@ class Data_UserGame extends HashSaver {
         $this->privateState->currentId = count((array) $this->store->equipment) + 1;
         $this->heros->InitializeHero();                                         # 添加初始英雄
         $this->pvp = new Info_UserPVP();
-        $this->task->initialize();                                              # 任务初始化
+//        $this->task->initialize();                                              # 任务初始化
     }
 
     /**
@@ -119,7 +119,7 @@ class Data_UserGame extends HashSaver {
             $this->NewbieGuide = ObjectInit();                                  # 初始化新手引导结构
 //            $this->pvp = new UserPVPModel();                                    # 初始化pvp模块
             $this->userSecretshop = new Info_UserSecretshop();                  # 神秘商店
-            $this->task = new Info_UserTask();                                   # 任务数据
+//            $this->task = new Info_UserTask();                                   # 任务数据
         } else {                                                                # 实参
             parent::__construct($arg);                                          # 调用Object的构造函数
         }

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

@@ -0,0 +1,66 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ *  事件类型定义
+ *  author: gwang, 2020年11月30日17:56:01
+ */
+class Enum_EventType {
+
+    /**
+     * hello world
+     */
+    const HelloWorld = "HelloWorld";
+
+    /**
+     * 给予道具
+     */
+    const AddItem = "AddItem";
+
+    /**
+     * 移除道具
+     */
+    const RemoveItem = "RemoveItem";
+
+    /**
+     * 给予任务
+     */
+    const AddTaskItem = "AddTaskItem";
+
+    /**
+     * 移除任务
+     */
+    const RemoveTaskItem = "RemoveTaskItem";
+
+    /**
+     * 完成任务步骤
+     */
+    const MissionStepComplete = "MissionStepComplete";
+
+    /**
+     * 任务卡完成
+     */
+    const TaskCardFinished = "TaskCardFinished";
+
+    /**
+     * 激活一张任务卡
+     */
+    const TaskCardActived = "TaskCardActived";
+
+    /**
+     * 领取任务卡奖励
+     */
+    const TaskCardReward = "TaskCardReward";
+
+    /**
+     * 开启一段剧情对话
+     */
+    const StartPlot = "StartPlot";
+
+    /**
+     * 开启npc对话
+     */
+    const NpcDialog = "NpcDialog";
+
+}

+ 38 - 0
Gameserver/Amfphp/model/User/Enum_PropelType.php

@@ -0,0 +1,38 @@
+<?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 Enum_PropelType
+ * 任务步骤推进类型
+ * @author gwang
+ */
+class Enum_PropelType extends Enum {
+
+    /**
+     * 直接设置某个值
+     */
+    public const set = 0;
+
+    /**
+     * 直接增加某个值
+     */
+    public const add = 1;
+
+    /**
+     * 累加1
+     */
+    public const inc = 2;
+
+    /**
+     * 设置最大值
+     */
+    public const max = 3;
+
+}

+ 36 - 0
Gameserver/Amfphp/model/User/Enum_TaskCardStateType.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ * 任务卡状态类型
+ * @author gwang
+ */
+class Enum_TaskCardStateType {
+
+    /**
+     * 全部
+     */
+    const all = 0;
+
+    /**
+     * 未开启(未激活)
+     */
+    const notopen = 1;
+
+    /**
+     * 进行中(已激活)
+     */
+    const ing = 2;
+
+    /**
+     * 已完成(未领奖)
+     */
+    const finish = 3;
+
+    /**
+     * 已领奖(可能会被删除)
+     */
+    const drawed = 4;
+
+}

+ 1 - 33
Gameserver/Amfphp/model/User/EnumTaskType.php → Gameserver/Amfphp/model/User/Enum_TaskCmdType.php

@@ -5,7 +5,7 @@ namespace loyalsoft;
 /**
  * 任务类型枚举 用于任务进度对比,参数传递.
  */
-class EnumTaskType extends Enum {
+class Enum_TaskCmdType extends Enum {
 
     const CommanderLevelUpTo = 11;
     const HeroLevelUpTo = 12;
@@ -31,35 +31,3 @@ class EnumTaskType extends Enum {
     const PlotOver = 203;
 
 }
-
-/**
- * 任务卡状态类型
- */
-class TaskCardStateType {
-
-    /**
-     * 全部
-     */
-    const all = 0;
-
-    /**
-     * 未开启(未激活)
-     */
-    const notopen = 1;
-
-    /**
-     * 进行中(已激活)
-     */
-    const ing = 2;
-
-    /**
-     * 已完成(未领奖)
-     */
-    const finish = 3;
-
-    /**
-     * 已领奖(可能会被删除)
-     */
-    const drawed = 4;
-
-}

+ 20 - 20
Gameserver/Amfphp/model/User/Info_UserTask.php

@@ -99,11 +99,11 @@ class Info_UserTask extends Object_ext {
             $task = new Ins_TaskInfo($task);
             my_Assert(null != $tmo, ErrCode::err_const_no);
             switch ($tmo->tasktype) {                                               # 有可能添加任务的时候, 任务就已经完成了. 所以这里需要直接做一个检查...
-                case EnumTaskType::CommanderLevelUpTo:
-                    $taskParam = new Ins_TaskParams(EnumTaskType::CommanderLevelUpTo, req()->userInfo->game->baseInfo->level);
+                case Enum_TaskCmdType::CommanderLevelUpTo:
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::CommanderLevelUpTo, req()->userInfo->game->baseInfo->level);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::HeroLevelUpTo:
+                case Enum_TaskCmdType::HeroLevelUpTo:
                     $heroMoId = $tmo->canshu1;
                     $userHeros = new Info_UserGameHero(req()->userInfo->game->heros);
                     $hero = $userHeros->GetHeroByMoID($heroMoId);
@@ -111,10 +111,10 @@ class Info_UserTask extends Object_ext {
                     if ($hero != null) {
                         $level = $hero->level;
                     }
-                    $taskParam = new Ins_TaskParams(EnumTaskType::HeroLevelUpTo, $hero->typeId, $hero->level);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroLevelUpTo, $hero->typeId, $hero->level);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::HeroGradeUpTo:
+                case Enum_TaskCmdType::HeroGradeUpTo:
                     $heroMoId = $tmo->canshu1;
                     $userHeros = new Info_UserGameHero(req()->userInfo->game->heros);
                     $hero = $userHeros->GetHeroByMoID($heroMoId);
@@ -122,17 +122,17 @@ class Info_UserTask extends Object_ext {
                     if ($hero != null) {
                         $level = $hero->grade;
                     }
-                    $taskParam = new Ins_TaskParams(EnumTaskType::HeroLevelUpTo, $heroMoId, $level);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroLevelUpTo, $heroMoId, $level);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::HeroSegmentNumberTo:
+                case Enum_TaskCmdType::HeroSegmentNumberTo:
                     $segId = $tmo->canshu1;
                     $store = new Info_Store(req()->userInfo->game->store);
                     $num = $store->GetItemCount($segId);
-                    $taskParam = new Ins_TaskParams(EnumTaskType::HeroSegmentNumberTo, $segId, $num);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSegmentNumberTo, $segId, $num);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::HeroSkillUnlock:
+                case Enum_TaskCmdType::HeroSkillUnlock:
                     $heroMoId = $tmo->canshu1;
                     $userHeros = new Info_UserGameHero(req()->userInfo->game->heros);
                     $hero = $userHeros->GetHeroByMoID($heroMoId);
@@ -143,10 +143,10 @@ class Info_UserTask extends Object_ext {
                     if ($hero != null && in_array($tmo->canshu2, $hero->subSkills->$mSkillId)) {
                         $subSkillId = $tmo->canshu2;
                     }
-                    $taskParam = new Ins_TaskParams(EnumTaskType::HeroSkillUnlock, $heroMoId, $subSkillId);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSkillUnlock, $heroMoId, $subSkillId);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::PassGateN:
+                case Enum_TaskCmdType::PassGateN:
                     $gateId = $tmo->canshu1;
                     $diffculty = $tmo->canshu2;
                     $gates = req()->userInfo->game->gates->normal;
@@ -164,32 +164,32 @@ class Info_UserTask extends Object_ext {
                             $gates = req()->userInfo->game->gates->normal;
                             break;
                     }
-                    $taskParam = new Ins_TaskParams(EnumTaskType::PassGateN, $gates->highest, $diffculty);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PassGateN, $gates->highest, $diffculty);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::passCarbonN:
+                case Enum_TaskCmdType::passCarbonN:
                     break;
-                case EnumTaskType::PvPWinNumberTo:
+                case Enum_TaskCmdType::PvPWinNumberTo:
                     $pvp = new Info_UserPVP(req()->userInfo->game->pvp);                       # 设计玩家pvp数据结构
-                    $taskParam = new Ins_TaskParams(EnumTaskType::PvPWinNumberTo, $pvp->totalWin); # 任务参数
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPWinNumberTo, $pvp->totalWin); # 任务参数
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::PvPScoreTo:
+                case Enum_TaskCmdType::PvPScoreTo:
                     $uid = req()->uid;                                                         # 快速访问UID
                     $zoneid = req()->zoneid;                                                   # 快速访问zoneid
                     $seasonId = PVPProc::GetCurSeasonID();                                     # 当前赛季ID
                     $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, $seasonId); # 积分总榜
                     $score = self::_getScore_by_uid($uid, $key);                               # 玩家积分
-                    $taskParam = new Ins_TaskParams(EnumTaskType::PvPScoreTo, $score);             # 任务参数
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPScoreTo, $score);             # 任务参数
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::UserPowerTo:
+                case Enum_TaskCmdType::UserPowerTo:
                     $key = MemKey_GameRun::Game_FightPowerRank_zset(req()->zoneid);            # redis key 
                     $power = gMem()->zscore($key, req()->uid);                                 # 查询战斗力
-                    $taskParam = new Ins_TaskParams(EnumTaskType::UserPowerTo, $power);
+                    $taskParam = new Ins_TaskParams(Enum_TaskCmdType::UserPowerTo, $power);
                     $task->bCheckProgress($taskParam);
                     break;
-                case EnumTaskType::UserCollectScoreTo:
+                case Enum_TaskCmdType::UserCollectScoreTo:
                     break;
             }
         }

+ 44 - 0
Gameserver/Amfphp/model/User/Ins_TaskEventArgs.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ * 任务卡新增的, 任务事件检测参数
+ * @author gwang
+ */
+class Ins_TaskEventArgs {
+
+    /**
+     * @param Enum_TaskCmdType $cmd 事件码/
+     * @param Enum_PropelType $ope
+     * @param int $val
+     * @param array $paras
+     */
+    public function __construct($cmd, $ope, $val, $paras = array()) {
+        $this->taskType = $cmd;
+        $this->ope = $ope;
+        $this->val = $val;
+        $this->paras = $paras;
+    }
+
+    /**
+     * @var Enum_TaskCmdType 任务类型/事件码
+     */
+    public $taskType;
+
+    /**
+     * @var Enum_PropelType
+     */
+    public $ope = Enum_PropelType::set;
+
+    /**
+     * @var 值
+     */
+    public $val = 1;
+
+    /**
+     * @var array
+     */
+    public $paras;
+
+}

+ 0 - 6
Gameserver/Amfphp/model/User/Ins_TaskParams.php

@@ -1,11 +1,5 @@
 <?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;
 
 /**

+ 84 - 49
Gameserver/Amfphp/model/User/Ins_TaskStep.php

@@ -3,7 +3,8 @@
 namespace loyalsoft;
 
 /**
- * 任务步骤
+ * 任务步骤, 用于任务卡功能(三组合一)
+ * @author gwang(wanggangzero@qq.com)
  */
 class Ins_TaskStep extends Object_ext {
 
@@ -13,32 +14,52 @@ class Ins_TaskStep extends Object_ext {
     public $typeId = 0;
 
     /**
-     * @var float 任务进度(浮点值好了>=1代表完成)
+     * @var int 计数器
      */
-    public $progress = 0;
+    public $cur = 0;
 
     /**
-     * 用于将进度更新的数据待会给客户端,比如当前PVP积分之类的,在客户端是无法即时拿到数据的
-     * @var object
+     * @return \sm_task_step mo 获取对应的模板数据
      */
-    public $tag1;
-    public $tag2;
+    public function mo() {
+        $mo = GameConfig::task_step_getItem($this->typeId);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
 
     /**
-     * @var int 计数器
+     * @return int 计数最大值
      */
-    public $counter = 0;
+    public function max() {
+        return $this->mo()->num;
+    }
 
     /**
-     * @return \sm_task_step mo
+     * @return string[] 参数数组
      */
-    public function mo() {
-//        var_dump($this->typeId);
-        $mo = GameConfig::task_step_getItem($this->typeId);
-        my_Assert(null != $mo, ErrCode::err_const_no);
-        return $mo;
+    private function paras() {
+        return explode(',', $this->mo()->paras);
+    }
+
+    /**
+     * @return float 当前进度
+     */
+    public function progress() {
+        return $this->cur / $this->max();
     }
 
+    /**
+     * 是否完成
+     * @return bool
+     */
+    public function isFinish() {
+        return $this->cur >= $this->max();
+    }
+
+    /**
+     * 构造函数
+     * @param type $args
+     */
     public function __construct($args) {
         if (isInt($args)) {
             $this->typeId = $args;
@@ -48,49 +69,63 @@ class Ins_TaskStep extends Object_ext {
     }
 
     /**
-     * @param Ins_TaskParams $taskParam
+     * 检查任务条件(与petmini采用相同的参数和判定方法2020年12月12日11:38:02)
+     * @param Ins_TaskEventArgs $taskCardEvent
      * @return bool
      */
-    public function check($taskParam) {
-        if ($this->progress >= 1) {
+    public function check_new($taskCardEvent) {
+        if ($this->isFinish()) {
             return true;
         }
-
-        if ($taskParam->taskType == $this->mo()->cmd) {
-
-            if (null == $this->mo()->canshu1) {
-                $this->progress = 1;
-                return true;
-            }
-
-            if ($this->mo()->canshu1 == $taskParam->canshu1) {
-
-                $this->tag1 = $taskParam->canshu1;
-                if (null == $this->mo()->canshu2 || 0 == $this->mo()->canshu2) {
-                    $this->progress = 1;
-                    $this->tag2 = $taskParam->canshu2;
-                    return true;
-                } else {
-
-                    if (is_numeric($this->mo()->canshu2)) {
-                        $this->tag2 = max($this->tag2, $taskParam->canshu2);
-                        if ($this->mo()->canshu2 <= $taskParam->canshu2) {
-                            $this->progress = 1;
-                            return true;
-                        }
-                    } else {
-
-                        $this->tag2 = $taskParam->canshu2;
-                        if ($this->mo()->canshu2 == $taskParam->canshu2) {
-                            $this->progress = 1;
-                            return true;
+        if ($taskCardEvent->taskType == $this->mo()->cmd) {                     # 事件类型匹配
+            return false;
+        }
+        if (strlen($this->mo()->paras) <= 0) {                                  # 无参数
+            return true;
+        }
+        $paras = $this->paras();
+        $index = 0;
+        foreach ($taskCardEvent->paras as $para) {
+            if ($index < count($paras)) {
+                if (strpos($para, "|") !== false) {                             # 某个条件是"或"的关系, 即有多重可能值, 满足其一即可
+                    $paraList = explode("|", $para);
+                    foreach ($paraList as $paraItem) {
+                        if ($paraItem == $paras[$index]) {
+                            continue;                                           # 满足某一个即可, 继续判断下一个条件.
                         }
                     }
+                } else {                                                        # only one, 不存在"或"的判定
+                    if ($paras[$index] != 0 && $para != $paras[$index]) {       # 直接匹配
+                        return false;                                           # 一但没匹配上, 直接返回false就好了.
+                    }
                 }
-            }
+            }                                                                   # 参数中多余的数据就直接跳过,不比较了(因为自己不需要判断那么多参数)
+            $index++;
         }
+        return true;                                                            # 走到最后则判定满足条件.
+    }
 
-        return false;
+    /**
+     * 推进任务进度(采用和petmini相同的推进算法,2020年12月12日11:38:22)
+     * @param Ins_TaskEventArgs $taskParam
+     */
+    public function propel($taskParam) {
+        switch ($taskParam->ope) {
+            case Enum_PropelType::set:
+                $this->cur = $taskParam->val;
+                break;
+            case Enum_PropelType::add:
+                $this->cur += $taskParam->val;
+                break;
+            case Enum_PropelType::inc:
+                $this->cur += 1;
+                break;
+            case Enum_PropelType::max:
+                if ($taskParam->val > $this->cur) {
+                    $this->cur = $taskParam->val;
+                }
+                break;
+        }
     }
 
 }

+ 128 - 0
Gameserver/Amfphp/model/User/del_Info_MissInfo.php

@@ -0,0 +1,128 @@
+<?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.
+ */
+
+/**
+ * Description of UserMissEx
+ * 
+ * @author jgao
+ */
+class Info_MissInfo {
+    //put your code here
+
+    /**
+     * 正在进行中的任务
+     * @var MisStatus 
+     */
+    public $ingMissions = null;
+    /// <summary>
+    /// 已经完成的任务
+    /// </summary>
+    public $overMissions = null;
+
+    /**
+     * 未完待续的任务
+     * @var type 
+     */
+    public $contMissions = null;
+
+    /**
+     * 构造函数 
+     */
+    function __construct() {
+        $this->ingMissions = new stdClass();
+        $this->overMissions = new stdClass();
+        $this->contMissions = new stdClass();
+    }
+
+    function initialize($value) {
+        CommUtil::loadObject($value, $this);
+        foreach ($this->ingMissions as $id => $val) { // 强类型化
+            $ing = new MisStatus();
+            $ing->initialize($val);
+            $this->ingMissions->$id = $ing;
+        }
+    }
+
+    /// <summary>
+    /// 设置任务数据
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="mo"></param>
+    public function setMission($id, $ing) {
+        if ($id == 0)
+            return;
+        $this->ingMissions->$id = $ing;
+    }
+
+    /**
+     * 
+     * @param type $id
+     * @return MisStatus
+     */
+    public function GetMission($id) {
+        if (dict_exists($this->ingMissions, $id)) {
+            return $this->ingMissions->$id;
+        }
+        return null;
+    }
+
+    /// <summary>
+    /// 新增触发任务
+    /// </summary>
+    /// <param name="id"></param>
+    public function addMission($id) {
+        if ($id == 0) {
+            return null;
+        }
+        $mo = dataCenter()->getMissionConst($id);
+        $status = MisStatus::initFromMo($mo);
+        $this->setMission($id, $status);
+        return $status;
+    }
+
+    /// <summary>
+    /// 是否挂载某个任务
+    /// </summary>
+    /// <param name="id"></param>
+    /// <returns></returns>
+    public function hasMission($id) {
+        return dict_exists($this->ingMissions, $id);
+    }
+
+    /// <summary>
+    /// 删除某个任务
+    /// </summary>
+    /// <param name="id"></param>
+    public function delMission($id) {
+        if ($this->hasMission($id)) {
+            dict_remove($this->ingMissions, $id);
+        }
+    }
+
+    /// <summary>
+    /// 某任务是否曾经完成过
+    /// </summary>
+    /// <param name="id"></param>
+    /// <returns></returns>
+    public function onceFinished($id) {
+        return dict_exists($this->overMissions, $id);
+    }
+
+    /// <summary>
+    /// 完成某个任务
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="suc"></param>
+    public function finishMission($id) {
+        if ($this->hasMission($id)) {
+            $this->delMission($id);
+            $this->overMissions->$id = "ok";
+        }
+    }
+
+}

+ 64 - 0
Gameserver/Amfphp/model/User/del_Ins_MisCardIns.php

@@ -0,0 +1,64 @@
+<?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.
+ */
+
+/**
+ * Description of MisCardIns
+ * 任务卡实例
+ * @author jgao
+ */
+class MisCardIns {
+    //put your code here
+    
+    /**
+     * 实例id
+     * @var type 
+     */
+    public $id = 0;
+    
+    /**
+     * 模板id
+     * @var type 
+     */
+    public $tid = 0;
+    
+    /**
+     * 任务卡状态
+     * @var type 
+     */
+    public $state = 0;
+    
+    /**
+     * 当前时间戳
+     * @var type 
+     */
+    public $ts = 0;
+    
+    /**
+     * 任务卡状态
+     */
+    public function getState(){
+        if($this->state != MissionCardStateType::ing){
+            return $this->state;
+        }
+        $mo = dataCenter()->getMissionCardData($this->tid);
+        $misslist = strsplit_raw($mo->misslist);
+        $missInfo = usrInfo()->missInfo();
+        $bSign = true;
+        foreach ($misslist as $missId){
+            if(!$missInfo->onceFinished($missId)){
+                $bSign = false;
+                break;
+            }
+        }
+        if($bSign){
+            $this->state = MissionCardStateType::finish;
+        }
+        return $this->state;
+    }
+    
+}

+ 159 - 0
Gameserver/Amfphp/model/User/del_Ins_MisStatus.php

@@ -0,0 +1,159 @@
+<?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.
+ */
+
+/**
+ * Description of MisStatus
+ * 任务状态信息
+ * @author jgao
+ */
+class MisStatus {
+
+    //put your code here
+    /// <summary>
+    /// id
+    /// </summary>
+    public $id = 0;
+    /// <summary>
+    /// 类型
+    /// </summary>
+    public $type = 0;
+    /// <summary>
+    /// 命令码
+    /// </summary>
+    public $cmd = 0;
+    /// <summary>
+    /// 参数集
+    /// </summary>
+    public $paras = array();
+    /// <summary>
+    /// 当前计数
+    /// </summary>
+    public $cur = 0;
+    /// <summary>
+    /// 最大计数
+    /// </summary>
+    public $max = 0;
+    /// <summary>
+    /// 触发任务
+    /// </summary>
+    public $next = 0;
+    /// <summary>
+    /// 最低等级
+    /// </summary>
+    public $minlv = 0;
+    
+    /**
+     * 所属任务卡
+     * @var type 
+     */
+    public $card = 0;
+    
+    /**
+     * 扩展数据
+     * @var type 
+     */
+    public $exdatas = array();
+
+    function initialize($value) {
+        CommUtil::loadObject($value, $this);
+    }
+
+    /// <summary>
+    /// 是否完成
+    /// </summary>
+    public function isFinish() {
+        return $this->cur >= $this->max;
+    }
+
+    /// <summary>
+    /// 由原始模型执行初始化
+    /// </summary>
+    /// <param name="mo"></param>
+    /// <returns></returns>
+    public static function initFromMo($mo) {
+        $mis = new MisStatus();
+        $mis->id = $mo->id;
+        $mis->type = $mo->type;
+        $mis->cmd = $mo->cmd;
+        $mis->paras = strsplit($mo->paras);
+        $mis->cur = self::calcStatusCur($mo);
+        $mis->max = $mo->num;
+        $mis->next = $mo->next;
+        $mis->minlv = $mo->minlv;
+
+        return $mis;
+    }
+
+    /**
+     * 是否状态型任务
+     * @param type $cmd
+     */
+    static function isStatusType($cmd) {
+        return
+                $cmd == MissEventCode::Evn_User_Levelup ||
+                $cmd == MissEventCode::SEvn_Habitat_Own ||
+                $cmd == MissEventCode::SEvn_Farm_Own ||
+                $cmd == MissEventCode::SEvn_Build_Own ||
+                $cmd == MissEventCode::SEvn_Pet ||
+                $cmd == MissEventCode::SEvn_Explore_GridOwn;
+    }
+
+    /**
+     * 自动对齐可能出现统计失误的状态型任务计数
+     */
+    function autoCalcStatusCur() {
+        if (self::isStatusType($this->cmd)) {
+            $mo = dataCenter()->getMissionConst($this->id);
+            if ($mo != null) {
+                $cur = self::calcStatusCur($mo);
+                if ($this->cur < $cur) {
+                    $this->cur = $cur;
+                }
+                if ($this->max > $mo->num) {
+                    $this->max = $mo->num;
+                }
+            }
+        }
+    }
+
+    static function calcStatusCur($mo) {
+        $paras = strsplit($mo->paras);
+        $para0 = "";
+        $para1 = "";
+        $para2 = "";
+
+        if (array_count($paras) >= 1) {
+            $para0 = $paras[0];
+        }
+
+        if (array_count($paras) >= 2) {
+            $para1 = $paras[1];
+        }
+
+        if (array_count($paras) >= 3) {
+            $para2 = $paras[2];
+        }
+
+        switch ($mo->cmd) {
+            case MissEventCode::Evn_User_Levelup: // 第一个状态事件
+                return usrInfo()->baseInfo()->level;
+            case MissEventCode::SEvn_Habitat_Own:
+                return MissProc::GetBuildingNum(INIT_HABITID, $para0, $para1);
+            case MissEventCode:: SEvn_Farm_Own:
+                return MissProc::GetBuildingNum(INIT_Farm, $para0, $para1);
+            case MissEventCode:: SEvn_Build_Own:
+                return MissProc::GetBuildingNum($para0, $para1, $para2);
+            case MissEventCode:: SEvn_Pet:
+                return MissProc::GetPetNum($para0, $para1, $para2);
+            case MissEventCode:: SEvn_Explore_GridOwn:
+                return MissProc::GetExlporeGridNum($para0);
+        }
+        return 0;
+    }
+
+}

+ 386 - 0
Gameserver/Amfphp/model/User/del_Ins_MissEventCode.php

@@ -0,0 +1,386 @@
+<?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.
+ */
+
+/**
+ * Description of MissEventCode
+ *
+ * @author jgao
+ */
+class MissEventCode {
+
+    //put your code here
+
+    const isServerLogic = true;
+
+    //#region ----------->玩家事件
+
+    /**
+     * [状态] 玩家升级事件
+     * 无参数
+     * 计数:目标等级
+     */
+    const Evn_User_Levelup = 101;
+
+    /**
+     * 玩家食物发生变化
+     * 参数一:特定食物类型,无限定填0
+     *  计数:要求数目
+     */
+    const Evn_User_Food = 102;
+
+    //#endregion
+    //#region -----------> 领地事件
+
+    /**
+     * 建造一个领地    /    建造一个指定领地	
+     * 参数一:特定建筑ID,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Habitat_Build = 201;
+
+    /**
+     * 拥有一个领地     /     拥有一个指定领地	/ 拥有一个特定 等级领地
+     * 
+     * 参数一:特定栖息地类型(金木水火土),无限定填0
+     * 
+     * 参数二:特定等级,无限定填0
+     * 计数:要求数目
+     */
+    const SEvn_Habitat_Own = 251;
+
+    /**
+     *  升级一个领地	/    升级一个指定领地
+     * 
+     * 参数一:特定建筑ID,无限定填0
+     * 参数二:特定目标等级,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Habitat_LevelUp = 202;
+
+    /**
+     * 收取一次金币操作   
+     * 【行为的计数 】
+     * 
+     * 参数一:特定领地类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Habitat_CollectGold = 203;
+
+    /**
+     * 栖息地 金币收集累计  
+     * 【金币的计数 】
+     * 
+     * 参数一:特定领地类型,无限定填0
+     * 计数:要求数目
+     */
+    const SEvn_Habitat_CollectGold = 253;
+
+    //#endregion
+    //#region ----------->农田
+
+    /**
+     * 建造一个农田	
+     * 参数一:特定建筑ID,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Farm_Build = 301;
+
+    /**
+     * 拥有一个农田   /   拥有一个指定农田	/拥有一个指定等级的农田
+     * 
+     * 参数一:特定类型,无限定填0 (万一农田以后出其他类型呢) 
+     * 
+     * 参数二:特定等级,无限定填0
+     * 
+     * 计数:要求数目
+     */
+    const SEvn_Farm_Own = 351;
+
+    /**
+     * 升级一个农田	 
+     * 参数一:特定建筑ID,无限定填0
+     * 参数二:特定目标等级,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Farm_LevelUp = 302;
+
+    /**
+     * 种植一次作物	/   种植一次指定作物
+     * 参数一:特定作物类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Farm_PlantFood = 303;
+
+    /**
+     * 收获一次作物	/   收获一次指定作物 
+     * 【行为统计】
+     * 参数一:特定果实类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Farm_CollectFood = 304;
+
+    /**
+     * 收获一次作物	/   收获一次指定作物
+     * 【果实数量统计】
+     * 参数一:特定果实类型,无限定填0
+     * 计数:要求数目
+     */
+    const SEvn_Farm_CollectFood = 354;
+
+    //#endregion
+    //#region ----------->建筑事件
+
+    /**
+     * 建造一个建筑   /   建造一个指定建筑
+     * 参数一:特定建筑ID,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_Construct = 401;
+
+    /**
+     * 拥有一个建筑	/   拥有一个指定建筑 / 拥有指定等级的建筑
+     * 
+     * 参数一:特定建筑  一级大类 类型,无限定填0
+     * 参数二:特定建筑  二级小类 类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * 
+     * 计数:要求数目
+     */
+    const SEvn_Build_Own = 451;
+
+    /**
+     * 升级一个建筑   /  升级一个指定建筑	
+     * 
+     * 参数一:特定建筑ID,无限定填0
+     * 
+     * 参数二:特定等级,无限定填0
+     * 
+     * 计数:要求数目
+     */
+    const Evn_Build_LevelUp = 402;
+
+    /**
+     * 铲除 一个建筑   /  铲除一个指定建筑	    
+     * 参数一:特定建筑ID,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_Remove = 403;
+
+    /**
+     * 招募   一次    
+     * 参数一:特定神兽类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_PubEmploy = 404;
+
+    /**
+     * 培育一次    /  培育出指定神兽一次	获得兽蛋  
+     * 参数一:特定兽蛋类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_Breed = 405;
+
+    /**
+     * 孵化
+     * 参数一:特定兽蛋类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_EggHatch = 406;
+
+    /**
+     * 采矿场 打工一次
+     * 参数一:特定工作神兽类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_QuarryWork = 407;
+
+    /**
+     * 采矿场 结果收取一次
+     * 【累计神兽的工作次数】    
+     * 参数一:特定工作神兽类型,无限定填0    
+     * 计数:要求数目
+     */
+    const Evn_Build_QuarryResult = 408;
+
+    /**
+     * 采矿场 结果收取一次
+     * [累计道具的收取始数量]
+     * 参数一:特定采矿成果道具ID, 无限定填0  
+     * 计数:要求数目
+     */
+    const SEvn_Build_QuarryResult = 458;
+
+    /**
+     * 加工厂 打工一次
+     * 参数一:特定工作神兽类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Build_ProcessWork = 409;
+
+    /**
+     * 加工厂 结果收取一次
+     * 【累计哪个神兽加工工作次数】
+     * 参数一:特定工作神兽类型,无限定填0       
+     * 计数:要求数目
+     */
+    const Evn_Build_ProcessResult = 410;
+
+    /**
+     * 加工厂 结果收取
+     * [累计道具的收取始数量]
+     * 参数一:特定成果道具ID, 无限定填0  
+     * 计数:要求数目
+     */
+    const SEvn_Build_ProcessResult = 460;
+
+    /**
+     * 收取建造的建筑的经验值    
+     * 参数一:特定建筑ID,无限定填0       
+     * 计数:要求数目
+     */
+    const Evn_Build_CollectExp = 411;
+
+    /**
+     * 酒馆配置上阵神兽    
+     * 计数:配置次数
+     */
+    const Evn_Build_PubTeamConfig = 412;
+
+    //#endregion
+    //#region ----------->神兽事件
+
+    /**
+     * 拥有一只神兽	/ 拥有一只指定神兽
+     * 	
+     * 参数一:特定神兽类型,无限定填0
+     * 
+     * 参数二:特定等级,无限定填0
+     * 
+     * 参数三:特定星级,无限定填0
+     * 
+     * 计数:要求数目
+     */
+    const SEvn_Pet = 551;
+
+    /**
+     * 喂养一次神兽  /   喂养一次指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Pet_Feed = 501;
+
+    /*     * Mi
+     * 升级一次神兽	/ 升级一次指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Pet_LevelUp = 502;
+
+    /**
+     * 升级技能一次神兽	/ 升级一次指定神兽	的技能
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定技能ID,无限定填0
+     * 参数三:特定技能等级,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Pet_Skill = 503;
+
+    /**
+     * 升星一次神兽 / 升星一次指定神兽
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定星级,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Pet_Star = 504;
+
+    //#endregion
+    //#region ----------->探索事件
+
+    /**
+     * 进入一次探索地图	
+     * 计数:要求数目
+     */
+    const Evn_Explore_EnterMap = 601;
+
+    /**
+     * 进行一次占领(动作,不考虑结果)
+     * 计数:要求数目
+     */
+    const Evn_Explore_GridCapture = 602;
+
+    /**
+     * 占领一块领地 / 占领一块指定领地或者或者中立建筑
+     * 参数一:特定领地类型,无限定填0
+     * 计数:要求数目
+     */
+    const Evn_Explore_GridCaptureSucced = 603;
+    
+    /**
+     * 拥有N块领地 / 拥有N块指定领地或者中立建筑
+     * 参数一:特定领地类型,无限定填0
+     * 计数:要求数目
+     */
+    const SEvn_Explore_GridOwn = 653;
+
+    /**
+     * 执行一次队伍调动(派遣战队进入探索地图)
+     * 计数:要求数目
+     */
+    const Evn_Explore_ArmyDeploy = 604;
+    
+    /**
+     * 和制定NPC对话
+     * 参数一:地图id(必填)
+     * 参数二:地点坐标(必填,格式为 x_y)
+     * 计数:固定为1
+     */
+    const Evn_Explore_TalkToMissNpc = 605;
+    
+    /**
+     * 打败多个指定坐标的NPC(多个)
+     * 参数一:地图id(必填)
+     * 参数二:地点列表(必填,格式为 x_y|x_y|x_y ...)
+     * 计数:地点总个数
+     */
+    const Evn_Explore_FightToMissNpc = 606;
+    
+    
+    //#endregion
+    //#region ----------->其他事件
+
+    /**
+     * 	加速一次	/   加速一次指定操作
+     * 参数一:加速类型(建造 /种植 /孵化/铲除障碍物),无限定填0
+     * 
+     * 计数:要求数目
+     * 
+     */
+    const Evn_SpeedUp = 701;
+
+    /**
+     * 岛屿解锁
+     * 计数:要求数目
+     */
+    const Evn_MapIsLand = 702;
+
+    /**
+     * 岛屿阴影解锁
+     * 计数:要求数目
+     */
+    const Evn_MapShadow = 703;
+
+    /**
+     * 新手引导
+     * 参数一:特定步骤ID,无限定填0
+     * 计数:目标步骤
+     */
+    const Evn_Guide = 704;
+
+    //#endregion
+}

+ 54 - 0
Gameserver/Amfphp/model/User/del_Ins_MissEventInfo.php

@@ -0,0 +1,54 @@
+<?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.
+ */
+
+/**
+ * Description of MissEventInfo
+ *
+ * @author jgao
+ */
+class MissEventInfo {
+    //put your code here
+    
+    /**
+     * 事件码
+     * @var type 
+     */
+    public $evnCode = 0;
+
+    /**
+     * 操作模式
+     * @var type 
+     */
+    public $ope = "set";
+
+    /**
+     * 计数值
+     * @var type 
+     */
+    public $val = 0;
+
+    /**
+     * 参数集
+     * @var type 
+     */
+    public $paras = array();
+
+    /**
+     * 构造方法
+     * @param type $evn 事件码
+     * @param type $ope 操作模式(inc递增;add增加;set设置;max取最大值)
+     * @param type $val 数值
+     * @param array $paras 参数表
+     */
+    public function __construct($evn, $ope, $val, $paras=array()) {
+        $this->evnCode = $evn;
+        $this->ope = $ope;
+        $this->val = $val;
+        $this->paras = $paras;
+    }
+}

+ 28 - 62
Gameserver/Amfphp/process/EventProc/NormalEventProc.php

@@ -2,59 +2,6 @@
 
 namespace loyalsoft;
 
-/**
- *  事件类型定义
- *  author: gwang, 2020年11月30日17:56:01
- */
-class EEventType {
-
-    /**
-     * hello world
-     */
-    const HelloWorld = "HelloWorld";
-
-    /**
-     * 给予道具
-     */
-    const AddItem = "AddItem";
-
-    /**
-     * 移除道具
-     */
-    const RemoveItem = "RemoveItem";
-
-    /**
-     * 给予任务
-     */
-    const AddTaskItem = "AddTaskItem";
-
-    /**
-     * 移除任务
-     */
-    const RemoveTaskItem = "RemoveTaskItem";
-
-    /**
-     * 完成任务步骤
-     */
-    const MissionStepComplete = "MissionStepComplete";
-
-    /**
-     * 任务卡完成
-     */
-    const TaskCardFinished = "TaskCardFinished";
-
-    /**
-     * 开启一段剧情对话
-     */
-    const StartPlot = "StartPlot";
-
-    /**
-     * 开启npc对话
-     */
-    const NpcDialog = "NpcDialog";
-
-}
-
 /**
  * 系统事件处理模块
  * @author gwang
@@ -64,7 +11,7 @@ class NormalEventProc {
     //put your code here
 
     public static function OnHelloWorld($arg1, $arg2) {
-        Resp::AddEvent(EEventType::HelloWorld, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::HelloWorld, $arg1, $arg2);
     }
 
     /**
@@ -73,7 +20,7 @@ class NormalEventProc {
      * @param type $arg2
      */
     public static function OnBag_new_Item($arg1, $arg2) {
-        Resp::AddEvent(EEventType::AddItem, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::AddItem, $arg1, $arg2);
     }
 
     /**
@@ -82,7 +29,7 @@ class NormalEventProc {
      * @param type $arg2
      */
     public static function OnBag_Remove_Item($arg1, $arg2) {
-        Resp::AddEvent(EEventType::RemoveItem, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::RemoveItem, $arg1, $arg2);
     }
 
     /**
@@ -91,17 +38,18 @@ class NormalEventProc {
      * @param type $arg2
      */
     public static function OnTaskBag_new_Card($arg1, $arg2) {
-        Resp::AddEvent(EEventType::AddTaskItem, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::AddTaskItem, $arg1, $arg2);
     }
 
 //
+
     /**
      * 任务卡包裹--移除任务卡
      * @param type $arg1
      * @param type $arg2
      */
     public static function OnTaskBag_remove_Card($arg1, $arg2) {
-        Resp::AddEvent(EEventType::AddYanling, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::AddYanling, $arg1, $arg2);
     }
 
     /**
@@ -110,7 +58,7 @@ class NormalEventProc {
      * @param type $arg2
      */
     public static function OnTaskCardStep_Complete($arg1, $arg2) {
-        Resp::AddEvent(EEventType::MissionStepComplete, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::MissionStepComplete, $arg1, $arg2);
     }
 
     /**
@@ -119,7 +67,25 @@ class NormalEventProc {
      * @param type $arg2
      */
     public static function OnTaskCard_Finish($arg1, $arg2) {
-        Resp::AddEvent(EEventType::TaskCardFinished, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::TaskCardFinished, $arg1, $arg2);
+    }
+
+    /**
+     * 任务卡-激活
+     * @param type $arg1
+     * @param type $arg2
+     */
+    public static function OnTaskCard_Actived($arg1, $arg2) {
+        Resp::AddEvent(Enum_EventType::TaskCardActived, $arg1, $arg2);
+    }
+
+    /**
+     * 任务卡-领取奖励
+     * @param type $arg1
+     * @param type $arg2
+     */
+    public static function OnTaskCard_Reward($arg1, $arg2) {
+        Resp::AddEvent(Enum_EventType::TaskCardReward, $arg1, $arg2);
     }
 
     /**
@@ -128,7 +94,7 @@ class NormalEventProc {
      * @param type $arg2 
      */
     public static function OnPlot_startNew($arg1, $arg2) {
-        Resp::AddEvent(EEventType::StartPlot, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::StartPlot, $arg1, $arg2);
     }
 
     /**
@@ -137,7 +103,7 @@ class NormalEventProc {
      * @param type $arg2 
      */
     public static function OnNpcDialog_startNew($arg1, $arg2) {
-        Resp::AddEvent(EEventType::NpcDialog, $arg1, $arg2);
+        Resp::AddEvent(Enum_EventType::NpcDialog, $arg1, $arg2);
     }
 
 }

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

@@ -190,7 +190,7 @@ class HeroProc {
                 GameConfig::hero_getItem($upHero->typeId)->name, $upHero->grade);
         self::CalcUserFightPower($req->zoneid, $req->uid, $req->userInfo->game); # 跟新战力统计
         TaskProc::OnHeroGradeUp($upHero->typeId, $upHero->grade);
-        var_dump($user->task->taskListDaily);
+//        var_dump($user->task->taskListDaily);
         return $resp;
     }
 

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

@@ -313,7 +313,7 @@ class StoreProc {
                     $user->pvp->pvpCoins += $num;
                     break;
                 case META_ActivePoint_ITEMID:
-                    $user->task->dailyActivePoint += $num;                      # 每日任务活跃点
+//                    $user->task->dailyActivePoint += $num;                      # 每日任务活跃点
                     break;
                 case 101:                                                       # 武器 
                     StoreProc::PutEquipInStore($itemId, $req);
@@ -441,6 +441,7 @@ class StoreProc {
         $itembaseMo = GameConfig::item_base_getItem($itemId);
         my_Assert(null != $itembaseMo, ErrCode::err_const_no);
         if ($itembaseMo->pileNum > 0) {                                         // 可叠加
+            Err(ErrCode::taskCard_no_pile);                                     # 不可堆叠!!! 我支持不了.gwang 2020年12月12日13:40:04
             $taskCard = null;
             foreach ($req->userInfo->game->store->taskcards as $uuid => &$val) {
                 $val = new Ins_TaskCard($val);

+ 124 - 81
Gameserver/Amfphp/process/TaskProc.php

@@ -24,14 +24,23 @@ class TaskProc {
 //---------------- 任务卡相关通讯 -----------------------------------------------
             case CmdCode::cmd_taskCard_PlotFinish:                              # 6210 任务卡剧情对话
                 return self::PlotFinish($req);
-            case CmdCode::cmd_taskCard_PlotExchangeTaskCard:                    # 6211 任务卡兑换奖励
-                return self::PlotExchangeTaskCard($req);
-            case CmdCode::cmd_taskCard_PlotPresentTaskCard:                     # 6212 剧情赠送任务卡
-                return self::PlotPresetTaskCard($req);
-            case CmdCode::cmd_taskCard_FinishAndReward:                         # 6213 任务卡完成,并即时结算
-                return self::ImmetRewardTaskCard($req);
+//            case CmdCode::cmd_taskCard_PlotExchangeTaskCard:                    # 6211 任务卡兑换奖励
+//                Err(ErrCode::err_method_obsoleted);
+//                return self::PlotExchangeTaskCard($req);
+//            case CmdCode::cmd_taskCard_PlotPresentTaskCard:                     # 6212 剧情赠送任务卡
+//                Err(ErrCode::err_method_obsoleted);
+//                return self::PlotPresetTaskCard($req);
+//            case CmdCode::cmd_taskCard_FinishAndReward:                         # 6213 任务卡完成,并即时结算
+//                Err(ErrCode::err_method_obsoleted);
+//                return self::ImmetRewardTaskCard($req);
+
             case CmdCode::cmd_taskCard_onKillMonster:                           # 6214 杀死怪物事件
                 return self::OnKillMonsterEvent($req);
+
+            case CmdCode::cmd_taskCard_active:                                  # 6215 激活任务卡
+
+            case CmdCode::cmd_taskCard_reward:                                  # 6216 领取任务卡奖励
+
             default:
                 return Err(ErrCode::cmd_err);
         }
@@ -39,6 +48,7 @@ class TaskProc {
 
     // <editor-fold defaultstate="collapsed" desc="  任务卡接口">
     // 
+
     /**
      * [6210]剧情对话-触发任务卡结束条件检测(中间某个step结束,进入下一个step)
      * @param req $req
@@ -51,57 +61,100 @@ class TaskProc {
                     'taskCardUpdate' => $bUpdate));
     }
 
+// <editor-fold defaultstate="collapsed" desc="废弃">
+//    /**
+//     * [6211] 任务卡-剧情结束兑换奖励(销毁当前卡,换取新的任务卡)
+//     * @deprecated since version 2020.12.12
+//     * @param type $req
+//     */
+//    static function PlotExchangeTaskCard($req) {
+//        Err(ErrCode::err_method_notimplement);
+//    }
+//
+//    /**
+//     * [6212] 任务卡- 剧情对话奖励任务卡
+//     * @deprecated since version 2020.12.12
+//     * @param req $req
+//     */
+//    static function PlotPresetTaskCard($req) {
+//        // 发放任务卡
+//        list($rwdStr) = $req->paras;
+//        $err = StoreProc::AddMultiItemInStore($req, $rwdStr);
+//        my_Assert(ErrCode::ok == $err, $err);
+//        UserProc::updateUserInfo();
+//        return Resp::ok(array('store' => $req->userInfo->game->store));
+//    }
+//
+//    /**
+//     * [6213]任务卡 - 即时奖励型任务卡
+//     * @deprecated since version 2020.12.12
+//     * @param req $req
+//     */
+//    static function ImmetRewardTaskCard($req) {
+//        // 销毁任务卡, 发放奖励
+//        list($taskCardUID) = $req->paras;
+//        my_Assert(StlUtil::dictHasProperty($req->userInfo->game->store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御
+//        $taskCard = new Ins_TaskCard($req->userInfo->game->store->taskcards->$taskCardUID); # 任务卡对象
+//        if (strlen($taskCard->mo()->reward) > 0) {                              # 防御奖励串为空
+//            StoreProc::AddMultiItemInStore($req, $taskCard->mo()->reward);      # 发放奖励
+//        }
+//        if (strlen($taskCard->mo()->newTaskCard) > 0) {                         # 防御新卡串为空
+//            StoreProc::AddMultiItemInStore($req, $taskCard->mo()->newTaskCard); # 发放新任务卡
+//        }
+//        StlUtil::dictRemove($req->userInfo->game->store->taskcards, $taskCardUID); # 移除任务卡
+//        UserProc::updateUserInfo();                                             # 回存玩家数据
+//        return Resp::ok(array('store' => $req->userInfo->game->store, 'taskCardUpdate' => true));         # 返回值更新背包
+//    }
+// </editor-fold>
+
     /**
-     * [6211] 任务卡-兑换奖励
-     * @param type $req
+     * [6214] 任务卡 - 杀死怪物事件
+     * @param req $req
      */
-    static function PlotExchangeTaskCard($req) {
-        Err(ErrCode::err_method_notimplement);
+    static function OnKillMonsterEvent($req) {
+        // 触发一下任务检查
+        list($monsterID, $num) = $req->paras;
+        $bUpdate = self::OnKillMonster($monsterID, $num);
+        return Resp::ok(array('store' => $req->userInfo->game->store,
+                    'taskCardUpdate' => $bUpdate));
     }
 
     /**
-     * [6212] 任务卡- 剧情对话奖励任务卡
+     * [6215] 任务卡 - 激活任务卡
      * @param req $req
      */
-    static function PlotPresetTaskCard($req) {
-        // 发放任务卡
-        list($rwdStr) = $req->paras;
-        $err = StoreProc::AddMultiItemInStore($req, $rwdStr);
-        my_Assert(ErrCode::ok == $err, $err);
-        UserProc::updateUserInfo();
-        return Resp::ok(array('store' => $req->userInfo->game->store));
+    static function OnTaskCard_active($req) {
+        list($taskCardUID) = $req->paras;                                       # 提取参数: 任务卡实例id
+        $store = $req->userInfo->game->store;                                   # 快速访问store
+        my_Assert(StlUtil::dictHasProperty($store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御找不到实例
+        $taskCard = new Ins_TaskCard($store->taskcards->$taskCardUID);          # 任务卡对象
+
+        my_Assert($taskCard->state <= Enum_TaskCardStateType::notopen, ErrCode::taskCard_state); # 任务卡状态异常 
+
+        $taskCard->state = Enum_TaskCardStateType::ing;
+        $store->taskcards->$taskCardUID = $taskCard;
+        UserProc::updateUserInfo();                                             # 回存玩家数据
+        NormalEventProc::OnTaskCard_Actived($taskCardUID, null);                # 带入事件
+        return Resp::ok(array('store' => $req->userInfo->game->store));         # 返回值更新背包
     }
 
     /**
-     * [6213]任务卡 - 即时奖励型任务卡
+     * [6216] 任务卡 - 领取任务卡奖励
      * @param req $req
      */
-    static function ImmetRewardTaskCard($req) {
+    static function OnTaskCard_reward($req) {
         // 销毁任务卡, 发放奖励
         list($taskCardUID) = $req->paras;
-        my_Assert(StlUtil::dictHasProperty($req->userInfo->game->store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御
-        $taskCard = new Ins_TaskCard($req->userInfo->game->store->taskcards->$taskCardUID); # 任务卡对象
+        $store = $req->userInfo->game->store;                                   # 快速访问store
+        my_Assert(StlUtil::dictHasProperty($store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御找不到实例
+        $taskCard = new Ins_TaskCard($store->taskcards->$taskCardUID);          # 任务卡对象
         if (strlen($taskCard->mo()->reward) > 0) {                              # 防御奖励串为空
             StoreProc::AddMultiItemInStore($req, $taskCard->mo()->reward);      # 发放奖励
         }
-        if (strlen($taskCard->mo()->newTaskCard) > 0) {                         # 防御新卡串为空
-            StoreProc::AddMultiItemInStore($req, $taskCard->mo()->newTaskCard); # 发放新任务卡
-        }
+        NormalEventProc::OnTaskCard_Reward($taskCard->mo()->reward, null);      # 带入事件
         StlUtil::dictRemove($req->userInfo->game->store->taskcards, $taskCardUID); # 移除任务卡
         UserProc::updateUserInfo();                                             # 回存玩家数据
-        return Resp::ok(array('store' => $req->userInfo->game->store, 'taskCardUpdate' => true));         # 返回值更新背包
-    }
-
-    /**
-     * [6214] 任务卡 - 杀死怪物事件
-     * @param req $req
-     */
-    static function OnKillMonsterEvent($req) {
-        // 触发一下任务检查
-        list($monsterID, $num) = $req->paras;
-        $bUpdate = self::OnKillMonster($monsterID, $num);
-        return Resp::ok(array('store' => $req->userInfo->game->store,
-                    'taskCardUpdate' => $bUpdate));
+        return Resp::ok(array('store' => $req->userInfo->game->store));         # 返回值更新背包
     }
 
     // 
@@ -218,6 +271,7 @@ class TaskProc {
      * @param Req $req
      */
     static function ResetDailyTask($req) {
+        return;
         $userTask = new Info_UserTask($req->userInfo->game->task);
         $userTask->resetDailyTask();
         $req->userInfo->game->task = $userTask;
@@ -231,6 +285,7 @@ class TaskProc {
      * @param Ins_TaskParams $taskParam Description
      */
     static function CheckTaskConditions($taskParam) {
+        return;
 //        var_dump($taskParam);
         $bUpdate = false;
         foreach (req()->userInfo->game->task->taskListPlot as $tid => $task) {
@@ -283,6 +338,7 @@ class TaskProc {
      * @param Ins_TaskParams $taskParam Description
      */
     static function CheckDailyTaskConditions($taskParam) {
+        return;
         $bUpdate = false;
         $daily = req()->userInfo->game->task->taskListDaily;
         foreach ($daily as $tid => &$task) {
@@ -323,7 +379,7 @@ class TaskProc {
      * 例如当指挥官等级提升的时候需要检查是否有任务达成
      */
     static function OnUserLevelUp($newLvl) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::CommanderLevelUpTo, $newLvl);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::CommanderLevelUpTo, $newLvl);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -333,7 +389,7 @@ class TaskProc {
      * @param type $newLvl
      */
     static function OnHeroLevelUp($heroMoId, $newLvl) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::HeroLevelUpTo, $heroMoId, $newLvl);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroLevelUpTo, $heroMoId, $newLvl);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -343,7 +399,7 @@ class TaskProc {
      * @param type $newGrade
      */
     static function OnHeroGradeUp($heroMoId, $newGrade) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::HeroGradeUpTo, $heroMoId, $newGrade);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroGradeUpTo, $heroMoId, $newGrade);
         self::CheckTaskConditions($taskParam);
         self::OnHeroImprove();
     }
@@ -354,7 +410,7 @@ class TaskProc {
      * @param type $num
      */
     static function OnHeroSegmengNum($heroMoId, $num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::HeroSegmentNumberTo, $heroMoId, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSegmentNumberTo, $heroMoId, $num);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -364,7 +420,7 @@ class TaskProc {
      * @param type $skillId
      */
     static function OnHeroUnlocSkill($heroMoId, $skillId) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::HeroSkillUnlock, $heroMoId, $skillId);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSkillUnlock, $heroMoId, $skillId);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -374,7 +430,7 @@ class TaskProc {
      * @param type $difficulty
      */
     static function OnPassGateN($gateId, $difficulty) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::PassGateN, $gateId, $difficulty);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PassGateN, $gateId, $difficulty);
         self::CheckTaskConditions($taskParam);
         self::OnPassGate();
     }
@@ -385,7 +441,7 @@ class TaskProc {
      * @param type $difficulty
      */
     static function OnPassCarboN($gateId, $difficulty) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::passCarbonN, $gateId, $difficulty);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::passCarbonN, $gateId, $difficulty);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -394,7 +450,7 @@ class TaskProc {
      * @param type $num
      */
     static function OnPvPWinN($num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::PvPWinNumberTo, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPWinNumberTo, $num);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -403,7 +459,7 @@ class TaskProc {
      * @param type $score
      */
     static function OnPvPScoreN($score) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::PvPScoreTo, $score);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPScoreTo, $score);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -412,7 +468,7 @@ class TaskProc {
      * @param type $num
      */
     static function OnUserFightPowerN($num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::UserPowerTo, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::UserPowerTo, $num);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -421,7 +477,7 @@ class TaskProc {
      * @param type $num
      */
     static function OnUserCollectScoreN($num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::UserCollectScoreTo, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::UserCollectScoreTo, $num);
         self::CheckTaskConditions($taskParam);
     }
 
@@ -435,7 +491,7 @@ class TaskProc {
      * 每日登陆
      */
     static function OnUserLogin() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyLogin);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyLogin);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -443,7 +499,7 @@ class TaskProc {
      * 每日:英雄强化(升级或升阶)n次
      */
     static function OnHeroImprove() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyHeroImprove);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyHeroImprove);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -451,7 +507,7 @@ class TaskProc {
      * 每日:剧情关卡,胜利n次
      */
     static function OnPassGate() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyGatesWin);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyGatesWin);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -459,7 +515,7 @@ class TaskProc {
      * 竞技场每日挑战,胜负均可
      */
     static function OnPvp() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyPVP);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyPVP);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -467,7 +523,7 @@ class TaskProc {
      * 每日挑战,胜负均可
      */
     static function OnRankChalenge() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyRankChalenge);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyRankChalenge);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -475,7 +531,7 @@ class TaskProc {
      * 每日购买商品
      */
     static function OnShopping() {
-        $taskParam = new Ins_TaskParams(EnumTaskType::DailyShopping);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyShopping);
         self::CheckDailyTaskConditions($taskParam);
     }
 
@@ -495,41 +551,28 @@ class TaskProc {
 
         foreach ($tasks as $tid => &$task) {
             $task = new Ins_TaskCard($task);
-            $taskCfg = $task->mo();                                             # 获取任务卡配置数据
-            // 根据steptype类型区分下, 然后取任务步骤数据, 比对任务步骤的进度
-            if ($taskCfg->stepType == 1) {                                      # 1串,2并
-                $taskSteps = $task->curSteps;                                   # 任务步骤
-                $n = $task->curStepIndex;
-                $taskStep = new Ins_TaskStep($taskSteps[$n]);
-                $bUpdate = $taskStep->check($taskParam);
+            foreach ($task->curSteps as $stp) {                                 # 初期里面只有一个任务
+                $tsp = new Ins_TaskStep($stp);
+                $bUpdate = $tsp->check_new($taskParam);
                 if ($bUpdate) {
-                    NormalEventProc::OnTaskCardStep_Complete($task->typeId, $taskStep->typeId);
-                    $taskSteps[$n] = $taskStep;
-                    $task->curSteps = $taskSteps;
-                    $n++;
-                    if (count($task->curSteps) <= $n) {
-                        $task->state = 1;                                       # 任务已完成
-                        NormalEventProc::OnTaskCard_Finish($task->typeId, null);
-                    } else {
-                        $task->curStepIndex = $n;
+                    NormalEventProc::OnTaskCardStep_Complete($task->typeId, $tsp->typeId); # 广播任务步骤完成事件
+                    $tsp->propel($taskParam);
+                    if ($tsp->isFinish()) {
+                        NormalEventProc::OnTaskCard_Finish($task->typeId, null); # 广播卡完成事件
                     }
                 }
-            } else {                                                            # 并
-                foreach ($task->curSteps as $stp) {
-                    $tsp = new Ins_TaskStep($stp);
-                    $bUpdate = $tsp->check($taskParam);
-                }
             }
         }
-        if ($bUpdate) {
-            UserProc::updateUserInfo();
+
+        if ($bUpdate) {                                                         # 带回数据到客户端
+            UserProc::updateUserInfo();                                         # 更新玩家数据
         }
 
         return $bUpdate;
     }
 
     static function OnKillMonster($monsterID, $num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::KillMonster, $monsterID, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::KillMonster, $monsterID, $num);
         return self::CheckTaskCardConditions($taskParam);
     }
 
@@ -537,13 +580,13 @@ class TaskProc {
      * 获得道具
      */
     static function OnGainItem($itemId, $num) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::GainItem, $itemId, $num);
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::GainItem, $itemId, $num);
         self::CheckTaskCardConditions($taskParam);
         NormalEventProc::OnBag_new_Item($itemId, $num);
     }
 
     static function OnPlotOver($gate_or_npc_id, $stage) {
-        $taskParam = new Ins_TaskParams(EnumTaskType::PlotOver, $gate_or_npc_id, "$stage");
+        $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PlotOver, $gate_or_npc_id, "$stage");
         return self::CheckTaskCardConditions($taskParam);
     }
 

+ 1166 - 0
Gameserver/Amfphp/process/del_MissProc.php

@@ -0,0 +1,1166 @@
+<?php
+
+/**
+ * Description of GoalProc
+ * 任务处理流程
+ * @author jgao
+ */
+class MissProc {
+    //put your code here
+
+    /**
+     * 获得任务卡列表
+     * @param type $args
+     */
+    static function onMissionCardList($args) {
+        $storeInfo = usrInfo()->storeInfo();
+        return array(
+            'missCardDict' => $storeInfo->misCardDict,
+        );
+    }
+
+    /**
+     * 开启任务卡
+     */
+    static function onStartMissionCard($args) {
+        $id = $args->id;
+        $storeInfo = usrInfo()->storeInfo(true);
+        $missInfo = usrInfo()->missInfo(true);
+        if (!$storeInfo->hasMissionCard($id)) {
+            // 错误:没有这张任务卡
+            return Errcode::err_miss_nomisscard;
+        }
+        if ($storeInfo->checkSameTypeMissionCardHasStarted($id)) {
+            // 错误:已开启同类型任务卡
+            return Errcode::err_miss_sametypehasopen;
+        }
+
+        $ins = $storeInfo->startMissionCard($id); // 任务卡置为开启状态
+        $missCardMo = dataCenter()->getMissionCardData($ins->tid);
+        $missList = strsplit_raw($missCardMo->misslist);
+        if (count($missList) <= 0) {
+            // 错误:配置数据出错
+            return Errcode::default_;
+        }
+        // 自动挂载任务卡的第一个任务
+        $missIns = $missInfo->addMission($missList[0]);
+        $missIns->card = $id;
+        return succeed();
+    }
+
+    /**
+     * 任务卡兑换奖励
+     */
+    static function onFinishMissionCard($args) {
+        $ids = $args->ids;
+        $storeInfo = usrInfo()->storeInfo(true);
+        $missInfo = usrInfo()->missInfo(true);
+        $prizes = array();
+        foreach ($ids as $id) {
+            if (!$storeInfo->hasMissionCard($id)) {
+                // 错误:没有这张任务卡
+                return Errcode::err_miss_nomisscard;
+            }
+            $ins = $storeInfo->getMissionCard($id);
+            $state = $ins->getState();
+            if ($state != MissionCardStateType::finish) {
+                // 错误:任务链尚未完成
+                return Errcode::err_miss_notfinish;
+            }
+            $missCardMo = dataCenter()->getMissionCardData($ins->tid);
+            array_pushs($prizes, usrInfo()->modifyPrizes($missCardMo->prize));
+            // 清理任务卡名下所有子任务的完成痕迹(避免后续影响任务卡是否完成的判断)
+            $missList = strsplit_raw($missCardMo->misslist);
+            foreach ($missList as $missId) {
+                dict_remove($missInfo->overMissions, $missId);
+            }
+            $storeInfo->delMissionCard($id); // 删除这张任务卡
+        }
+        return array(
+            'prizes' => $prizes,
+        );
+    }
+
+    /**
+     * 完成任务
+     * @param RequestVo $req
+     */
+    static function onFinishMission($args) {
+        $id = $args->id;
+        $missInfo = usrInfo()->missInfo(true);
+        $baseInfo = usrInfo()->baseInfo(true);
+        // 检测今日是否已经做过该任务
+        if (!$missInfo->hasMission($id)) {
+            // 尚未接取此任务
+            return ErrCode::err_miss_noting;
+        }
+
+        $ing = $missInfo->GetMission($id);
+
+        if (!$ing->isFinish()) {
+            // 任务尚未完成
+            return ErrCode::err_miss_notfinish;
+        }
+        $ctx = dataCenter()->getMissionConst($id);
+        if ($ctx == null) {
+            // 任务模板数据缺失
+            return ErrCode::default_;
+        }
+        if ($ctx->vip != 0 && $ctx->vip != $baseInfo->vip) {
+            // vip等级错误
+            return ErrCode::default_;
+        }
+        if ($ctx->start != "") {
+            $startInfo = strsplit_raw($ctx->start, ":");
+            $start = $startInfo[0] * 3600 + $startInfo[1] * 60 + $startInfo[2];
+            $endInfo = strsplit_raw($ctx->end, ":");
+            $end = $endInfo[0] * 3600 + $endInfo[1] * 60 + $endInfo[2];
+            $date = datetime();
+            $now = $date->hours * 3600 + $date->minutes * 60 + $date->seconds;
+            if ($start > $now || $end < $now) {
+                // 完成时间不满足条件
+                return ErrCode::default_;
+            }
+        }
+
+        $ctx_prizes = "";
+        if ($ctx->prizes != "") { // 如果有奖励,则直接应用之
+            $ctx_prizes = $ctx->prizes;
+        } else {
+            #m没有奖励--待定
+        }
+        $prizes = usrInfo()->modifyPrizes($ctx_prizes);
+        $missInfo->finishMission($id);
+        if ($ctx->next != 0) {
+            if ($ctx->next == 999999) { // 未完待续任务标志字
+                $missInfo->contMissions->$id = "continue..";
+            } else {
+                $ing = $missInfo->addMission($ctx->next);
+                self::DealToServer(array($ing));
+            }
+        }
+
+        $result = array(
+            'ret' => "succeed!",
+            'prizes' => $prizes,
+            'miss' => $missInfo,
+        );
+        return $result;
+    }
+
+    /**
+     * 自动修复状态型任务
+     * @param RequestVo $req
+     */
+    static function autoRecoverStateMissions() {
+        $missInfo = usrInfo()->missInfo(true);
+        foreach ($missInfo->ingMissions as $key => $ing) {
+            $ing->autoCalcStatusCur();
+            self::chechIngMissIsAuto($ing->id); // 判断自动完成的任务是否需要自动对齐完成状态
+        }
+    }
+
+    /**
+     * 自动起始的任务
+     * @param RequestVo $req
+     */
+    static function autoStartingMissions() {
+        $missList = dataCenter()->getMissionConst();
+        $missInfo = usrInfo()->missInfo(true);
+        foreach ($missList as $id => $val) {
+            if ($val->etc == "1") {
+                if (!$missInfo->hasMission($id) &&
+                        !$missInfo->onceFinished($id)) {
+                    $missInfo->addMission($id);
+                }
+            }
+        }
+    }
+
+    /**
+     * 待续任务重新续接
+     * @param RequestVo $req
+     */
+    static function autoRecontinueMissions() {
+        $dirtyContiMissions = array();
+        $missInfo = usrInfo()->missInfo(true);
+        foreach ($missInfo->contMissions as $id => $val) {
+            $ctx = dataCenter()->getMissionConst($id);
+            if ($ctx->next != 0 && $ctx->next != 999999) {
+                $missInfo->addMission($ctx->next);
+                $dirtyContiMissions[] = $id;
+            }
+        }
+        foreach ($dirtyContiMissions as $dirty) {
+            dict_remove($missInfo->contMissions, $dirty);
+        }
+    }
+
+    /**
+     * 自动接取每日任务
+     * @param RequestVo $req
+     */
+    static function autoDailyMissions() {
+        $dirty = array();
+        $missDic = dataCenter()->getMissionConst();
+        console("autoDailyMissions");
+        $missInfo = usrInfo()->missInfo(true);
+        foreach ($missInfo->ingMissions as $ing) {
+            if (!dict_exists($missDic, $ing->id)) {
+                $dirty[] = $ing->id;
+            }
+        }
+        foreach ($dirty as $temp) {
+            $missInfo->delMission($temp);
+        }
+        foreach ($missDic as $id => $val) {
+            if ($val->type != 2) {
+                continue;
+            }
+
+            // 如果有前一天的残留数据,或者找不到此任务,则直接干掉
+            if (dict_exists($missInfo->ingMissions, $id)) {
+                $missInfo->delMission($id);
+            }
+            $missInfo->addMission($id);
+        }
+    }
+
+    // ------------------------任务状态检测-----------------------------
+
+    /**
+     * 筛选正在执行中的任务
+     * @param MissEventInfo $info
+     * @return type
+     */
+    static function SelectIngMissions($info) {
+        $list = array();
+        if (!MissEventCode::isServerLogic) {
+            return $list;
+        }
+        $baseInfo = usrInfo()->baseInfo(false);
+        $missInfo = usrInfo()->missInfo(false);
+        foreach ($missInfo->ingMissions as $key => $ing) {
+            if ($ing->minlv > $baseInfo->level &&
+                    !MisStatus::isStatusType($ing->cmd) &&
+                    $ing->type != 2) {
+                continue;
+            }
+            if ($ing->cmd != $info->evnCode) {
+                continue;
+            }
+            $bSign = true;
+            if (array_count($ing->paras) == 0) {
+                ###说明这个任务没有特定需求
+            } else {
+                $index = 0;
+                foreach ($info->paras as $para) {
+                    if ($index < array_count($ing->paras)) {
+                        if (strcontains($para, "|")) {
+                            $paraList = strsplit($para, "|");
+                            foreach ($paraList as $paraItem) {
+                                if ($paraItem == $ing->paras[$index]) {
+                                    continue;
+                                }
+                            }
+                        } else {
+                            if ($ing->paras[$index] != 0 && $para != $ing->paras[$index]) {
+                                $bSign = false;
+                                continue;
+                            }
+                        }
+                    } else {
+                        continue;
+                    }
+                    $index++;
+                }
+            }
+            if ($bSign) {
+                $list[] = $ing->id;
+            }
+        }
+        return $list;
+    }
+
+    /**
+     * 筛选出的任务节奏递推
+     * @param type $id
+     * @param type $info
+     * @return type
+     */
+    static function PropelIngMission($id, $info) {
+        $missInfo = usrInfo()->missInfo(true);
+        $ing = $missInfo->GetMission($id);
+        switch ($info->ope) {
+            case "set":
+                $ing->cur = $info->val;
+                break;
+            case "add":
+                $ing->cur += $info->val;
+                break;
+            case "inc":
+                $ing->cur += 1;
+                break;
+            case "max":
+                if ($info->val > $ing->cur) {
+                    $ing->cur = $info->val;
+                }
+                break;
+        }
+
+        if ($info->ope != "set") {
+            if ($ing->cur > $ing->max) {
+                $ing->cur = $ing->max;
+            }
+        }
+
+        #检查现有的任务中是否包含自动完成的数据
+        self::chechIngMissIsAuto($id);
+        return $ing;
+    }
+
+    /**
+     * 检查现有的任务中是否包含自动完成的数据
+     *  @param type $ing
+     */
+    static function chechIngMissIsAuto($id) {
+        $missInfo = usrInfo()->missInfo(true);
+        $ing = $missInfo->GetMission($id);
+        $ctx = dataCenter()->getMissionConst($id);
+        if ($ing->isFinish() && $ctx->isauto == 1) {
+            $missInfo->finishMission($id);
+            if ($ctx->next != 0) {
+                if ($ctx->next == 999999) { // 未完待续任务标志字
+                    $missInfo->contMissions->$id = "continue..";
+                } else {
+                    $nexting = $missInfo->addMission($ctx->next);
+                    if ($ing->card != 0) {
+                        $nexting->card = $ing->card; // 继承任务卡的所属关系
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 捆绑进度变化到应答信息
+     * @param type $ings
+     */
+    static function DealToServer($ings) {
+        $resp = ctx()->resp();
+        $missInfo = usrInfo()->missInfo(true);
+        if (count($ings) > 0) {
+            if (!dict_exists($resp->tag, "missInfo")) {
+                $resp->tag->missInfo = new stdClass();
+            }
+            if (!dict_exists($resp->tag->missInfo, "ings")) {
+                $resp->tag->missInfo->ings = array();
+            }
+            array_pushs($resp->tag->missInfo->ings, $ings);
+        }
+    }
+
+    // -------------各种任务事件监听---------------
+
+    /**
+     * 玩家升级事件
+     * @param type $level
+     */
+    static function DealUserLevelup($level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_User_Levelup, "set", $level);
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 玩家食物发生变化
+     * 参数一:特定食物类型,无限定填0
+     * @param type $type 类型
+     * @param type $num 食物数量
+     */
+    static function DealUserFood($type, $num) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_User_Food, "set", $num, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 建造一个领地    /    
+     * 建造一个指定领地	
+     * 参数一:特定建筑ID,无限定填0
+     * @param type $type
+     */
+    static function DealHabitat_Build($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Habitat_Build, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * √拥有一个领地     
+     * / 拥有一个指定领地	
+     * / 拥有一个特定 等级领地 
+     * 参数一:特定栖息地类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * @param type $type 领地类型
+     * @param type $level 领地等级
+     */
+    static function DealHabitat_Own($subId, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Habitat_Own, "set", self::GetBuildingNum(INIT_HABITID, $subId, $level), array($subId, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 升级一个领地	/    升级一个指定领地
+     * 参数一:特定建筑ID,无限定填0
+     * 参数二:特定目标等级,无限定填0
+     * @param type $type
+     * @param type $level
+     */
+    static function DealHabitat_LevelUp($type, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Habitat_LevelUp, "inc", 1, array($type, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  收取一次金币操作   
+     * 【行为的计数 】     
+     * 参数一:特定领地类型,无限定填0
+     * @param type $type    
+     */
+    static function DealHabitat_CollectGold($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Habitat_CollectGold, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 栖息地 金币收集累计  
+     * 【金币的计数 】 
+     *  参数一:特定领地类型,无限定填0 
+     * @param type $type
+     * @param type $num
+     */
+    static function DealHabitat_CollectGold_S($type, $num) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Habitat_CollectGold, "add", $num, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 建造一个农田	
+     * 参数一:特定建筑ID,无限定填0  
+     * @param type $type
+     */
+    static function DealFarm_Build($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Farm_Build, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 拥有一个农田   /   
+     * 拥有一个指定农田	/
+     * 拥有一个指定等级的农田		
+     * 参数一:特定农田类别,无限定填0
+     * 参数二:特定等级,无限定填0
+     * @param type $subId 农田类别
+     * @param type $level 领地等级
+     */
+    static function DealFarm_Own($subId, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Farm_Own, "set", self::GetBuildingNum(INIT_Farm, $subId, $level), array($subId, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 升级一个农田
+     * 参数一:特定建筑,无限定填0
+     * 参数二:特定目标等级,无限定填0
+     * @param type $type
+     * @param type $level
+     */
+    static function DealFarm_LevelUp($type, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Farm_LevelUp, "inc", 1, array($type, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 种植一次作物	/   种植一次指定作物
+     * 参数一:特定作物类型,无限定填0
+     * @param type $type
+     */
+    static function DealFarm_PlantFood($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Farm_PlantFood, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 收获一次作物	/   收获一次指定作物
+     * 【行为统计】
+     * 参数一:特定作物类型,无限定填0
+     * @param type $type
+     * @param type $num
+     */
+    static function DealFarm_CollectFood($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Farm_CollectFood, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 收获一次作物	/   收获一次指定作物
+     * 【果实数量统计】
+     * 参数一:特定作物类型,无限定填0
+     * @param type $type
+     * @param type $num
+     */
+    static function DealFarm_CollectFood_S($type, $num) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Farm_CollectFood, "add", $num, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 建造一个建筑   /   建造一个指定建筑
+     * 参数一:特定类型,无限定填0  
+     * @param type $type
+     */
+    static function DealBuild_Construct($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_Construct, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 拥有一个建筑	/   拥有一个指定建筑 / 拥有指定等级的建筑
+     *  参数一:特定建筑  一级大类 类型,无限定填0
+     * 参数二:特定建筑  二级小类 类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * @param type $cabid
+     * @param type $subId
+     * @param type $level
+     */
+    static function DealBuild_Own($cabid, $subId, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Build_Own, "set", self::GetBuildingNum($cabid, $subId, $level), array($cabid, $subId, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 升级一个建筑   /  升级一个指定建筑	
+     * 参数一:特定建筑ID,无限定填0
+     * 参数二:特定目标等级,无限定填0
+     * @param type $type
+     * @param type $level
+     */
+    static function DealBuild_Levelup($type, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_LevelUp, "inc", 1, array($type, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  铲除 一个建筑   /  铲除一个指定建筑	    
+     * 参数一:特定类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_Remove($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_Remove, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 招募   一次    
+     * 参数一:特定神兽类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_PubEmploy($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_PubEmploy, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 培育一次    /  培育出指定神兽一次	获得兽蛋  
+     * 参数一:特定兽蛋类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_Breed($type) {
+        $ings = array();
+
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_Breed, "inc", 1, array($type));
+
+
+        $list = self::SelectIngMissions($info);
+
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 孵化
+     * 参数一:特定兽蛋类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_EggHatch($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_EggHatch, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 采矿场 打工一次
+     * 参数一:特定工作神兽类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_QuarryWork($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_QuarryWork, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 采矿场 结果收取一次         
+     * 参数一:特定工作神兽类型,无限定填0  
+     * @param type $type
+     */
+    static function DealBuild_QuarryResult($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_QuarryResult, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  采矿场 结果收取一次
+     * [累计道具的收取始数量]
+     * 参数一:特定采矿成果道具ID, 无限定填0  
+     * @param type $type
+     * @param type $num
+     */
+    static function DealBuild_QuarryResult_S($type, $num) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Build_QuarryResult, "add", $num, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  加工厂 打工一次
+     * 参数一:特定工作神兽类型,无限定填0
+     * @param type $type
+     */
+    static function DealBuild_ProcessWork($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_ProcessWork, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 采矿场 结果收取一次         
+     * 参数一:特定工作神兽类型,无限定填0  
+     * @param type $type
+     */
+    static function DealBuild_ProcessResult($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_ProcessResult, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  加工厂 结果收取
+     * [累计道具的收取始数量]
+     * 参数一:特定成果道具ID, 无限定填0  
+     * @param type $type
+     * @param type $num
+     */
+    static function DealBuild_ProcessResult_S($type, $num) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Build_ProcessResult, "add", $num, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 收取建造的建筑的经验值    
+     * 参数一:特定建筑ID,无限定填0       
+     * 计数:要求数目
+     * @param type $type
+     */
+    static function DealBuild_CollectExp($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_CollectExp, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 酒馆配置上阵神兽    
+     * 计数:配置次数
+     */
+    static function DealBuild_PubTeamConfig() {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Build_PubTeamConfig, "inc", 1);
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    ################################   神兽   #######################################################################
+
+    /**
+     * 拥有一只神兽	/ 拥有一只指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * 参数三:特定星级,无限定填0
+     * @param type $type
+     * @param type $level
+     */
+    static function DealPet_Own($type, $level, $star) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Pet, "set", self::GetPetNum($type, $level, $star), array($type, $level, $star));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 喂养一次神兽  /   喂养一次指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * @param type $type
+     */
+    static function DealPet_Feed($type) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Pet_Feed, "inc", 1, array($type));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 升级一次神兽	/ 升级一次指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定等级,无限定填0
+     * @param type $level
+     * @param type $type
+     */
+    static function DealPet_LevelUp($type, $level) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Pet_LevelUp, "inc", 1, array($type, $level));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  升级技能一次神兽	/ 升级一次指定神兽	的技能
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定技能ID,无限定填0
+     * 参数三:特定技能等级,无限定填0
+     * @param type $level
+     * @param type $type
+     */
+    static function DealPet_Skill($type, $skill, $skillLevel) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Pet_Skill, "inc", 1, array($type, $skill, $skillLevel));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 升星一次神兽	/ 升星一次指定神兽	
+     * 参数一:特定神兽类型,无限定填0
+     * 参数二:特定星级,无限定填0
+     * @param type $starlv
+     * @param type $type
+     */
+    static function DealPet_Star($type, $starlv) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Pet_Star, "inc", 1, array($type, $starlv));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    // ---------------------  探索任务卡相关   ------------------------
+
+    /**
+     * 占领一块领地 / 占领一块指定领地
+     * 参数一:特定领地类型,无限定填0
+     * @param type $gridtype
+     */
+    static function DealExplore_GridCaptureSucced($gridtype) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_GridCaptureSucced, "inc", 1, array($gridtype));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 进行一次占领(不考虑结果)
+     * 参数一:特定领地类型,无限定填0
+     * @param type $gridtype
+     */
+    static function DealExplore_GridCapture($gridtype) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_GridCapture, "inc", 1, array($gridtype));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 拥有N块领地 / 拥有N块指定领地
+     * 参数一:特定领地类型,无限定填0
+     * @param type $gridtype
+     */
+    static function DealExplore_GridOwn($gridtype) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::SEvn_Explore_GridOwn, "set", self::GetExlporeGridNum($gridtype), array($gridtype));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 与NPC交谈处理流程
+     * @param type $mapId
+     * @param type $posX
+     * @param type $posY
+     * @param type $npcId
+     */
+    static function dealTalkToMissNpc($mapId, $posX, $posY, $npcId) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_TalkToMissNpc, "inc", 1, array($mapId, $posX . "_" . $posY));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 与NPC战斗处理流程
+     * @param type $mapId
+     * @param type $posX
+     * @param type $posY
+     * @param type $npcId
+     */
+    static function dealFightToMissNpc($mapId, $posX, $posY, $npcId) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_FightToMissNpc, "inc", 1, array($mapId, $posX . "_" . $posY));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 进入一次探索地图	
+     */
+    static function DealExplore_EnterMap($map) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_EnterMap, "inc", 1, array($map));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 队伍调动
+     */
+    static function DealExplore_ArmyDeploy() {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Explore_ArmyDeploy, "inc", 1);
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    // ----------------------------------------------------------------------------------------
+
+    /**
+     * 加速一次	/   加速一次指定操作
+     * 参数一:加速类型(建造 /种植 /孵化/铲除障碍物),无限定填0
+     * @param type $speedType  build / plant /  hatch / obstacle
+     */
+    static function Deal_SpeedUp($speedType) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_SpeedUp, "inc", 1, array($speedType));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  岛屿解锁
+     * 计数:要求数目
+     */
+    static function Deal_MapIsLand() {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_MapIsLand, "inc", 1);
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     *  岛屿阴影解锁
+     * 计数:要求数目
+     */
+    static function Deal_MapShadow() {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_MapShadow, "inc", 1);
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    /**
+     * 新手引导  
+     *  @param type $step =  引导步骤
+     */
+    static function DealGuideStep($step) {
+        $ings = array();
+        $info = new MissEventInfo(
+                MissEventCode::Evn_Guide, "set", $step, array($step));
+        $list = self::SelectIngMissions($info);
+        foreach ($list as $id) {
+            $ings[] = self::PropelIngMission($id, $info);
+        }
+        self::DealToServer($ings);
+    }
+
+    //----------------------------------
+    // ---------------------------状态辅助方法--------------------------------
+
+    /**
+     * 获取当前建筑数量
+     * @param type $cabid =  建筑一级大类
+     * @param type $subId =  建筑二级分类
+     * @param type $level =  建筑等级
+     * @return int
+     */
+    static function GetBuildingNum($cabid = 0, $subId = 0, $level = 0) {
+        $num = 0;
+        $mapInfo = usrInfo()->mapInfo(false);
+        foreach ($mapInfo->items as $key => $bd) {
+            $buildMo = dataCenter()->getItemBuildData($bd->buildid);
+            if ($buildMo->level >= $level) {
+                if (($cabid == 0 || ($cabid != 0 && $buildMo->categoryId == $cabid)) &&
+                        ($subId == 0 || ($subId != 0 && $buildMo->subcategoryId == $subId))) {
+                    $num++;
+                }
+            }
+        }
+        return $num;
+    }
+
+    /**
+     * 获取当前英雄数量
+     * @return int
+     */
+    static function GetPetNum($type = 0, $level = 0, $star = 0) {
+        $num = 0;
+        $mapInfo = usrInfo()->mapInfo(false);
+        foreach ($mapInfo->godpets as $iid => $hero) {
+            if ($hero->type == $type || $hero->level == $level || $hero->currStar == $star) {
+                $num++;
+            }
+        }
+        return $num;
+    }
+
+    /**
+     * 获得探索中,拥有某个类型得领地数量
+     * @param type $type
+     * @return int
+     */
+    static function GetExlporeGridNum($type = 0) {
+        $num = 0;
+        return $num;
+    }
+
+}

+ 16 - 12
Gameserver/Amfphp/test.php

@@ -4,21 +4,25 @@ namespace loyalsoft;
 
 include __DIR__ . '/main.php';
 echoLine("phpver: " . PHP_VERSION . PHP_EOL);
-
 //SelfChecker::CheckAll();
 //
 //set_time_limit(15);                                                           # 设置执行超时时间
 //
-//require_once ROOTDIR . '/Util/OpenSSLVerify.php';                             # Ps. 这个文件和类名没有对应关系.
-//header('X-Accel-Buffering: no');                                              # nginx 控制头, 关闭buffer
-//$tableName = "test-20201123";
-//var_dump(daoInst()->tableExist($tableName));
-//var_dump(GameConfig::primordial_data());
+
+$paras = explode(',', "");
+var_dump($paras);
+if (strlen("") <= 0) {
+    echoLine("ok");
+} else {
+    echoLine("false");
+    var_dump(count($paras));
+}
 
 
-test(function() {
-    $key = "test";
-    $v = gMem()->get($key);
-//    var_dump($v);
-    gMem()->set($key, \loyalsoft\TimeUtil::dtCurrent());
-}, 100);
+//
+//test(function() {
+//    $key = "test";
+//    $v = gMem()->get($key);
+////    var_dump($v);
+//    gMem()->set($key, \loyalsoft\TimeUtil::dtCurrent());
+//}, 100);

+ 15 - 6
Gameserver/nbproject/private/private.xml

@@ -12,14 +12,23 @@
     </editor-bookmarks>
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
         <group>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/test.php</file>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/Services/AppServer.php</file>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/EnumTaskType.php</file>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/base/ErrCode.php</file>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/index.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/del_Info_MissInfo.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/del_MissProc.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Data_UserZoneInfo.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/del_Ins_MissEventInfo.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Enum_TaskCmdType.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/Data_UserProfile.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Info_UserTask.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/del_Ins_MissEventCode.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Ins_TaskParams.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Ins_TaskCard.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Ins_TaskStep.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Ins_TaskInfo.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/model/User/Info_UserShop.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Info_Store.php</file>
-            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/util/CRedisUtil.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/del_Ins_MisStatus.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/model/User/Data_UserGame.php</file>
         </group>
     </open-files>