Просмотр исходного кода

bug修复和每日任务全部接口

cyzhao 3 лет назад
Родитель
Сommit
a34e8837a3

+ 11 - 1
Gameserver/Amfphp/model/Const/globalsettings.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-05-16 14:24:14
+ // 日期: 2022-06-07 14:43:48
 ////////////////////
 
 
@@ -500,5 +500,15 @@ class globalsettings
     */
     public $DailyTaskLevelLimitLock;
 
+    /**
+    * @var Object 每日任务常规任务  
+    */
+    public $dailyTask_Common;
+
+    /**
+    * @var Object 每日任务交付任务  
+    */
+    public $dailyTask_HandOver;
+
 }
 

+ 45 - 29
Gameserver/Amfphp/model/User/Info_NewMap.php

@@ -51,40 +51,56 @@ class Info_NewMap extends Object_ext {
         if (null === $arg) {
             // 直接初始化8个大陆的基本数据
             $initMapid = 503099;                                                # 新手村的id
+            $this->lastMapId = $initMapid;
             $this->curMapId = $initMapid;                                       # 当前位置为新手村
-            $this->curFootholdId = 503099;                                      # 当前据点id
-            
+            $this->curFootholdId = $initMapid;                                      # 当前据点id
             $this->unlockedFootholds = ObjectInit();
-            $mo = GameConfig::gate_getItem($initMapid);
-            $footHold = new Ins_FootHold();
-            $footHold->mapId = $mo->gateId;
-            $footHold->curMapType = $mo->mapType;
-            $this->unlockedFootholds->$initMapid = $footHold;                   # 初始化解锁新手村据点数据
-            #
-            // 把2号据点也解锁
-            $initMapid = 503100;                                                  # 新手村的id
-            // $this->curMapId = $initMapid;                                       # 当前位置为新手村
-            // $this->unlockedFootholds = ObjectInit();
-            $mo = GameConfig::gate_getItem($initMapid);
-            $footHold = new Ins_FootHold();
-            $footHold->mapId = $mo->gateId;
-            $footHold->curMapType = $mo->mapType;
-            $this->unlockedFootholds->$initMapid = $footHold;                   # 初始化解锁新手村据点数据
             
-            $dixiachengId = 503001;
-            $mo = GameConfig::gate_getItem($dixiachengId);
-            $footHold = new Ins_FootHold();
-            $footHold->mapId = $mo->gateId;
-            $footHold->curMapType = $mo->mapType;
-            $this->unlockedFootholds->$dixiachengId = $footHold; 
+            $gateZonemo = GameConfig::gate_zone_getItem(501007);
+            if($gateZonemo!=null){
+                $list = explode(',',$gateZonemo->contains); 
+                foreach ($list as $id) {
+                    $mo = GameConfig::gate_getItem($id);
+                    $footHold = new Ins_FootHold();
+                    $footHold->mapId = $mo->gateId;
+                    $footHold->curMapType = $mo->mapType;
+                    $this->unlockedFootholds->$id = $footHold;
+                }
+                
+            }
+            
             
             
-            $dixiachengId = 503002;
-            $mo = GameConfig::gate_getItem($dixiachengId);
-            $footHold = new Ins_FootHold();
-            $footHold->mapId = $mo->gateId;
-            $footHold->curMapType = $mo->mapType;
-            $this->unlockedFootholds->$dixiachengId = $footHold;
+//            $mo = GameConfig::gate_getItem($initMapid);
+//            $footHold = new Ins_FootHold();
+//            $footHold->mapId = $mo->gateId;
+//            $footHold->curMapType = $mo->mapType;
+//            $this->unlockedFootholds->$initMapid = $footHold;                   # 初始化解锁新手村据点数据
+            #
+            // 把2号据点也解锁
+//            $initMapid = 503100;                                                  # 新手村的id
+//            // $this->curMapId = $initMapid;                                       # 当前位置为新手村
+//            // $this->unlockedFootholds = ObjectInit();
+//            $mo = GameConfig::gate_getItem($initMapid);
+//            $footHold = new Ins_FootHold();
+//            $footHold->mapId = $mo->gateId;
+//            $footHold->curMapType = $mo->mapType;
+//            $this->unlockedFootholds->$initMapid = $footHold;                   # 初始化解锁新手村据点数据
+//            
+//            $dixiachengId = 503001;
+//            $mo = GameConfig::gate_getItem($dixiachengId);
+//            $footHold = new Ins_FootHold();
+//            $footHold->mapId = $mo->gateId;
+//            $footHold->curMapType = $mo->mapType;
+//            $this->unlockedFootholds->$dixiachengId = $footHold; 
+//            
+            
+//            $dixiachengId = 503002;
+//            $mo = GameConfig::gate_getItem($dixiachengId);
+//            $footHold = new Ins_FootHold();
+//            $footHold->mapId = $mo->gateId;
+//            $footHold->curMapType = $mo->mapType;
+//            $this->unlockedFootholds->$dixiachengId = $footHold;
             
             $this->unlockMapTypeList = ObjectInit();                            #初始化--已经解锁的地图上的区域、npc、道具等等信息      
             $this->huichengquanRecord = ObjectInit();                                #                      

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

@@ -75,6 +75,12 @@ class Info_Store extends Object_ext {
     public $battleItem = null;
 
 
+    /*
+     * 每日任务--交付任务是否领取奖励
+     */
+    public $dailyTask_HandOver = 0;
+
+
     /**
      * 玩家注册时初始化
      */

+ 6 - 5
Gameserver/Amfphp/process/HeroProc.php

@@ -158,14 +158,15 @@ class HeroProc {
 //                break;
 //        }
         
-        $yanling = new Ins_YanLin();
-        $yanling->typeId = $yanlingId;
-        $cid = ctx()->privateState->currentId++;
-        ctx()->store(true)->yanling->$cid = $yanling;
+        StoreProc::PutYanLingInStore($yanlingId);
+//        $yanling = new Ins_YanLin();
+//        $yanling->typeId = $yanlingId;
+//        $cid = ctx()->privateState->currentId++;
+//        ctx()->store(true)->yanling->$cid = $yanling;
         
         UserProc::updateUserInfo();
 
-        return Resp::ok(array('store' => ctx()->store,'gold'=> ctx()->baseInfo->gold,));
+        return Resp::ok(array('store' => ctx()->store,'yanlingId'=> $yanlingId,'gold'=> ctx()->baseInfo->gold,));
     }
     
 

+ 15 - 13
Gameserver/Amfphp/process/MapProc.php

@@ -104,18 +104,20 @@ class MapProc {
         $newMap = ctx()->newMap();
         $curMapId = $newMap->curMapId;
         
-//        $zoneId = GameConfig::map_scene_getItem($curMapId)->zoneId;
-//        $item = GameConfig::map_scene_zoneid_getItemArray($zoneId)[0];         
-        $lastMapid = $curMapId;
-        $gateZone = GameConfig::gate_zone();
-        my_Assert($gateZone != null, ErrCode::err_const_no);
-        foreach ($gateZone as $zoneid => $val) {
-            $list = explode(',', $val->contains);
-            if(in_array($curMapId, $list)){
-                $lastMapid = $list[0];
-                break;
-            }
-        } 
+        
+        $lastMapid = $newMap->lastMapId;
+//        $lastMapid = $curMapId;
+//        $gateZone = GameConfig::gate_zone();
+//        my_Assert($gateZone != null, ErrCode::err_const_no);
+//        foreach ($gateZone as $zoneid => $val) {
+//            $list = explode(',', $val->contains);
+//            if(in_array($curMapId, $list)){
+//                $lastMapid = $list[0];
+//                break;
+//            }
+//        }
+        
+        
         
         if(StlUtil::dictHasProperty($newMap->huichengquanRecord, $lastMapid)){           
             StlUtil::dictRemove($newMap->huichengquanRecord, $lastMapid);
@@ -288,7 +290,7 @@ class MapProc {
             $footHold = new Ins_FootHold();
             $footHold->mapId = $mo->gateId;
             $footHold->curMapType = $mo->mapType;
-            $this->unlockedFootholds->$targetMapId = $footHold;                   # 初始化解锁新手村据点数据
+            $newMap->unlockedFootholds->$targetMapId = $footHold;                   # 初始化解锁新手村据点数据
         }       
         
         # 检查目标地图是否已经解锁

+ 17 - 17
Gameserver/Amfphp/process/StoreProc.php

@@ -1211,23 +1211,23 @@ class StoreProc {
                 case 202:                                                       # 召唤书碎片
                 case 351:                                                       # 言灵召唤书
                     StoreProc::PutOverlyingItemInStore($itemId, $num);          # 直接进包裹items
-                    $book = GameConfig::item_yanlingbook_getItem($itemId);
-                    my_Assert(null != $book, ErrCode::err_const_no);
-                    $ylCfg = GameConfig::item_yanling_getItem($book->yanling_id);
-                    my_Assert(null != $ylCfg, ErrCode::err_const_no);
-                    switch ($ylCfg->career) {                                   # 根据不同职业更新角标系统
-                        case 1:
-                            CornerSignEventProc::OnCall_Warrior_new();          # 战士
-                            break;
-                        case 2:
-                            CornerSignEventProc::OnCall_Magician_new();         # 法师
-                            break;
-                        case 3:
-                            CornerSignEventProc::OnCall_Archer_new();           # 射手
-                            break;
-                        default :
-                            break;
-                    }
+//                    $book = GameConfig::item_yanlingbook_getItem($itemId);
+//                    my_Assert(null != $book, ErrCode::err_const_no);
+//                    $ylCfg = GameConfig::item_yanling_getItem($book->yanling_id);
+//                    my_Assert(null != $ylCfg, ErrCode::err_const_no);
+//                    switch ($ylCfg->career) {                                   # 根据不同职业更新角标系统
+//                        case 1:
+//                            CornerSignEventProc::OnCall_Warrior_new();          # 战士
+//                            break;
+//                        case 2:
+//                            CornerSignEventProc::OnCall_Magician_new();         # 法师
+//                            break;
+//                        case 3:
+//                            CornerSignEventProc::OnCall_Archer_new();           # 射手
+//                            break;
+//                        default :
+//                            break;
+//                    }
                     break;
                 case 321:                                                       # 进阶材料
                 case 322:                                                       # 进阶材料

+ 57 - 12
Gameserver/Amfphp/process/TaskProc.php

@@ -404,6 +404,8 @@ class TaskProc {
         ctx()->college = $college;
 
         $store->taskcards->$taskCardUID = $taskCard;                            # 回写任务数据
+        
+        self::checkHandOverDailyTask($taskCardUID);                             #检测每次任务中的交付任务是否需要挂载了
         NormalEventProc::OnTaskCard_Reward($taskCard->mo()->reward, null);      # 带入事件
         self::OnFinishTaskCard($taskCard);                                      # 触发检查任务卡的任务卡[・_・?]
         if (!empty($taskCard->mo()->newTaskCard)) {                             # 下一个任务卡存在
@@ -446,6 +448,39 @@ class TaskProc {
                     'priv' => ctx()->privateState,
                     'college' => ctx()->college,));                   # 返回值更新背包
     }
+    
+    static function checkHandOverDailyTask($taskCardUID) {
+        if(ctx()->store->dailyTask_HandOver > 0){
+            return;
+        }
+        $taskcards = ctx()->store->taskcards;
+        $list = explode(',',glc()->dailyTask_HandOver); 
+        if(in_array($taskcards->$taskCardUID->typeId, $list)){
+            ctx()->store->dailyTask_HandOver = 1;
+            return;
+        }
+        
+        $num = 0;
+        
+        $handOverTask = 0;      
+        foreach ($taskcards as $uid => $task) {
+            $mo = GameConfig::item_taskcard_getItem($task->typeId);
+            if($mo->type == 2){
+                if(in_array($task->typeId, $list)){
+                    $handOverTask = 1;
+                } else {
+                    $num += 1;
+                }                            
+            }
+        }
+        
+        if($num==0 && $handOverTask == 0){//每日任务全部完成,挂载每日任务--交付任务           
+            $count = count($list);
+            $rand = rand(0,$count-1);
+            
+            StoreProc::PutTaskCardInStore($list[$rand]);
+        }
+    }
 
     /**
      * [6217] 任务卡 - 更新信息
@@ -637,8 +672,11 @@ class TaskProc {
      */
     static function ResetDailyTaskCards() {
 //        var_dump("重置日常任务卡");
-        $store = ctx()->store();
+        $store = ctx()->store(true);   
         my_default_Obj($store->taskcards);
+        
+        $store->dailyTask_HandOver = 0;
+        
         $dailyCards = new \stdClass();
         foreach (GameConfig::item_taskcard() as $id => $cardMo) {
             isEditor() and $cardMo = new \sm_item_taskcard();
@@ -657,30 +695,36 @@ class TaskProc {
                 }
         }
         ctx()->store = $store;
+                
+        $pri = ctx()->privateData();                                            # 私有数据
+        $cardType = 2;                                                          # 日常任务,设置追踪
+        my_default_Obj($pri->taskCardTracing);                                  # 确保 tracing数据结构是否完整.
         
-        if (count($dailyCards) < 4) {                                 
+        $commonTaskList = explode(',', glc()->dailyTask_Common);        
+        if (count($commonTaskList) < 4) {                                 
             // 再遍历一遍, 添加今日日常任务.
             $cid = 0;
-            foreach ($dailyCards as $id => $cardMo) {
+            foreach ($commonTaskList as $id) {
                 $cid = StoreProc::PutTaskCardInStore($id);                                 # 添加任务卡到背包
             }
-            $pri = ctx()->privateData();                            # 私有数据
-
-            $cardType = 2;                                                          # 日常任务,设置追踪
-            my_default_Obj($pri->taskCardTracing);                                  # 确保 tracing数据结构是否完整.
-            $pri->taskCardTracing->$cardType = $cid;                                # 更新tracing数据
+                                                          
+            $pri->taskCardTracing->$cardType = $cid;                            # 更新tracing数据
         } else {
-            $count = count($dailyCards);
+            $tempCid = 0;
+            $count = count($commonTaskList);
             $temp = array();
             while (true) {
-                $num = rand(0,$count);
+                $num = rand(0,$count-1);
                 if(in_array($num, $temp)){
                     continue;
                 }
                 $index = 0;
-                foreach ($dailyCards as $id => $cardMo) {
+                foreach ($commonTaskList as $id) {
                     if($index >= $num){
-                        $cid = StoreProc::PutTaskCardInStore($id);# 添加任务卡到背包
+                        $cid = StoreProc::PutTaskCardInStore($id);              # 添加任务卡到背包
+                        if($tempCid == 0){
+                            $tempCid = $cid;
+                        }
                         break;
                     }  
                     $index+=1;
@@ -691,6 +735,7 @@ class TaskProc {
                     break;
                 }
             }
+            $pri->taskCardTracing->$cardType = $tempCid;                        # 更新tracing数据
                     
         }
         UserProc::updateUserInfo();                                             # 回存数据.(不管从哪里调用的, 更新肯定没错.)

+ 10 - 2
Gameserver/Amfphp/process/UserProc.php

@@ -457,7 +457,7 @@ class UserProc {
         return $resp;
     }
     
-    public static function newFieldSupplement(&$game) {
+    public static function newFieldSupplement(&$game) {       
         if(!StlUtil::dictHasProperty($game->store,'storage')){
             $key = 1;
             $key2 = 2;
@@ -511,7 +511,15 @@ class UserProc {
         if(!StlUtil::dictHasProperty($game->newMap, 'curFootholdId')){
             $game->newMap->curFootholdId = $game->newMap->curMapId;
         }
-            
+        
+        if($game->newMap->lastMapId == 0){
+            $game->newMap->lastMapId = 503099;
+        }
+        
+       if(!StlUtil::dictHasProperty($game->store, 'dailyTask_HandOver')){
+            $game->store->dailyTask_HandOver = 0;
+        }
+                  
     }
 
     /**