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_大陆地图信息") MapCfg.daluCheck = { [2] = { mapid = "神龙帝国", npcid = 29 }, } function MapCfg.checkdalu(player, level, silent) level = tonumber(level) or 1 if level <= 1 then return true end local checkInfo = MapCfg.daluCheck[level] if not checkInfo then if not silent then Func.sendmsg(player, "大陆进入条件未配置!") end return false end if not NPCGotoMapOBJ or not NPCGotoMapOBJ.checkCfg then if not silent then Func.sendmsg(player, "大陆进入条件未加载!") end return false end local data = nil if checkInfo.mapid and NPCGotoMapOBJ.getMapCfg then data = NPCGotoMapOBJ:getMapCfg(checkInfo.mapid) end local cfg = data and data.cfg if not cfg and checkInfo.npcid and NPCGotoMapOBJ.npcid and NPCGotoMapOBJ.npcid[checkInfo.npcid] then cfg = NPCGotoMapOBJ.npcid[checkInfo.npcid][1] end if not cfg then if not silent then Func.sendmsg(player, "大陆进入条件未配置!") end return false end return NPCGotoMapOBJ:checkCfg(player, cfg, false, silent) end ----* 通用地图传送 function MapCfg.checkgotomap(player, mapid, silent) if not isnotnull(player) then return false end if not isplayer(player) then return true end if getgmlevel(player) >= 10 then return true end local cfg = MapCfg.dalumap[mapid] if not cfg then return false end if not MapCfg.checkdalu(player, cfg.level, silent) then return false end if cfg.timer_close then local SeverMin = Sys.getint(VarCfg.Global.int.SeverMin) or 0 if SeverMin >= cfg.timer_close then if not silent then Func.sendmsg9(player, string.format("开区%d分钟后已关闭!", SeverMin)) end return false end end if cfg.gongchen then if castleinfo(5) then if not silent then Func.sendmsg9(player, "攻沙期间禁止下图!") end return false end end if cfg.zhandou then if Func.getzhandou(player) then if not silent then Func.sendmsg9(player, "战斗状态禁止传送") end return false end end return true end ----* 通用地图传送 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 MapCfg.checkgotomap(player, data[1]) then return 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