12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- CustomTransmit = {}
- function CustomTransmit.GetPointFromMapMove(mapId)
- --处理自定义坐标
- local mapMoveCfg = ConfigDataManager.getTableFirst("cfg_mapmove", "mapid", mapId)
- if mapMoveCfg == nil then
- return nil
- end
- local mapX = mapMoveCfg["mapx"]
- local mapY = mapMoveCfg["mapy"]
- if not string.isNullOrEmpty(mapX) and not string.isNullOrEmpty(mapY) then
- return tonumber(mapX), tonumber(mapY)
- end
- local poz = mapMoveCfg["poz"]
- local pointMap = string.toIntIntMap(poz, "#","|")
- if table.isNullOrEmpty(pointMap) then
- return nil
- end
- local num = math.random(0, table.count(pointMap) - 1)
- local index = 0
- for x, y in pairs(pointMap) do
- if num == index then
- return x, y
- end
- index = index + 1
- end
- return nil
- end
- function CustomTransmit.CustomToTransmit(actor, targetMap, targetLine, currX, currY, x, y, fromMapMove)
- local checkResult = CustomTransmit.checkTransmit(actor, targetMap, targetLine, currX, currY, x, y)
- if checkResult ~= nil then
- return checkResult
- end
- --如果坐标来自mapMove表,则再次自定义计算坐标点
- if fromMapMove then
- local x, y = CustomTransmit.GetPointFromMapMove(targetMap)
- if x == nil or y == nil then
- return nil
- end
- local result = {
- result= false,
- x= x,
- y= y
- }
- jprint("自定义传送新坐标", targetMap, result)
- return result
- end
- end
- function CustomTransmit.checkTransmit(actor, targetMap, targetLine, currX, currY, x, y)
- local mapId = getbaseinfo(actor, "unimapid")
- local dupInfo = getduplicate(mapId)
- if dupInfo then
- local dupType = dupInfo['type']
- if dupType == DuplicateType.WAR_ALLIANCE then
- return WarAlliance.CheckTransfer(actor, currX, currY, x, y)
- end
- end
- --检查能不能进入特权地图
- local inGoldMap = TripleIncome.CheckInGoldMap(actor, targetMap)
- if inGoldMap ~= nil then
- return inGoldMap
- end
- -- 内置传送校验跨服地图条件
- local targetMapConfig = ConfigDataManager.getById("cfg_map_info", targetMap)
- if table.isEmpty(targetMapConfig) then
- return nil
- end
- if targetMapConfig.serverType == CrossMap.CROSS_MAP_TYPE then
- return CrossMap.canEnter(actor, targetMap)
- end
- end
|