فهرست منبع

添加地图解锁触发逻辑(指挥官等级)

gwang 4 سال پیش
والد
کامیت
e289b59d40

+ 1 - 1
Gameserver/Amfphp/main.php

@@ -29,7 +29,7 @@ function getRootURL() {
  * 经验证,复杂逻辑(会多次读取配置信息时)可以有效改善性能. -gwang 2020.11.24 
  * @var boolean (部署环境)是否允许代码生成
  */
-define('CodeGen_Enabled', true)
+define('CodeGen_Enabled', false)
         and CodeGen_Enabled
         and define('CodeGen_Folder', ROOTDIR . '/../../CodeGen/');              # 代码生成功能的输出位置
 

+ 3 - 3
Gameserver/Amfphp/model/User/Info_Map.php

@@ -19,8 +19,8 @@ class Info_Map extends Object_ext {
     function __construct($arg = null) {
         if (null === $arg) {
             // 直接初始化8个大陆的基本数据
+            $this->mainlands = ObjectInit();
             foreach (GameConfig::gate_mainland() as $id => $land) {
-                $this->mainlands = ObjectInit();
                 $ins = new Ins_Mainland();
                 $ins->landId = $id;
                 if (1 == $id) {                                                 # 第一个大陆, 直接开启第一个区域
@@ -31,10 +31,10 @@ class Info_Map extends Object_ext {
                     $zonecfg = GameConfig::gate_zone_getItem($zoneid);
                     my_Assert($zonecfg, ErrCode::err_const_no);
                     $gateIds = explode(',', $zonecfg->contains);
-                    $zone->highest = $gateIds[0];
+                    $zone->gates[] = $gateIds[0];
                     $ins->normal->$zoneid = $zone;
                 }
-                $this->$id = $ins;
+                $this->mainlands->$id = $ins;
             }
         } else {
             parent::__construct($arg);

+ 13 - 0
Gameserver/Amfphp/model/User/Ins_Mainland.php

@@ -42,4 +42,17 @@ class Ins_Mainland extends Object_ext {
         }
     }
 
+    public function getZoneMos() {
+        $ldc = GameConfig::gate_mainland_getItem($this->landId);
+        $zidArr = explode(',', $ldc->containZones);
+        $ret = array();
+        $w = (array) GameConfig::gate_zone();
+        array_walk($w, function ($v, $k) use($zidArr, &$ret) {
+            if (in_array($k, $zidArr)) {
+                $ret[] = $v;
+            }
+        });
+        return $ret;
+    }
+
 }

+ 14 - 14
Gameserver/Amfphp/model/User/Ins_Mapzone.php

@@ -14,23 +14,23 @@ class Ins_Mapzone extends Object_ext {
      */
     public $zoneid;
 
-    /**
-     * 最后一次挑战的关卡ID
-     * @var int
-     */
-    public $latest = 1;
-
-    /**
-     * 已挑战的最高关卡Id(用于限定解锁关卡)
-     * @var int
-     */
-    public $highest = 1;
+//    /**
+//     * 最后一次挑战的关卡ID
+//     * @var int
+//     */
+//    public $latest = 1;
+//
+//    /**
+//     * 已挑战的最高关卡Id(用于限定解锁关卡)
+//     * @var int
+//     */
+//    public $highest = 1;
 
     /**
      * 关卡具体数据()
-     * @var asoc_array/Ins_UGate dic<gateId,Ins_UGate>
+     * @var array[]
      */
-    public $gates;
+    public $gates = array();
 
     /**
      * 构造函数
@@ -38,7 +38,7 @@ class Ins_Mapzone extends Object_ext {
      */
     function __construct($arg = null) {
         if (null === $arg) {
-            $this->gates = ObjectInit();
+            $this->gates = array();
         } else {
             parent::__construct($arg);
         }

+ 15 - 0
Gameserver/Amfphp/process/EventProc.php

@@ -82,6 +82,21 @@ class EventProc {
             }
         }
 
+        $map = req()->userInfo->game->map;
+        foreach ($map->mainlands as $id => $mlnd) {                             # 检查解锁
+            $mlnd = new Ins_Mainland($mlnd);
+            foreach ($mlnd->getZoneMos() as $zoneid => $zone) {
+                isEditor()and $zone = new \sm_gate_zone();
+                if ($zone->playerLevelLimit <= $new) {
+                    if (!CommUtil::isPropertyExists($mlnd->normal, $zoneid)) {
+                        NormalEventProc::OnUnlockMap($zoneid, 0);
+                    } else {
+                        // 此区域已经解锁,走顺序关卡模式,除非有其他任务卡或者什么东西直接解锁了某个关卡
+                    }
+                }
+            }
+        }
+
 //        NormalEventProc::OnHelloWorld($arg1, $arg2);                            # 添加升级事件,算了这个暂时没人关注
     }
 

+ 7 - 24
Gameserver/Amfphp/test.php

@@ -8,28 +8,11 @@ echoLine("phpver: " . PHP_VERSION . PHP_EOL);
 //
 //set_time_limit(15);                                                           # 设置执行超时时间
 //
-
-$id = 233;
-
-var_dump(sprintf("%07d", $id));
-
-//$arr = array("name" => "王刚",
-//    "sex" => "male",
-//);
-//$url = "https://siapcn.galaxyappstore.com/samsung/coupon-merch/player/login_check";
-//$par = '{"applyNo":"5000951584","uid":"54337601","sign":"bnECLDsKKI3n3jBEPHfVvOuoQH\/n8QlVnbfeS5Rk3+jt6WqtMjMDzIZtEaL0TCaxssz0wa5YJ8TxnFe+3smElIYc1jSYzKpGFZi15w8iWk6wyVn4az15HXzNc66ImSFq1RAgkoe8BAMVWUfhr2Jz2c+k4dZuZ+c5vG6miZTznWY="}';
-//$resp = HttpUtil::makeRequest($url, $par, array(), array('Content-type: application/json;charset=utf-8'));
+//$id = 233;
 //
-//var_dump($resp);
-//
-//$url = "http://192.168.10.86/PetMulti/Gameserver/Amfphp/service_call/pay/samsung/login_samsung_dy.php";
-//$par = "appid=5000951584&signature=1c30d675131e7af135ead2ca8f6a20a3&uid=54337601&signMethod=MD5&";
-//$resp = HttpUtil::makeRequest($url, $par);
-//var_dump($resp);
-//
-//test(function() {
-//    $key = "test";
-//    $v = gMem()->get($key);
-////    var_dump($v);
-//    gMem()->set($key, \loyalsoft\TimeUtil::dtCurrent());
-//}, 100);
+//var_dump(sprintf("%07d", $id));
+
+$mlnd = new Ins_Mainland();
+$mlnd->landId = 1;
+//var_dump((array) GameConfig::gate_zone());
+var_dump($mlnd->getZoneMos());