MapCfg = {} MapCfg.MapInfo = require("Envir/QuestDiary/game_config/cfg_mapinfo.lua") local function MapCfg_for() local tbl = {} for k, v in pairs(MapCfg.MapInfo or {}) do tbl[tostring(v.zdymapid)] = v end return tbl end MapCfg.Info = MapCfg_for() MapCfg.dalumap = Func.require("cfg_大陆地图信息") ----* 通用地图传送 function MapCfg.gotomap(player, ...) if not isnotnull(player) then return end local data = { ... } if table.nums(data) == 0 then return end local function gotomap() if table.nums(data) > 1 then mapmove(player, data[1], data[2], data[3], data[4] and data[4] or nil) else map(player, data[1]) end end if not isplayer(player) then gotomap() return end if getgmlevel(player) >= 10 then gotomap() return end local cfg = MapCfg.dalumap[data[1]] if not cfg then return end ---* 检测开荒大陆 -- GM权限无效 local dalu_level = Player.getint(player, VarCfg.Player.int["大陆开荒"]) if dalu_level < cfg.level then Func.sendmsg(player, "禁止跨大陆野外传送!") return end if cfg.timer_close then local SeverMin = Sys.getint(VarCfg.Global.int.SeverMin) or 0 if SeverMin >= cfg.timer_close then Func.sendmsg9(actor, string.format("开区%d分钟后已关闭!", SeverMin)) end end if cfg.gongchen then if castleinfo(5) then Func.sendmsg9(player, "攻沙期间禁止下图!") return end end if cfg.zhandou then if Func.getzhandou(player) then Func.sendmsg9(player, "战斗状态禁止传送") return end end gotomap() end ---* 玩家进入地图触发 function entermap(actor,mapId,x,y,mapId2) GameEvent.push(EventCfg.goEnterMap,actor,mapId,x,y,mapId2) end ---* 玩家离开地图触发 function leavemap(actor,mapId,x,y,mapId2) GameEvent.push(EventCfg.goLeaveMap,actor,mapId,x,y,mapId2) end ---* 进入连接点出发 function beforeroute(actor, mapId, x, y) local info = {} info.bool = true GameEvent.push(EventCfg.onbeforeroute, actor, mapId, x, y,info) return info.bool end ---* 离开镜像地图后触发删除镜像地图 local function MapCfg_LeaveMap(actor, mapId, x, y, mapId2) -- local self_name = getbaseinfo(actor, ConstCfg.gbase.name) -- if string.find(mapId, self_name, 0, true) ~= nil then -- if checkmirrormap(mapId) then -- local mapInfo_x = getmapinfo(mapId, 0) -- local mapInfo_y = getmapinfo(mapId, 1) -- local npcObj = getobjectinmap(mapId, mapInfo_x / 2, mapInfo_y / 2, math.max(mapInfo_x, mapInfo_y), 4) -- for i, v in ipairs(npcObj or {}) do -- local npcName = Player.getname(v) -- delnpc(npcName, mapId) -- end -- delmirrormap(mapId) -- end -- end end GameEvent.add(EventCfg.goLeaveMap, MapCfg_LeaveMap, MapCfg) local function _onkillmon(actor, mon, itype, kill, monName, mapID) if monName == "暗之赤月恶魔" and mapID == "赤月魔穴" then local npcInfo = { ["idx"] = 39, -- 自定义NPC的Idx,NPC点击触发时,触发参数会传回Idx值 ["npcname"] = "赤月祭坛", -- NPC名称 ["appr"] = 98, -- NPC外形效果 ["script"] = '赤月祭坛', -- NPC相关脚本名称,表示Envir/Market_def/NewNPC.txt ["limit"] = 65535, -- 生命周期 (秒) ["dir"] = 0, --npc朝向(0-7) } createnpc("赤月魔穴", 23, 18, tbl2json(npcInfo)) end end GameEvent.add(EventCfg.onKillMon, _onkillmon, MapCfg) return MapCfg