Browse Source

代码整理

王刚 3 years ago
parent
commit
923cccef3d
1 changed files with 32 additions and 32 deletions
  1. 32 32
      Gameserver/Amfphp/process/MapProc.php

+ 32 - 32
Gameserver/Amfphp/process/MapProc.php

@@ -35,7 +35,7 @@ class MapProc {
     }
 
     /**
-     * 
+     * [7506] 领取探索奖励
      * @return Resp
      */
     public static function reviceExplorerReward() {
@@ -50,8 +50,8 @@ class MapProc {
 
         UserProc::updateUserInfo();
         return Resp::ok(
-                array("newMap"=>$newMap,"cost"=>$cost,)
-                );
+                        array("newMap" => $newMap, "cost" => $cost,)
+        );
     }
 
     /**
@@ -65,76 +65,76 @@ class MapProc {
             $newMap->unlockMapTypeList = new \stdClass();
         }
 
-        $mapid = explode('_', $unlockStr)[0];        
+        $mapid = explode('_', $unlockStr)[0];
         $type = explode('_', $unlockStr)[1];
         $typeid = explode('_', $unlockStr)[2];
         if (!StlUtil::dictHasProperty($newMap->unlockMapTypeList, $mapid)) {
-            $newMap->unlockMapTypeList->$mapid = array();            
+            $newMap->unlockMapTypeList->$mapid = array();
         }
-        $tag = 1;        
+        $tag = 1;
         $tylist = $newMap->unlockMapTypeList->$mapid;
         foreach ($tylist as $str) {
             $slist = explode('_', $str);
-            if($slist[0] == $mapid && $slist[1] == $type && $slist[2]==$typeid){
-                $tag = 0;                
+            if ($slist[0] == $mapid && $slist[1] == $type && $slist[2] == $typeid) {
+                $tag = 0;
                 break;
             }
         }
         $num = 0;
-        if($tag){
+        if ($tag) {
             $newMap->unlockMapTypeList->$mapid[] = $unlockStr;
-        
-            my_Assert(StlUtil::dictHasProperty($newMap->unlockedFootholds,$mapid), ErrCode::map_Unlocked);
-      
-            $arr = self::countFootHoldExplorerNum($mapid,$type,$typeid, $newMap);         
+
+            my_Assert(StlUtil::dictHasProperty($newMap->unlockedFootholds, $mapid), ErrCode::map_Unlocked);
+
+            $arr = self::countFootHoldExplorerNum($mapid, $type, $typeid, $newMap);
             $explorerNum = $arr[0];
             $num = $arr[1];
             $newMap->unlockedFootholds->$mapid->curExploreProgress = $explorerNum;
-          
+
             if ($type == 2 && $newMap->unlockedFootholds->$mapid->transmissionIsOk == false) {
                 $subtype = GameConfig::npc_getItem($typeid)->subtype;
-                if($subtype == 4){//传送带
+                if ($subtype == 4) {//传送带
                     $newMap->unlockedFootholds->$mapid->transmissionIsOk = true;
-                }                              
+                }
             }
         }
-                    
+
         ctx()->newMap = $newMap;
         UserProc::updateUserInfo();
-        return Resp::ok(array("newMap"=>$newMap,"tag"=>$tag,'num'=>$num,));
+        return Resp::ok(array("newMap" => $newMap, "tag" => $tag, 'num' => $num,));
     }
 
     /*
      * 计算探索度值
      */
 
-    public static function countFootHoldExplorerNum($mapid,$type,$id, $newMap) {
-        $explorer = 0;   
+    public static function countFootHoldExplorerNum($mapid, $type, $id, $newMap) {
+        $explorer = 0;
         $num = 0;
         $retArr = array();
         if (StlUtil::dictHasProperty($newMap->unlockMapTypeList, $mapid)) {
             $list = $newMap->unlockMapTypeList->$mapid;
-            $mapList = GameConfig::map_explorer_getItemArray($mapid);   
-            
+            $mapList = GameConfig::map_explorer_getItemArray($mapid);
+
             $tempList = array();
             if ($mapList != null) {
                 foreach ($mapList as $item) {
-                    if($item->paras == null){
+                    if ($item->paras == null) {
                         continue;
                     }
                     $cmd = $item->cmd;
-                    $parasList = explode(',', $item->paras); 
-                    if($type == $cmd && $id == $parasList[0]){
+                    $parasList = explode(',', $item->paras);
+                    if ($type == $cmd && $id == $parasList[0]) {
                         $num = $parasList[1];
                     }
-                    
-                    foreach ($list as $para) {                       
+
+                    foreach ($list as $para) {
                         $strList = explode('_', $para);
-                        $tempStr = $strList[1].'-'.$strList[2];
-                        if(in_array($tempStr, $tempList)){
+                        $tempStr = $strList[1] . '-' . $strList[2];
+                        if (in_array($tempStr, $tempList)) {
                             continue;
                         }
-                                          
+
                         if ($strList[1] == $cmd && $strList[2] == $parasList[0]) {
                             $tempList[] = $tempStr;
                             $explorer += $parasList[1];
@@ -142,10 +142,10 @@ class MapProc {
                     }
                 }
             }
-        }     
+        }
         $retArr[] = $explorer;
         $retArr[] = $num;
-        
+
         return $retArr;
     }