-- ?????????? ??????? ????? ?????? S01_MAP = nil S01_ScriptPortals = { -- Wall of Memory -> Tario (near s01 link 618,216, outside MV vortex 616,239) {x = 840, z = 140, r = 10, map = 3424073512, tx = 640, ty = 22980, tz = 200, minlevel = 10}, {x = 859, z = 145, r = 10, map = 3424073512, tx = 640, ty = 22980, tz = 200, minlevel = 10}, } S01_PortalCD = {} S01_TimerRunning = {} function s01_TryTeleportRole(MapID, InstanceID, RoleID) if S01_MAP ~= nil and MapID ~= S01_MAP then return end local now = os.time() if S01_PortalCD[RoleID] ~= nil and (now - S01_PortalCD[RoleID]) < 3 then return end local x, y, z = unit.GetPosition(MapID, InstanceID, RoleID) if x == nil or z == nil then return end local i = 1 while S01_ScriptPortals[i] ~= nil do local p = S01_ScriptPortals[i] if math.abs(x - p.x) <= p.r and math.abs(z - p.z) <= p.r then if p.minlevel ~= nil then local lv = role.GetRoleLevel(MapID, InstanceID, RoleID) if lv < p.minlevel then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 400001) msg.DispatchRoleMsgEvent(RoleID, MsgID) return end end S01_PortalCD[RoleID] = now role.RoleGotoNewMap(MapID, InstanceID, RoleID, p.map, p.tx, p.ty, p.tz) return end i = i + 1 end end function s01_CheckAllPortals(MapID, InstanceID) local RoleTbl = map.GetMapAllRoleID(MapID, InstanceID) if RoleTbl == nil then return end for _, RoleID in pairs(RoleTbl) do if RoleID ~= nil and RoleID ~= 4294967295 then s01_TryTeleportRole(MapID, InstanceID, RoleID) end end end function s01_StartPortalTimer(MapID, InstanceID) local key = tostring(InstanceID) if S01_TimerRunning[key] then return end S01_MAP = MapID S01_TimerRunning[key] = true map.MapCreateColCreature(MapID, InstanceID, 5600085, 1, 1, 1, 1) end function s01_OnEnterTrigger(MapID, InstanceID, RoleID, ObjID) if ObjID == 1038 then local RoleLevel = role.GetRoleLevel(MapID, InstanceID, RoleID) if RoleLevel >= 10 then role.RoleGotoNewMap(MapID, InstanceID, RoleID, 3424073512, 640, 22980, 200) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 400001) msg.DispatchRoleMsgEvent(RoleID, MsgID) end else s01_TryTeleportRole(MapID, InstanceID, RoleID) end end aux.RegisterMapEvent("s01", 6, "s01_OnEnterTrigger") aux.RegisterMapEvent("s01", 7, "s01_OnEnterTrigger") function s01_PlayerEnter(MapID, InstanceID, RoleID) S01_MAP = MapID S01_PortalCD[RoleID] = os.time() s01_StartPortalTimer(MapID, InstanceID) end aux.RegisterMapEvent("s01", 2, "s01_PlayerEnter") function s01_OnInit(MapID, InstanceID, CreatureID, CreatureTypeID) S01_MAP = MapID s01_StartPortalTimer(MapID, InstanceID) end aux.RegisterMapEvent("s01", 0, "s01_OnInit") --????? ?????? function s01_RoleDie(MapID, InstanceID, RoleID, KillerID) if unit.IsPlayer(RoleID) and unit.IsPlayer(KillerID) then role.SetTrialCompleteNum(KillerID, 2016, role.GetTrialCompleteNum(KillerID,2016) + 1) if role.GetTrialState(KillerID, 2016) == 1 and role.GetTrialCompleteNum(KillerID,2016) >= Trail_maxnum[2016] then role.TrialComplete(KillerID,2016) end end end --aux.RegisterMapEvent("s01", 5, "s01_RoleDie") --aux.RegisterMapEvent("s02", 5, "s01_RoleDie") --aux.RegisterMapEvent("s03", 5, "s01_RoleDie") --aux.RegisterMapEvent("s04", 5, "s01_RoleDie") --aux.RegisterMapEvent("s05", 5, "s01_RoleDie") --aux.RegisterMapEvent("s06", 5, "s01_RoleDie") --aux.RegisterMapEvent("s07", 5, "s01_RoleDie") --aux.RegisterMapEvent("s08", 5, "s01_RoleDie") --aux.RegisterMapEvent("s09", 5, "s01_RoleDie") --aux.RegisterMapEvent("s11", 5, "s01_RoleDie")