Browse Source

将剧情结算逻辑从action中迁移出来.

gwang 4 years ago
parent
commit
09a6609ac8

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-04-02 09:42:30
+ // 日期: 2021-04-02 14:44:30
 ////////////////////
 
 /**

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-03-31 16:57:44
+ // 日期: 2021-04-02 10:29:10
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-04-01 21:41:32
+ // 日期: 2021-04-02 14:43:48
 ////////////////////
 
 

+ 8 - 8
Gameserver/Amfphp/model/User/Ins_TaskStep.php

@@ -65,10 +65,10 @@ class Ins_TaskStep extends Object_ext {
      * 执行任务完成事件
      */
     public function doFinishAct() {
-        if ($this->mo()->finishact > 0) {
-            $act = GameConfig::eventAction_getItem($this->mo()->finishact);
-            $this->execAct($act);
-        }
+//        if ($this->mo()->finishact > 0) {
+//            $act = GameConfig::eventAction_getItem($this->mo()->finishact);
+//            $this->execAct($act);
+//        }
         $this->actState = 2;
     }
 
@@ -111,10 +111,10 @@ class Ins_TaskStep extends Object_ext {
      * 执行任务开始事件
      */
     public function doStartAct() {
-        if ($this->mo()->startact > 0) {
-            $act = GameConfig::eventAction_getItem($this->mo()->startact);
-            $this->execAct($act);
-        }
+//        if ($this->mo()->startact > 0) {
+//            $act = GameConfig::eventAction_getItem($this->mo()->startact);
+//            $this->execAct($act);
+//        }
         $this->actState = 1;
     }
 

+ 20 - 1
Gameserver/Amfphp/process/TaskProc.php

@@ -217,7 +217,26 @@ class TaskProc {
      */
     static function PlotFinish($req) {
         list($gate_or_npc_id, $stage) = $req->paras;
-        $bUpdate = self::OnPlotOver($gate_or_npc_id, $stage);                   // 触发一下任务检查
+        $bUpdate = self::OnPlotOver($gate_or_npc_id, $stage);                   # 触发一下任务检查,更新任务状态
+        $arr = GameConfig::plot_getItem($gate_or_npc_id, $stage);               # 查找对应的剧情
+        foreach ($arr as $plot) {
+            isEditor() and $plot = new \sm_plot();
+            if (!empty($plot->presentItem)) {
+                if (strtolower($plot->presentItem) == strtolower("unlockBuild")) { # 特殊处理, 剧情中解锁建筑
+                    req()->userInfo->game->privateState->unlockedBuild[] = $plot->presentEffect; # 添加解锁记录
+                    NormalEventProc::OnUnlockBuild($plot->presentEffect);       # 插入解锁事件
+                } else if (strtolower($plot->presentItem) == strtolower("rename")) {# 改名
+                    // 跳过特殊字符串
+                } else {                                                        # 普通奖励
+                    StoreProc::AddMultiItemInStore(req(), $plot->presentItem);
+                }
+            }
+            if (!empty($plot->recycleItem)) {
+                $val = explode(",", $plot->recycleItem);
+                my_Assert(count($val) > 1, "解析回收道具字符串出错");
+                StoreProc::removeItemFromStore(req()->userInfo->game->store, $val[0], $val[1]);
+            }
+        }
         return Resp::ok(array('store' => $req->userInfo->game->store,
                     'taskCardUpdate' => $bUpdate));
     }