GoldLine = {} function GoldLine.GetGoldMapInfo(actor, mapCfgId) local mapLineConfig = ConfigDataManager.getTableValue("cfg_map_line", "mapline", "id", mapCfgId) if string.isNullOrEmpty(mapLineConfig) then return end local lineMap = string.toStringStringMap(mapLineConfig, "#", "|") local result = {} for _, line in pairs(lineMap) do local playerCount = getmapplayercount(actor, mapCfgId, line) local mapItem = { mapCfgId = mapCfgId, line = line, playerCount = playerCount } table.insert(result, mapItem) end sendluamsg(actor, LuaMessageIdToClient.RES_MAP_INFO, result) end -- 扩展现有的 GoldLine 模块 2025.08.23 拓展地图线路 function GoldLine.GetLinePolicy(actor, mapCfgId, line) -- 通过地图ID获取线路策略映射 local mapLineConfig = ConfigDataManager.getTableValue("cfg_map_line", "line_policy_id", "id", mapCfgId) if string.isNullOrEmpty(mapLineConfig) then return nil end -- 解析线路策略映射,找到对应线路的策略ID local policyId = GoldLine.getPolicyIdByLine(mapLineConfig, line) if not policyId then return nil end -- 返回对应的策略配置 local policy = ConfigDataManager.getTableValue("cfg_line_policy", "id", policyId) return policy end -- 新增:根据线路策略映射和线路ID获取策略ID 2025.08.23 拓展地图线路 function GoldLine.getPolicyIdByLine(linePolicyStr, targetLine) if string.isNullOrEmpty(linePolicyStr) then return nil end -- 分割多个映射关系 "1#1|2#1|3#1" local mappings = string.split(linePolicyStr, "|") for _, mapping in pairs(mappings) do -- 分割单个映射 "1#1" local parts = string.split(mapping, "#") if #parts == 2 then local lineId = tonumber(parts[1]) local policyId = tonumber(parts[2]) if lineId == tonumber(targetLine) then return policyId end end end return nil end function GoldLine.checkEnterCondition(actor, condition) if condition == "NONE" then return true elseif condition == "TRADE_CARD" then -- 检查是否有交易卡 local tradeCardId = 70700001 return Bag.checkItem(actor, tradeCardId, 1) elseif condition == "ENJOY_PACKAGE" then -- 检查是否有畅玩礼包 local enjoyPackageId = 70700002 return Bag.checkItem(actor, enjoyPackageId, 1) end return false end function GoldLine.canEnterLine(actor, mapCfgId, targetLine) local policy = GoldLine.GetLinePolicy(actor, mapCfgId, targetLine) if not policy then return false, "线路不存在或地图不支持该线路" end -- 检查进入条件 if not GoldLine.checkEnterCondition(actor, policy.enterCondition) then return false, "不满足进入条件" end return true, "可以进入" end