Browse Source

地图探索

cyzhao 3 years ago
parent
commit
0588649aa1

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

@@ -1326,7 +1326,21 @@ class CmdCode {
      * 解锁据点
      */
     public const map_UnlockMap = 7504;
+    
+//    /**
+//     * 获取100_0_0_时间戳这些已经解锁保存了的数据
+//     */
+//    public const map_getUnlockInfoList = 7505;
+    
+    /**
+     * 100_0_0_时间戳保存
+     */
+    public const map_unlockInfoSva = 7505;
 
+    /*
+     * 领取探索奖励
+     */
+    public const map_reviceExplorerReward = 7506;
 // 
 // // </editor-fold>
 // 

+ 4 - 4
Gameserver/Amfphp/configs/GameConfig.php

@@ -6,7 +6,7 @@ namespace loyalsoft;
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-04-07 11:33:54
+ // 日期: 2022-04-08 09:34:06
 ////////////////////
 
 /**
@@ -1700,11 +1700,11 @@ class GameConfig {
         return self::initValue($a, 'map_explorer');
     }
     /**
-    * @return \sm_map_explorer map_explorer item数据 
+    * @return \sm_map_explorer map_explorer itemArray 
     */
-    public static function map_explorer_getItem($mapid, $id)
+    public static function map_explorer_getItemArray($key)
     { 
-        return self::get_hash_item('map_explorer', $mapid)->$id;
+        return self::get_hash_item('map_explorer', $key);
     }
     /**
     * 当前版本(时间戳)

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-04-07 11:33:54
+ // 日期: 2022-04-08 09:34:06
 ////////////////////
 
 /**
@@ -1697,11 +1697,11 @@ class GameConfig {
         return self::initValue($a, 'map_explorer');
     }
     /**
-    * @return \sm_map_explorer map_explorer item数据 
+    * @return \sm_map_explorer map_explorer itemArray 
     */
-    public static function map_explorer_getItem($mapid, $id)
+    public static function map_explorer_getItemArray($key)
     { 
-        return self::get_hash_item('map_explorer', $mapid)->$id;
+        return self::get_hash_item('map_explorer', $key);
     }
     /**
     * 当前版本(时间戳)

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:18
+ // 日期: 2022-03-25 15:14:47
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:37:30
+ // 日期: 2022-03-25 15:15:12
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:18
+ // 日期: 2022-03-25 15:15:23
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:19
+ // 日期: 2022-03-25 15:15:35
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:21
+ // 日期: 2022-03-25 15:16:43
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:37:34
+ // 日期: 2022-03-25 15:16:51
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:37:35
+ // 日期: 2022-03-25 15:17:02
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-01-12 15:49:27
+ // 日期: 2022-03-25 15:17:11
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:37:36
+ // 日期: 2022-03-25 15:17:15
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-21 14:42:22
+ // 日期: 2022-03-25 15:17:27
 ////////////////////
 
 

+ 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-12-21 14:42:23
+ // 日期: 2022-03-25 15:17:39
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-01-18 11:55:23
+ // 日期: 2022-03-31 18:03:48
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-02 15:18:46
+ // 日期: 2022-03-23 14:24:20
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-02 15:17:36
+ // 日期: 2022-03-23 14:25:11
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-02 15:17:36
+ // 日期: 2022-03-23 14:25:11
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-15 11:19:24
+ // 日期: 2022-03-18 10:38:27
 ////////////////////
 
 

+ 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 
- // 日期: 2022-03-02 09:57:28
+ // 日期: 2022-03-31 15:31:23
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2022-03-03 10:38:20
+ // 日期: 2022-03-15 15:59:30
 ////////////////////
 
 

+ 9 - 1
Gameserver/Amfphp/model/User/Info_NewMap.php

@@ -22,7 +22,13 @@ class Info_NewMap extends Object_ext {
      * @var dic< 据点id, Ins_FootHold >
      */
     public $unlockedFootholds;
-
+    
+    /**
+     * 已经解锁的地图上的区域、npc、道具等等信息
+     * @var type
+     */
+    public $unlockMapTypeList;
+    
     function __construct($arg = null) {
         if (null === $arg) {
             // 直接初始化8个大陆的基本数据
@@ -44,6 +50,8 @@ class Info_NewMap extends Object_ext {
             $footHold->mapId = $mo->mapId;
             $footHold->curMapType = $mo->mapType;
             $this->unlockedFootholds->$initMapid = $footHold;                   # 初始化解锁新手村据点数据
+            
+            $this->unlockMapTypeList = ObjectInit();                            #初始化--已经解锁的地图上的区域、npc、道具等等信息
         } else {
             parent::__construct($arg);
         }

+ 81 - 0
Gameserver/Amfphp/process/MapProc.php

@@ -23,10 +23,91 @@ class MapProc {
                 return self::UpdateExplorationProgress();
             case CmdCode::map_UnlockMap:                                        #  [7504] 解锁据点
                 return self::UnlockMap();
+//            case CmdCode::map_getUnlockInfoList:                              #  [7505] 获取mapid下已经解锁的列表
+//                return self::getUnlockInfoList();
+            case CmdCode::map_unlockInfoSva:                                    #  [7505] 保存mapid下已经解锁的
+                return self::unlockInfoSva();    
+            case CmdCode::map_reviceExplorerReward:                             #  [7506] 领取探索奖励
+                return self::reviceExplorerReward();
             default:                                                            #  err: 未知的命令码
                 return Resp::err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 
+     * @return Resp
+     */
+    public static function reviceExplorerReward(){
+        $mapid = req()->paras[0];   # 提取参数		                                       
+        $newMap = req()->userInfo->game->newMap();         
+	            
+        $newMap->unlockedFootholds->$mapid->exploreRewardGeted = true;
+        
+        StoreProc::AddMultiItemInStore(GameConfig::map_scene_getItem($mapid)->exploreReward);           
+        req()->userInfo->game->newMap = $newMap;
+        
+        UserProc::updateUserInfo();
+        return Resp::ok($newMap);
+    }
+    
+    
+    /**
+     * 7505
+     * @return Resp
+     */
+    public static function unlockInfoSva() {
+        $unlockStr = req()->paras[0];   # 提取参数		                                       
+        $newMap = req()->userInfo->game->newMap();         
+	if(!StlUtil::dictHasProperty($newMap, 'unlockMapTypeList')){
+            $newMap->unlockMapTypeList = new \stdClass();
+        }
+		
+        $mapid = explode('_', $unlockStr)[0];                
+        if(!StlUtil::dictHasProperty($newMap->unlockMapTypeList,$mapid)){
+            $newMap->unlockMapTypeList->$mapid = array();
+        }
+        $newMap->unlockMapTypeList->$mapid[]= $unlockStr;   
+        
+        $explorerNum = self::countFootHoldExplorerNum($mapid, $newMap);
+        $newMap->unlockedFootholds->$mapid->curExploreProgress = $explorerNum;       
+        
+        $type = explode('_', $unlockStr)[1]; 
+        if($type == 6 && $newMap->unlockedFootholds->$mapid->transmissionIsOk == false){//临时代码,6代表传送带
+            $newMap->unlockedFootholds->$mapid->transmissionIsOk = true;
+        }
+        
+        req()->userInfo->game->newMap = $newMap;
+        UserProc::updateUserInfo();
+        return Resp::ok($newMap);
+    }
+    
+    /*
+     * 计算探索度值
+     */
+    public static function countFootHoldExplorerNum($mapid,$newMap) {      
+        $explorer = 0;
+        if (StlUtil::dictHasProperty($newMap->unlockMapTypeList,$mapid))
+        {
+            $list = $newMap->unlockMapTypeList->$mapId;
+            $mapList = GameConfig::map_explorer_getItemArray($mapid);                                            
+            if ($mapList != null)
+            {
+                foreach ($map as $item) {
+                    $cmd = $item->cmd;
+                    $parasList = explode(',', $item->paras);
+                    foreach ($list as $para){
+                        $strList = explode('_', $para);
+                        if ($strList[1] == $cmd && $strList[2] == $parasList[0])
+                        {
+                            $explorer += $parasList[1];
+                        }
+                    }
+                }                      
+            }
+        }    
+        return intval($explorer/100);
+    }
 
     /**
      * 7504 解锁据点