local Arena_frontir = {} Arena_frontir[1] = {965742749, 183, 34, 75, 215} Arena_frontir[2] = {965743517, 403, 223, 400, 603} Arena_frontir[3] = {965743261, 399, 607, 403, 230} Arena_frontir[4] = {965744029, 399, 591, 401, 232} function Frontir_OnRoleLeaveArea(MapID, InstanceID, RoleID, ObjAreaID) local a = map.GetMapScriptData(MapID,InstanceID,1,1) local b = map.GetMapScriptData(MapID,InstanceID,1,2) local x1,y1,z1 = unit.GetPosition(MapID, InstanceID, a) local x2,y2,z2 = unit.GetPosition(MapID, InstanceID, b) if a == RoleID then role.RoleGotoNewMap(MapID, InstanceID, a, MapID, x2, y2/50, z2) else role.RoleGotoNewMap(MapID, InstanceID, b, MapID, x1, y1/50, z1) end end aux.RegisterMapEvent("e01", 23, "Frontir_OnRoleLeaveArea") aux.RegisterMapEvent("e02", 23, "Frontir_OnRoleLeaveArea") aux.RegisterMapEvent("e03", 23, "Frontir_OnRoleLeaveArea") aux.RegisterMapEvent("e04", 23, "Frontir_OnRoleLeaveArea") function c9010427_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) local rolelevel = role.GetRoleLevel(MapID, InstanceID, RoleID) local MsgID = msg.BeginMsgEvent() if rolelevel < 100 then if TalkIndex == -1 then msg.AddMsgEvent(MsgID, 20, 950909) --Испытай свою доблесть в боях на арене. Как только противник будет подобран, вы автоматически перенесетесь на одну из четырех арен. За победу над более сильным противником, вы получите еще больше очков славы. msg.AddMsgEvent(MsgID, 9, 120) msg.AddMsgEvent(MsgID, 9, 120) msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 100002) -- OK msg.DispatchRoleMsgEvent(RoleID, MsgID) end end if rolelevel > 119 then local DayNumber = tonumber(os.date("%w")) if TalkIndex == -1 then msg.AddMsgEvent(MsgID, 20, 950533) --Испытай свою доблесть в боях на арене. Как только противник будет подобран, вы автоматически перенесетесь на одну из четырех арен. За победу над более сильным противником, вы получите еще больше очков славы. msg.AddMsgEvent(MsgID, 24, TargetID) --npcid if act.GetActIsStart(1185) == true or act.GetActIsStart(1191) == true then msg.AddMsgEvent(MsgID, 21, 4) msg.AddMsgEvent(MsgID, 1, 950534) -- Принять участие end msg.AddMsgEvent(MsgID, 21, 5) msg.AddMsgEvent(MsgID, 1, 950653) --ТОП-Арены msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 950654) --Мой рейтинг if (act.GetActIsStart(1185) ~= true and act.GetActIsStart(1191) ~= true) and (DayNumber >= 1 and DayNumber <= 5) then msg.AddMsgEvent(MsgID, 21, 7) msg.AddMsgEvent(MsgID, 1, 950758) --Получить награду end msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 100002) -- OK msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 4 then if lastenemy == act.GetActScriptData(1185, 1, 1) and lastenemy > 0 then msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950625) msg.DispatchRoleMsgEvent(RoleID, MsgID) return 0 end if act.GetActIsStart(1185) == true or act.GetActIsStart(1191) == true then local a = act.GetActScriptData(1185, 1, 0) if a == nil then a = 0 end if a == 0 then local b = act.GetActScriptData(1185, 1, 1) if b == nil or b==0 then act.SetActScriptData(1185, 1, 1, RoleID) act.SetActScriptData(1185, 1, 0, 1) msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950535) msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif a == 1 then if (role.IsRoleOnLine(MapID, InstanceID, act.GetActScriptData(1185, 1, 1)) == 1) then if act.GetActScriptData(1185, 1, 1) ~= RoleID then local c = act.GetActScriptData(1185, 1, 2) ----if Check_ArenaIP(act.GetActScriptData(1185, 1, 1)) == Check_ArenaIP(RoleID) then if c == nil or c==0 then act.SetActScriptData(1185, 1, 2, RoleID) msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950535) msg.DispatchRoleMsgEvent(RoleID, MsgID) end local d = math.random(1,4) local e = act.GetActScriptData(1185, 1, 1) if lastenemy ~= act.GetActScriptData(1185, 1, 1) then map.CreateInstance(Arena_frontir[d][1], e) for i = 1,2 do if i == 1 then role.RoleGotoNewMap(MapID, InstanceID, act.GetActScriptData(1185, 1, i), Arena_frontir[d][1], Arena_frontir[d][2], 0, Arena_frontir[d][3]) else role.RoleGotoNewMap(MapID, InstanceID, act.GetActScriptData(1185, 1, i), Arena_frontir[d][1], Arena_frontir[d][4], 0, Arena_frontir[d][5]) end end end if lastenemy ~= act.GetActScriptData(1185, 1, 1) then role.SetRoleScriptData(act.GetActScriptData(1185, 1, 1), 1, RoleDataType["ArenaTime"],600) act.SetActScriptData(1185, 1, 3, act.GetActScriptData(1185, 1, 1)) act.SetActScriptData(1185, 1, 4, act.GetActScriptData(1185, 1, 2)) act.SetActScriptData(1185, 1, 0, 0) act.SetActScriptData(1185, 1, 1, 0) act.SetActScriptData(1185, 1, 2, 0) end else msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950625) msg.DispatchRoleMsgEvent(RoleID, MsgID) end --[[else msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950625) msg.DispatchRoleMsgEvent(RoleID, MsgID) end--]] else act.SetActScriptData(1185, 1, 1, RoleID) act.SetActScriptData(1185, 1, 0, 1) msg.AddMsgEvent(MsgID, 13, 0) msg.AddMsgEvent(MsgID, 1, 950535) msg.DispatchRoleMsgEvent(RoleID, MsgID) end end end elseif TalkIndex == 5 then local rating_count, RoleID_rating, RoleID_point, _,_,_,_ = arena_frontire_reiting_sql(RoleID,0,0,0,0) msg.AddMsgEvent(MsgID, 20, 950656) -- <p1> - <p2>\n<p3> - <p4>\n<p5> - <p6>\n<p7> - <p8>\n<p9> - <p10>\n<p11> - <p12>\n<p13> - <p14>\n<p15> - <p16>\n<p17> - <p18>\n<p19> - <p20> msg.AddMsgEvent(MsgID, 24, TargetID) --npcid for k=1,tonumber(rating_count) do msg.AddMsgEvent(MsgID, 2, tonumber(RoleID_rating[k])) msg.AddMsgEvent(MsgID, 9, tonumber(RoleID_point[k])) end msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 100001) -- OK msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 6 then local _, _, _, my_rating_point,my_rating_victory,my_rating_defeat,_ = arena_frontire_reiting_sql(RoleID,0,0,0,0) msg.AddMsgEvent(MsgID, 20, 950655) -- Побед: <color=0xffffff00><p1><color=0xffffffff>, Поражений: <color=0xffffff00><p2><color=0xffffffff>\nРейтинг: <color=0xffffff00><p3><color=0xffffffff> msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 9, my_rating_victory) msg.AddMsgEvent(MsgID, 9, my_rating_defeat) msg.AddMsgEvent(MsgID, 9, my_rating_point) msg.AddMsgEvent(MsgID, 21, -1) -- msg.AddMsgEvent(MsgID, 1, 100001) -- OK msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 7 then if (act.GetActIsStart(1185) ~= true and act.GetActIsStart(1191) ~= true) and (DayNumber >= 1 and DayNumber <= 5) then local Rank = 0 local index = 0 local rating_count, RoleID_rating, _, _,_,_,gift_flag = arena_frontire_reiting_sql(RoleID,0,0,0,0) if tonumber(rating_count) == 0 then Rank = 0 elseif tonumber(rating_count) >0 then for d=1,tonumber(rating_count) do if tonumber(RoleID_rating[d]) == RoleID then Rank = d break else Rank = 0 end end end if Rank==0 then msg.AddMsgEvent(MsgID, 20, 950165) -- Вы не вошли в десятку лучших, ничего не получите. msg.AddMsgEvent(MsgID, 24, TargetID) --npcid else if tonumber(gift_flag) == 1 then msg.AddMsgEvent(MsgID, 20, 930427) -- Вы уже получили свою награду. msg.AddMsgEvent(MsgID, 24, TargetID) --npcid else if role.GetBagFreeSize(RoleID) < 2 then msg.AddMsgEvent(MsgID, 20, 950167) -- Освободите свой рюкзак. У вас не хватает места для награды. msg.AddMsgEvent(MsgID, 24, TargetID) --npcid else if Rank == 1 then role.AddRoleItem(MapID, InstanceID, RoleID, 6600799, 25, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 6601145, 1, -1, 8, 420) arena_frontire_reiting_sql(RoleID,0,0,0,2) elseif Rank == 2 then role.AddRoleItem(MapID, InstanceID, RoleID, 6600799, 15, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 6601146, 1, -1, 8, 420) arena_frontire_reiting_sql(RoleID,0,0,0,2) elseif Rank == 3 then role.AddRoleItem(MapID, InstanceID, RoleID, 6600799, 15, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 6601147, 1, -1, 8, 420) arena_frontire_reiting_sql(RoleID,0,0,0,2) elseif Rank >= 4 and Rank <= 10 then role.AddRoleItem(MapID, InstanceID, RoleID, 6600799, 5, -1, 8, 420) arena_frontire_reiting_sql(RoleID,0,0,0,2) end end end end msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 100001) -- ОК msg.DispatchRoleMsgEvent(RoleID, MsgID) end end end end aux.RegisterCreatureEvent(9010427, 7, "c9010427_OnTalk")