cmd) { case CmdCode::map_EnterFootHold: # [7501] 进入地图 return self::EnterFootHold(); case CmdCode::map_FixUpTransmission: # [7502] 开启传送阵 return self::FixUpTransmision(); case CmdCode::map_UpdateExplorerationProgress: # [7503] 更新探索进度 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] 领取探索奖励cmd_store_huichengQuanUse return self::reviceExplorerReward(); case CmdCode::map_huichengQuanUse: # [7507] return self::huichengQuanUse(); case CmdCode::map_huichengQuanEnd: # [7508] return self::huichengQuanEnd(); default: # err: 未知的命令码 return Resp::err(ErrCode::cmd_err); } } /** * [7507] * @return Resp */ public static function huichengQuanUse() { $mapId = req()->paras[0]; $itemId = req()->paras[1]; # 提取参数 $newMap = ctx()->newMap(true); StoreProc::removeItemFromStore(ctx()->store, $itemId); $zoneId = GameConfig::map_scene_getItem($mapId)->zoneId; $dic = GameConfig::map_scene(); my_Assert($dic != null, ErrCode::err_const_no); $item = GameConfig::map_scene_zoneid_getItemArray($zoneId)[0]; $newMap->curMapId = $item->mapId; $newMap->huichengquanRecord[] = $item->mapId; ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok( array("newMap" => $newMap,) ); } /** * [7508] 回城券的传送阵结束 * @return Resp */ public static function huichengQuanEnd() { $mapid = req()->paras[0]; # 提取参数 $newMap = ctx()->newMap(); //$initMapid = 1001; // my_Assert(in_array($mapid,$newMap->huichengquanRecord), ErrCode::map_NotChuanSongZhen); if(in_array($mapid, $newMap->huichengquanRecord)){ StlUtil::arrayRemove($newMap->huichengquanRecord, $mapid); } ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok( array("newMap" => $newMap,) ); } /** * [7506] 领取探索奖励 * @return Resp */ public static function reviceExplorerReward() { $mapid = req()->paras[0]; # 提取参数 $newMap = ctx()->newMap(); $newMap->unlockedFootholds->$mapid->exploreRewardGeted = true; $cost = GameConfig::map_scene_getItem($mapid)->exploreReward; StoreProc::AddMultiItemInStore($cost); ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok( array("newMap" => $newMap, "cost" => $cost,) ); } /** * 7505 * @return Resp */ public static function unlockInfoSva() { $unlockStr = req()->paras[0]; # 提取参数 $newMap = ctx()->newMap(); if (!StlUtil::dictHasProperty($newMap, 'unlockMapTypeList')) { $newMap->unlockMapTypeList = new \stdClass(); } $mapid = explode('_', $unlockStr)[0]; $type = explode('_', $unlockStr)[1]; $typeid = explode('_', $unlockStr)[2]; if (!StlUtil::dictHasProperty($newMap->unlockMapTypeList, $mapid)) { $newMap->unlockMapTypeList->$mapid = array(); } $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; break; } } $num = 0; if ($tag) { $newMap->unlockMapTypeList->$mapid[] = $unlockStr; 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 == Enum_ExploreType::Npc && $newMap->unlockedFootholds->$mapid->transmissionIsOk == false) { $subtype = GameConfig::npc_getItem($typeid)->subtype; if ($subtype == Enum_ExploreSubType::Teleporter) {//传送带 $newMap->unlockedFootholds->$mapid->transmissionIsOk = true; } } } ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok(array("newMap" => $newMap, "tag" => $tag, 'num' => $num,)); } /* * 计算探索度值 */ 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); $tempList = array(); if ($mapList != null) { foreach ($mapList as $item) { if ($item->paras == null) { continue; } $cmd = $item->cmd; $parasList = explode(',', $item->paras); if ($type == $cmd && $id == $parasList[0]) { $num = $parasList[1]; } foreach ($list as $para) { $strList = explode('_', $para); $tempStr = $strList[1] . '-' . $strList[2]; if (in_array($tempStr, $tempList)) { continue; } if ($strList[1] == $cmd && $strList[2] == $parasList[0]) { $tempList[] = $tempStr; $explorer += $parasList[1]; } } } } } $retArr[] = $explorer; $retArr[] = $num; return $retArr; } /** * 7504 解锁地图 * @return Resp */ public static function UnlockMap() { $targetMapId = req()->paras[0]; # 提取参数 $newMap = ctx()->newMap(); # 检查目标地图是否已经解锁 my_Assert(!isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_Unlocked); $mo = GameConfig::map_scene_getItem($targetMapId); $footHold = new Ins_FootHold(); $footHold->mapId = $mo->mapId; $footHold->curMapType = $mo->mapType; $this->unlockedFootholds->$targetMapId = $footHold; # 添加解锁据点数据 ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok($newMap); } /** * 7501 进入据点 * @return Resp */ public static function EnterFootHold() { $targetMapId = req()->paras[0]; # 提取参数 $newMap = ctx()->newMap(); # 检查目标地图是否已经解锁 my_Assert(isset($newMap->unlockedFootholds->$targetMapId), ErrCode::map_NotUnlocked); $newMap->curMapId = $targetMapId; ctx()->newMap = $newMap; UserProc::updateUserInfo(); return Resp::ok(); } /** * 7502 开启传送阵 * @return Resp */ public static function FixUpTransmision() { } /** * 7503 更新探索进度 * @return Resp */ public static function UpdateExplorationProgress() { } }