Quest Dojang
Salutari,toate quest-urile de dojang gasite pe net ori nu is complete ori nefunctionale..are cineva un quest de dojang pvp complet cu tab-uri de preferat daca se poate si functional?..Ms.
Cod: Selectaţi tot
quest pvp_manager begin
state start begin
when 20011.chat."Turneul PVP" with pc.get_map_index() != 90 begin
say_title("Turneul PVP")
say("")
if game.get_event_flag("budokan_open") == 2 then
if pc.count_item(72725) > 0 then
say("Ai un Elixir in Inventar, Bagal in depozit!")
elseif pc.count_item(72724) > 0 then
say("Ai un Elixir in Inventar, Bagal in depozit!")
elseif pc.count_item(72723) > 0 then
say("Ai un Elixir in Inventar, Bagal in depozit!")
else
say("Salut, aceasta este arena PVP!")
say("")
say("Se vor organiza evente PVP pe nivele(Nivel 65-80,")
say("80-94 Sau 95+) Pe rand.")
say("Playeri in lupta.")
say("Si trebuie sa castigi gloria!")
say("")
local s = select("Vreau sa intru!","Nu multumesc")
if s == 1 then
if party.is_party() then
say("Intrarea cu un GRUP este interzisa!.")
return
end
pc.warp(844800,0)
end
end
else
say("Arena PVP este deschisa!!")
say("")
say("Cu categorile de level (Nivel 65-80,")
say("80-94 sau 95) Pe rand")
say("Playieri in lupta.")
say("Si trebuie sa castigi gloria!")
say("")
say("Acum este deschisa,")
say(" Va puteti inscrie la NPC")
say("La NPC din Arena PVP!.")
say("")
end
end
when login with pc.get_map_index() == 90 and (pvp_attenders == nil or pvp_attenders[pvp_manager.get_my_attender_id()] == nil or (pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2)) begin
if pvp_attenders == nil then
pvp_manager.guard_check_position()
timer("pvp_guard_1", 20)
return
end
if pvp_attenders[pvp_manager.get_my_attender_id()] == nil then
pvp_manager.guard_check_position()
timer("pvp_guard_1", 20)
return
end
if pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2 then
pvp_manager.guard_check_position()
timer("pvp_guard_1", 20)
end
end
when pvp_guard_1.timer begin
if pc.get_map_index() != 90 then
return
end
pvp_manager.guard_check_position()
timer("pvp_guard_2", 20)
end
when pvp_guard_2.timer begin
if pc.get_map_index() != 90 then
return
end
pvp_manager.guard_check_position()
timer("pvp_guard_1", 20)
end
function guard_check_position()
if pc.get_local_x() >= 84 and pc.get_local_y() >= 84 and pc.get_local_x() <= 116 and pc.get_local_y() <= 116 then --arena 1
pvp_manager.guard_reset()
end
if pc.get_local_x() >= 84 and pc.get_local_y() >= 136 and pc.get_local_x() <= 116 and pc.get_local_y() <= 168 then --arena 2
pvp_manager.guard_reset()
end
if pc.get_local_x() >= 136 and pc.get_local_y() >= 84 and pc.get_local_x() <= 168 and pc.get_local_y() <= 116 then --arena 3
pvp_manager.guard_reset()
end
if pc.get_local_x() >= 136 and pc.get_local_y() >= 136 and pc.get_local_x() <= 168 and pc.get_local_y() <= 168 then --arena 4
pvp_manager.guard_reset()
end
end
function guard_reset()
notice_in_map("AUTOPVP-GUARDIA: "..pc.getname().." Intra in arena.")
pc.warp_local(pc.get_map_index(), 126*100, 24*100)
end
when 20088.chat."GM: Inchide intrarea Arena" with pc.is_gm() and pc.get_map_index() == 90 begin
say_title("Budokan:")
say("Intrarea in mapa de arena Inchisa")
say("")
game.set_event_flag("budokan_open", 0)
end
when 20088.chat."GM: Inchide Arena PVP" with pc.is_gm() and pc.get_map_index() == 90 begin
say_title("Budokan:")
say("Mapa PVP se va inchide")
say("Va da afara toti jucatori!.")
say("")
warp_all_to_village( pc.get_map_index() , 1 )
end
when 20088.chat."Vreau sa ies" with pc.get_map_index() == 90 begin
say_title("Maestrul Batalilor")
say("")
say("Salut, tu vrei sa parasesti arena?")
say("Te temi de inamici?")
say("")
local s = select("Da", "Nu")
if s == 1 then
warp_to_village()
end
end
when 20088.chat."GM: Inchide Arena PVP" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") != 0 begin
say_title("Inchide Arena")
say("Vrei sa inchizi arena PVP?")
say("")
local s = select("Da", "No")
if s == 1 then
game.set_event_flag("pvp", 0)
game.set_event_flag("budokan_open", 0)
pvp_attenders = nil
notice_all("Arena PVP a fost inchisa!")
say_title("Turneul PVP a fost inchis!")
say("Turneul PVP a fost inchis!.")
say("")
end
end
when 20088.chat."GM: Deschide Turneul PVP" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 0 begin
say_title("Turneu PVP")
say("Salut, vrei sa deschzi turneul PVP?")
say("PvP.")
say("")
say_reward("Nivel minimo (minimo 15):")
local str_min_level = input()
say_title("Iniciar Torneo PvP")
local min_level = tonumber(str_min_level)
if min_level == nil then
say("Nu ai introdus un numar")
say("")
return
end
if tonumber(str_min_level) < 15 then
min_level = 15
end
say("Nivelul minim este "..tostring(min_level)..".")
say("Te rog adauga numarul Maxim:")
local str_max_level = input()
say_title("Deschide Turneul PVP")
local max_level = tonumber(str_max_level)
if max_level == nil then
say("Nu ai introdus un numar.")
say("")
return
end
if tonumber(str_max_level) < min_level then
say("Adauga nivelul maxim")
say("Nivelul maxim este.")
say("")
return
end
game.set_event_flag("pvp_minlevel", min_level)
game.set_event_flag("pvp_maxlevel", max_level)
say("El nivel minimo es "..tostring(min_level)..".")
say("El nivel máximo es "..tostring(max_level)..".")
say("")
local s = select("Deschide Arena", "Inchide")
if s == 2 then
return
end
say_title("Deschide Turneul PVP")
say("Turneul PVP a fost deschis.")
say("Acum jucatori se pot inscrie")
say("Se inscrie aici.")
say("Trebuie sa aiba nivel apropriat!..")
say("")
say_reward("Nivelul minim Actual: "..game.get_event_flag("pvp_minlevel").." - "..game.get_event_flag("pvp_maxlevel"))
game.set_event_flag("pvp", 1)
game.set_event_flag("budokan_open", 2)
attender_count = 0
game.set_event_flag("pvp_tournament", get_global_time())
pvp_attenders = nil
pvp_attenders = { }
arena = {
-- arena 1
{
{ 113, 100 },
{ 88, 100 },
0,
"SLEEPING",
0,
},
-- arena 2
{
{ 113, 152 },
{ 88, 152 },
0,
"SLEEPING",
0,
},
-- arena 3
{
{ 140, 152 },
{ 164, 152 },
0,
"SLEEPING",
0,
},
-- arena 4
{
{ 164, 100 },
{ 140, 100 },
0,
"SLEEPING",
0,
},
}
notice_all("Inscrierile la Turneul PVP sunt deschide! Intrati de la Uriel!")
notice_all("Nivelul Minim si Maxim sunt: "..game.get_event_flag("pvp_minlevel").." - "..game.get_event_flag("pvp_maxlevel"))
end
when 20088.chat."Inscriere Turneu PVP" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 1 begin
say_title(mob_name(20088)..":")
say("")
if game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") then
say("Tu vrei sa te inscri la turneul PVP?.")
say("")
return
end
if pc.get_level() < 15 then
say("Nivelul tau este prea mic.")
say("")
return
end
if pc.get_level() < game.get_event_flag("pvp_minlevel") or pc.get_level() > game.get_event_flag("pvp_maxlevel") then
say("Nivelul tau este prea mare"..game.get_event_flag("pvp_minlevel").." y "..game.get_event_flag("pvp_maxlevel"))
say("")
return
end
----"123456789012345678901234567890123456789012345678901234567890"|
say("Bun venit in arena PVP")
say("Aici se aduna toti Jucatori.")
say("")
say("Cu cele mai mari forte!")
say("Esti sigur ca vrei sa participi?")
say("")
say("E alegerea ta?")
say("")
local s = select("Da, si eu particip.", "Nu, nu particip")
say_title(mob_name(20088)..":")
say("")
if s == 1 then
say("Va trebui sa ramai aici sau ;")
say("Vei fi descalificat.")
say("")
say("Mult noroc!")
say("")
pvp_attenders[attender_count+1] = {name = pc.getname(), level = pc.get_level(), partner = nil, winner = true, fight_mode = 0, arena = 0}
pc.setqf("attender_id", attender_count+1)
pc.setqf("pvp_tournament", game.get_event_flag("pvp_tournament"))
attender_count = attender_count + 1
elseif s == 2 then
say("Pari un mic luptator..")
say("Insa aici lupta doar luptatori mari, altfel poti murii.")
say("")
end
end
when 20088.chat."Inchide Inregistrarile" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 1 begin
say_title("Turneul PvP")
say("In prezent exista "..tostring(attender_count).." playeri inregistrati.")
say("Vrei sa te inregistrezi?")
say("La aceasta batalie?")
say("")
local s = select("Inchide Inregistrarile", "Continua")
if s == 1 then
say_title("Inchide:")
say("Inregistrarile vor fi oprite!.")
say("Salut.")
say("")
game.set_event_flag("pvp", 2)
betting_list = {}
betting_state = {}
end
end
when 20088.chat."Incepe Turneul." with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 2 begin
say_title("Torneo PVP")
say("Faza de Pariuri sa incheiat atat si turneul")
say("Initiere?")
say("")
local s = select("Incepe turneul PVP acum", "Continua cu pariuri")
if s == 1 then
say_title("Sfarsitul pariurilor:")
say("TImpul pariurului sa sfarsit!.")
say("Batalia a inceput deja!.")
say("")
game.set_event_flag("pvp", 3)
pvp_manager.make_duel_list()
duel_list_index = 0
playerless_mode = false
notice_all("Inregistrarea pentru turneul PVP a fost inchisa")
notice_all("Batalia incepe acum!")
pvp_round_num = 1
pvp_manager.refresh_arenas()
end
end
when 20088.chat."Asigurativa Pariul" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 2 and betting_state != nil and betting_state[pc.get_player_id()] == nil begin
say_title("Pariul:")
say("Jucatorul pe care pariati?")
say("")
local player = input()
say_title("Locul pariului:")
say("")
if pvp_manager.get_attender_id_by_name(player) == 0 then
say("Jucatorul nu este inregistrat.")
say("")
return
end
say("Cat vrei sa pariezi?")
say("")
local bet_amount = tonumber(input())
if bet_amount < 1 then
say_title("Error:")
say("Cantitatea nu este valida.")
say("")
return
end
say_title("Confirmare:")
say("Doriti sa pariati "..bet_amount.." yang pe acest")
say(jucator.."?")
say("")
if select("Da", "Nu") == 2 then
return
end
betting_state[pc.get_player_id()] = 1
table.insert(betting_list, {pc.get_name(), bet_amount, player})
say_title("Pariu:")
say("Pariul a fost efectuat!.")
say("Mult noroc!")
say("")
end
when 20088.chat."Cine participa?" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 2 begin
setskin(NOWINDOW)
chat("Urmatoarele persoane participa la Turneul PVP:")
for i = 1, attender_count, 4 do
local chatline = ""
for j = i, 4, 1 do
if pvp_attenders[j] != nil then
chatline = chatline..pvp_attenders[j].name.." "
end
end
syschat(chatline)
end
syschat("Participanti "..attender_count.." Total")
end
when 20088.chat."Cine se va lupta cu mine in urmatoarea lupta?" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") begin
say_title(mob_name(20088)..":")
say("")
if pvp_manager.get_duel_partner() == nil then
say("Nu exista nici un oponent disponibil chiar acum!.")
say("")
say("Daca nu vom gasi nici un adversat potrivit pentru tine, ")
say("Te vom trece direct la urmatoarea etapa.")
say("")
return
end
say("In confirmite cu urmatorul jucator este luptatorul:")
say("")
say_reward(""..pvp_manager.get_duel_partner().."")
say("")
end
function make_duel_list()
duel_list = { }
local i = 0
for ai = 1, attender_count, 1 do
if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
local partner_id = pvp_manager.findpartner(tostring(pvp_attenders[ai].name), pvp_attenders[ai].level)
if partner_id != nil then
pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
i = i + 1
end
end
end
for ai = 1, attender_count, 1 do
if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
local partner_id = pvp_manager.findpartner_for_partnerless(tostring(pvp_attenders[ai].name), pvp_attenders[ai].level)
if partner_id != nil then
pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
i = i + 1
end
end
end
end
function findpartner(name, level)
local closest_level = nil
local partner_id = nil
for ai = 1, attender_count, 1 do
if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tonumber(pvp_attenders[ai].level) <= level + 30 and tonumber(pvp_attenders[ai].level) >= level - 30 and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
if closest_level == nil then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif tonumber(pvp_attenders[ai].level) == tonumber(level) then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif tonumber(level) < tonumber(closest_level) and tonumber(pvp_attenders[ai].level) < tonumber(closest_level) then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif tonumber(level) > tonumber(closest_level) and tonumber(pvp_attenders[ai].level) > tonumber(closest_level) then
closest_level = pvp_attenders[ai].level
partner_id = ai
end
end
end
return tonumber(partner_id)
end
function findpartner_for_partnerless(name, level)
local closest_level = nil
local partner_id = nil
for ai = 1, attender_count, 1 do
if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
if closest_level == nil then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif pvp_attenders[ai].level == level then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif tonumber(level) < tonumber(closest_level) and pvp_attenders[ai].level < closest_level then
closest_level = pvp_attenders[ai].level
partner_id = ai
elseif tonumber(level) > tonumber(closest_level) and pvp_attenders[ai].level > closest_level then
closest_level = pvp_attenders[ai].level
partner_id = ai
end
end
end
return partner_id
end
function is_player_in_map(name)
if pc.getname() == name then
return true
end
local myname = pc.getname()
local target = find_pc_by_name(name)
local t = pc.select(target)
if pc.getname() == myname then
pc.select(t)
return false
end
pc.select(t)
return true
end
when 20088.chat."GM: Actualizeaza Duelele" with pc.is_gm() and game.get_event_flag("pvp") == 3 begin
for aArena = 1, 4, 1 do
arena[aArena][3] = 0
arena[aArena][4] = "SLEEPING"
end
pvp_manager.refresh_arenas()
end
-- not working
--[[
when 20088.chat."GM: Opreste o lupta" with pc.is_gm() and game.get_event_flag("pvp") == 2 begin
say_title("Inchide Event:")
say("Ce arena sa se inchida?")
local s = select("Arena 1", "Arena 2", "Arena 3", "Arena 4", "Cerrar")
if s == 5 then
return
end
local fighter1 = nil
local fighter2 = nil
for ai = 1, attender_count, 1 do
if pvp_attenders[ai].arena == s and pvp_attenders[ai].fight_mode != 0 then
if fighter1 == nil then
fighter1 = ai
else
fighter2 = ai
end
end
end
if fighter1 == nil then
say_title("Inchide Batalia:")
say("Nici o lupta in acest domeniu.")
say("")
return
end
say_title("Opreste o lupta")
say("Cine va trebui sa fie considerat castigator cand arena se va inchide "..s.." ")
say("In urmatoru moment?")
local w = select(tostring(pvp_attenders[fighter1].name), tostring(pvp_attenders[fighter1].name), "Cancel")
if w == 3 then
return
end
if w == 1 then
pvp_attenders[fighter2].winner = false
notice_in_map(tostring(pvp_attenders[fighter1].name).." has won the battle against "..tostring(pvp_attenders[fighter2].name).."!", pc.get_map_index())
pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 126, 234))
pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 126, 24))
else
pvp_attenders[fighter1].winner = false
notice_in_map(tostring(pvp_attenders[fighter2].name).." has won the battle against "..tostring(pvp_attenders[fighter1].name).."!", pc.get_map_index())
pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 126, 24))
pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 126, 234))
end
pvp_attenders[fighter1].fight_mode = 0
pvp_attenders[fighter2].fight_mode = 0
arena[s][3] = 0
pvp_manager.refresh_arenas()
say_title("End fight:")
say("The battle has been ended.")
end
--]]
when 20088.chat."GM: Rasplata Winner" with pc.is_gm() begin
say_title("Recompensa:")
say("Recompensa actuala: "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." (vnum: "..game.get_event_flag("pvp_price_vnum")..")")
say("")
local s = select("Schimba recompensa", "Inchide")
if s == 2 then
return
end
say_title("Schimba recompensa:")
say("Introdu codul recompensei")
say("")
local vnum = input()
say_title("Schimba recomensa:")
say("introdu o cantitate")
say("")
local count = input()
game.set_event_flag("pvp_price_count", count)
game.set_event_flag("pvp_price_vnum", vnum)
say_title("Recompensa:")
say("Recomensa schimbara.")
say("Actuala recomensa: "..count.."x "..item_name(vnum).." (vnum: "..vnum..")")
say("")
end
when 20088.chat."GM: Turneu de Aur runda de aur" with pc.is_gm() begin
say_title("Recompensa runda de aur:")
say("Valoare de baza curenta: "..game.get_event_flag("pvp_round_gold"))
say("")
local s = select("Schimba", "Inchide")
if s == 2 then
return
end
say_title("Numarul castigului:")
say("Va rugam sa introduceti valoare de baza de aur")
say("Pentru castigatorul rundei:")
say("")
local gold = input()
game.set_event_flag("pvp_round_gold", gold)
say_title("Schimba cantitatea:")
say("Cantitatea a fost scimbata.")
say("Actuala recompensa: "..gold)
say("")
end
function refresh_arenas()
for aArena = 1, 4, 1 do
if duel_list[duel_list_index] == nil then
if playerless_mode == true then
pvp_manager.init_next_round()
else
pvp_manager.fight_playerless()
end
return
end
if arena[aArena][3] == 0 then
arena[aArena][3] = 1
pvp_manager.fight_init(duel_list[duel_list_index].fighter_id1, duel_list[duel_list_index].fighter_id2, aArena)
end
end
end
function fight_init(pid1, pid2, arena_id)
duel_list_index = duel_list_index + 1
if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid1].name)) == false then
notice_in_map(tostring(pvp_attenders[pid1].name).." is not online and has been disqualified.", pc.get_map_index())
pvp_attenders[pid1].winner = false
pvp_attenders[pid2].partner = nil
arena[arena_id][3] = 0
pvp_manager.refresh_arenas()
return
end
if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid2].name)) == false then
notice_in_map(tostring(pvp_attenders[pid2].name).." is not online and has been disqualified.", pc.get_map_index())
pvp_attenders[pid2].winner = false
pvp_attenders[pid1].partner = nil
arena[arena_id][3] = 0
pvp_manager.refresh_arenas()
return
end
notice_in_map(tostring(pvp_attenders[pid1].name).." and "..tostring(pvp_attenders[pid2].name).." por favor ingresar a la arena!", pc.get_map_index())
--[[
local f1_accept = ask_fight(tostring(pvp_attenders[pid1].name), tostring(pvp_attenders[pid2].name))
if f1_accept != CONFIRM_OK then
notice_in_map(tostring(pvp_attenders[pid1].name).." no se tomó en la lucha contra el "..tostring(pvp_attenders[pid2].name)..".", pc.get_map_index())
pvp_attenders[pid1] = nil
pvp_attenders[pid2].partner = nil
pvp_manager.refresh_arenas()
return
end
local f2_accept = confirm(find_pc_by_name(tostring(pvp_attenders[pid2].name)), "lucha contra "..tostring(pvp_attenders[pid1].name).. " an?", 15)
if f2_accept != CONFIRM_OK then
notice_in_map(tostring(pvp_attenders[pid2].name).." no se tomó en la lucha contra "..tostring(pvp_attenders[pid1].name)..".", pc.get_map_index())
pvp_attenders[pid2] = nil
pvp_attenders[pid1].partner = nil
pvp_manager.refresh_arenas()
return
end
]]
pvp_attenders[pid1].fight_mode = 1
pvp_attenders[pid2].fight_mode = 1
pvp_attenders[pid1].arena = arena_id
pvp_attenders[pid2].arena = arena_id
pvp_manager.local_pc_warp(tostring(pvp_attenders[pid1].name), arena[arena_id][1][1], arena[arena_id][1][2])
pvp_manager.local_pc_warp(tostring(pvp_attenders[pid2].name), arena[arena_id][2][1], arena[arena_id][2][2])
end
when login with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 1 begin
affect.add(apply.MOV_SPEED, -10000, 2)
affect.add_collect(apply.HP_REGEN, 5000, 30)
affect.add_collect(apply.SP_REGEN, 5000, 30)
pvp_manager.set_fight_mode(2)
if arena[pvp_manager.get_arena()][3] == 2 then
arena[pvp_manager.get_arena()][5] = 60
loop_timer("fight_start_countdown", 1)
else
timer("partner_timeout", 30)
end
arena[pvp_manager.get_arena()][3] = 2
end
when partner_timeout.timer begin
if pvp_manager.is_player_in_map(pvp_manager.get_duel_partner()) == true or game.get_event_flag("pvp") != 2 or pvp_manager.get_fight_mode() != 2 then
return
end
pvp_manager.set_fight_mode(3)
if arena[pvp_manager.get_arena()][3] == 3 then
return
end
arena[pvp_manager.get_arena()][3] = 3
notice_in_map(pc.getname().." Se lupta contra "..pvp_manager.get_duel_partner().." por incomparecencia!", pc.get_map_index())
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
pc.warp_local(pc.get_map_index(), 12600, 23400)
end
when fight_start_countdown.timer begin
if arena[pvp_manager.get_arena()][5] == -1 then
return
end
local partner_vid = find_pc_by_name(pvp_manager.get_duel_partner())
local my_vid = pc.get_vid()
if arena[pvp_manager.get_arena()][5] == 0 then
arena[pvp_manager.get_arena()][5] = -1
pc.select(partner_vid)
command("pvp "..my_vid)
pc.select(my_vid)
command("pvp "..partner_vid)
notice_in_map("La lucha entre "..pvp_manager.get_duel_partner().." y "..pc.get_name().." comienza!", pc.get_map_index())
timer("fight_start_countdown_shutdown", 1)
else
pc.select(partner_vid)
if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
syschat("La batalla inicia en "..tostring(arena[pvp_manager.get_arena()][5]).." seconds.")
end
affect.add(apply.MOV_SPEED, -10000, 2)
pc.select(my_vid)
if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
syschat("The fight starts in "..tostring(arena[pvp_manager.get_arena()][5]).." seconds.")
end
affect.add(apply.MOV_SPEED, -10000, 2)
arena[pvp_manager.get_arena()][5] = arena[pvp_manager.get_arena()][5] - 1
end
end
when fight_start_countdown_shutdown.timer begin
cleartimer("fight_start_countdown")
end
when logout with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 90 and pvp_manager.get_fight_mode() == 2 begin
pvp_manager.set_fight_mode(3)
arena[pvp_manager.get_arena()][3] = 3
notice_in_map(pvp_manager.get_duel_partner().." Se lupta cotra "..pc.getname().."!", pc.get_map_index())
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
pvp_attenders[pvp_manager.get_my_attender_id()].winner = false
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = true
local target = find_pc_by_name(pvp_manager.get_duel_partner())
local t = pc.select(target)
pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
pc.select(t)
pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 126, 24)
end
when kill with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 90 and npc.is_pc() and pvp_manager.get_fight_mode() == 2 begin
pvp_manager.set_fight_mode(3)
if arena[pvp_manager.get_arena()][3] == 3 then
return
end
arena[pvp_manager.get_arena()][3] = 3
notice_in_map(pc.getname().." Se lupta contra "..pvp_manager.get_duel_partner().."!", pc.get_map_index())
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
timer("fight_end", 5)
end
when fight_end.timer begin
pc.warp_local(pc.get_map_index(), 12600, 23400)
pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 126, 24)
end
when letter with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 3 begin
pvp_manager.set_fight_mode(0)
if pvp_attenders[pvp_manager.get_my_attender_id()].winner == true then
arena[pvp_manager.get_arena()][3] = 0
pvp_manager.refresh_arenas()
end
end
function fight_playerless()
for aArena = 1, 4, 1 do
if arena[aArena][3] != 0 then
return
end
end
playerless_mode = true
pvp_manager.make_duel_list()
pvp_manager.refresh_arenas()
end
function init_next_round()
for aArena = 1, 4, 1 do
if arena[aArena][3] != 0 then
return
end
end
playerless_mode = false
local winner_count = 0
local winner_id = 0
for ai = 1, attender_count, 1 do
pvp_attenders[ai].partner = nil
pvp_attenders[ai].fight_mode = 0
if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true then
winner_count = winner_count + 1
winner_id = ai
end
end
if winner_count == 1 then
notice_all(pvp_attenders[winner_id].name.." A castigaat Turneul PVP!")
notice_all(pvp_attenders[winner_id].name.." recibe "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." como recompensa!")
pvp_manager.distribute_bets(pvp_attenders[winner_id].name)
local target = find_pc_by_name(pvp_attenders[winner_id].name)
local t = pc.select(target)
pc.give_item2(game.get_event_flag("pvp_price_vnum"), game.get_event_flag("pvp_price_count"))
pc.select(t)
notice_all("Evenimentul PVP sa terminat.")
game.set_event_flag("pvp", 0)
pvp_attenders = nil
return
end
pvp_manager.make_duel_list()
duel_list_index = 0
if winner_count == 2 then
notice_all("Runda finala a inceput din Turneul PVP!")
elseif winner_count <= 4 then
notice_all("Runda Semi-Finala a inceput din Turneul PVP!")
else
notice_all("Urmatoarea runda a turneului PVP incepe acum!")
end
pvp_round_num = pvp_round_num + 1
pvp_manager.refresh_arenas()
end
function distribute_bets(winner_name)
table.insert(betting_list, {pc.get_name(), bet_amount, player})
local jackpot = 0
local jackpot_winner_only = 0
local winners = 0
for i = 1, table.getn(betting_list), 1 do
if betting_list[i][3] == winner_name then
jackpot_winner_only = jackpot_winner_only + betting_list[i][2]
end
jackpot = jackpot + betting_list[i][2]
winners = winners + 1
end
for i = 1, table.getn(betting_list), 1 do
if betting_list[i][3] == winner_name then
pvp_manager.give_jackpot_gold(betting_list[i][1], math.ceil( (betting_list[i][2] / jackpot_winner_only)*jackpot ))
end
end
end
function give_jackpot_gold(name, amount)
local target = find_pc_by_name(name)
if target == 0 then
return
end
local t = pc.select(target)
pc.change_money(amount)
pc.select(t)
end
function local_pc_warp(name, x, y)
local target = find_pc_by_name(name)
local t = pc.select(target)
pc.warp_local(pc.get_map_index(), x*100, y*100)
pc.select(t)
end
function setqf_by_name(name, flag, value)
local target = find_pc_by_name(name)
local t = pc.select(target)
pc.setqf(flag, value)
pc.select(t)
end
function getqf_by_name(name, flag)
local target = find_pc_by_name(name)
local t = pc.select(target)
local rflag = pc.getqf(flag)
pc.select(t)
return rflag
end
function get_attender_id_by_name(name)
for ai = 1, attender_count, 1 do
if tostring(pvp_attenders[ai].name) == name then
return ai
end
end
return 0
end
function get_my_attender_id()
return pvp_manager.get_attender_id_by_name(pc.get_name())
end
function get_duel_partner()
if pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].partner != nil then
return pvp_attenders[pvp_manager.get_my_attender_id()].partner
else
return nil
end
end
function get_fight_mode()
if pvp_attenders != nil and pvp_manager.get_my_attender_id() != 0 and pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != nil then
return pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode
else
return 0
end
end
function set_fight_mode(fmode)
pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode = fmode
end
function get_arena()
return pvp_attenders[pvp_manager.get_my_attender_id()].arena
end
function set_arena(id)
pvp_attenders[pvp_manager.get_my_attender_id()].arena = id
end
function ask_fight(asker, target)
return confirm(find_pc_by_name(target), "Van a luchar contra "..asker.. "?", 15)
end
end
end- Pentru acest mesaj, Just Noxus for the post:
- cosmaovidiu
Mersi bro,dar cred ca pe asta il am si eu,am facut test cu 2 jucatori,cand ei is in arena si unul castiga..alalalt moare,se reinvie si acolo raman..nimic altceva..mi-l poti da te rog cu tab quest-ul ? sau asa il ai si tu cu space ?Just Noxus scrie:Cod: Selectaţi tot
quest pvp_manager begin state start begin when 20011.chat."Turneul PVP" with pc.get_map_index() != 90 begin say_title("Turneul PVP") say("") if game.get_event_flag("budokan_open") == 2 then if pc.count_item(72725) > 0 then say("Ai un Elixir in Inventar, Bagal in depozit!") elseif pc.count_item(72724) > 0 then say("Ai un Elixir in Inventar, Bagal in depozit!") elseif pc.count_item(72723) > 0 then say("Ai un Elixir in Inventar, Bagal in depozit!") else say("Salut, aceasta este arena PVP!") say("") say("Se vor organiza evente PVP pe nivele(Nivel 65-80,") say("80-94 Sau 95+) Pe rand.") say("Playeri in lupta.") say("Si trebuie sa castigi gloria!") say("") local s = select("Vreau sa intru!","Nu multumesc") if s == 1 then if party.is_party() then say("Intrarea cu un GRUP este interzisa!.") return end pc.warp(844800,0) end end else say("Arena PVP este deschisa!!") say("") say("Cu categorile de level (Nivel 65-80,") say("80-94 sau 95) Pe rand") say("Playieri in lupta.") say("Si trebuie sa castigi gloria!") say("") say("Acum este deschisa,") say(" Va puteti inscrie la NPC") say("La NPC din Arena PVP!.") say("") end end when login with pc.get_map_index() == 90 and (pvp_attenders == nil or pvp_attenders[pvp_manager.get_my_attender_id()] == nil or (pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2)) begin if pvp_attenders == nil then pvp_manager.guard_check_position() timer("pvp_guard_1", 20) return end if pvp_attenders[pvp_manager.get_my_attender_id()] == nil then pvp_manager.guard_check_position() timer("pvp_guard_1", 20) return end if pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2 then pvp_manager.guard_check_position() timer("pvp_guard_1", 20) end end when pvp_guard_1.timer begin if pc.get_map_index() != 90 then return end pvp_manager.guard_check_position() timer("pvp_guard_2", 20) end when pvp_guard_2.timer begin if pc.get_map_index() != 90 then return end pvp_manager.guard_check_position() timer("pvp_guard_1", 20) end function guard_check_position() if pc.get_local_x() >= 84 and pc.get_local_y() >= 84 and pc.get_local_x() <= 116 and pc.get_local_y() <= 116 then --arena 1 pvp_manager.guard_reset() end if pc.get_local_x() >= 84 and pc.get_local_y() >= 136 and pc.get_local_x() <= 116 and pc.get_local_y() <= 168 then --arena 2 pvp_manager.guard_reset() end if pc.get_local_x() >= 136 and pc.get_local_y() >= 84 and pc.get_local_x() <= 168 and pc.get_local_y() <= 116 then --arena 3 pvp_manager.guard_reset() end if pc.get_local_x() >= 136 and pc.get_local_y() >= 136 and pc.get_local_x() <= 168 and pc.get_local_y() <= 168 then --arena 4 pvp_manager.guard_reset() end end function guard_reset() notice_in_map("AUTOPVP-GUARDIA: "..pc.getname().." Intra in arena.") pc.warp_local(pc.get_map_index(), 126*100, 24*100) end when 20088.chat."GM: Inchide intrarea Arena" with pc.is_gm() and pc.get_map_index() == 90 begin say_title("Budokan:") say("Intrarea in mapa de arena Inchisa") say("") game.set_event_flag("budokan_open", 0) end when 20088.chat."GM: Inchide Arena PVP" with pc.is_gm() and pc.get_map_index() == 90 begin say_title("Budokan:") say("Mapa PVP se va inchide") say("Va da afara toti jucatori!.") say("") warp_all_to_village( pc.get_map_index() , 1 ) end when 20088.chat."Vreau sa ies" with pc.get_map_index() == 90 begin say_title("Maestrul Batalilor") say("") say("Salut, tu vrei sa parasesti arena?") say("Te temi de inamici?") say("") local s = select("Da", "Nu") if s == 1 then warp_to_village() end end when 20088.chat."GM: Inchide Arena PVP" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") != 0 begin say_title("Inchide Arena") say("Vrei sa inchizi arena PVP?") say("") local s = select("Da", "No") if s == 1 then game.set_event_flag("pvp", 0) game.set_event_flag("budokan_open", 0) pvp_attenders = nil notice_all("Arena PVP a fost inchisa!") say_title("Turneul PVP a fost inchis!") say("Turneul PVP a fost inchis!.") say("") end end when 20088.chat."GM: Deschide Turneul PVP" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 0 begin say_title("Turneu PVP") say("Salut, vrei sa deschzi turneul PVP?") say("PvP.") say("") say_reward("Nivel minimo (minimo 15):") local str_min_level = input() say_title("Iniciar Torneo PvP") local min_level = tonumber(str_min_level) if min_level == nil then say("Nu ai introdus un numar") say("") return end if tonumber(str_min_level) < 15 then min_level = 15 end say("Nivelul minim este "..tostring(min_level)..".") say("Te rog adauga numarul Maxim:") local str_max_level = input() say_title("Deschide Turneul PVP") local max_level = tonumber(str_max_level) if max_level == nil then say("Nu ai introdus un numar.") say("") return end if tonumber(str_max_level) < min_level then say("Adauga nivelul maxim") say("Nivelul maxim este.") say("") return end game.set_event_flag("pvp_minlevel", min_level) game.set_event_flag("pvp_maxlevel", max_level) say("El nivel minimo es "..tostring(min_level)..".") say("El nivel máximo es "..tostring(max_level)..".") say("") local s = select("Deschide Arena", "Inchide") if s == 2 then return end say_title("Deschide Turneul PVP") say("Turneul PVP a fost deschis.") say("Acum jucatori se pot inscrie") say("Se inscrie aici.") say("Trebuie sa aiba nivel apropriat!..") say("") say_reward("Nivelul minim Actual: "..game.get_event_flag("pvp_minlevel").." - "..game.get_event_flag("pvp_maxlevel")) game.set_event_flag("pvp", 1) game.set_event_flag("budokan_open", 2) attender_count = 0 game.set_event_flag("pvp_tournament", get_global_time()) pvp_attenders = nil pvp_attenders = { } arena = { -- arena 1 { { 113, 100 }, { 88, 100 }, 0, "SLEEPING", 0, }, -- arena 2 { { 113, 152 }, { 88, 152 }, 0, "SLEEPING", 0, }, -- arena 3 { { 140, 152 }, { 164, 152 }, 0, "SLEEPING", 0, }, -- arena 4 { { 164, 100 }, { 140, 100 }, 0, "SLEEPING", 0, }, } notice_all("Inscrierile la Turneul PVP sunt deschide! Intrati de la Uriel!") notice_all("Nivelul Minim si Maxim sunt: "..game.get_event_flag("pvp_minlevel").." - "..game.get_event_flag("pvp_maxlevel")) end when 20088.chat."Inscriere Turneu PVP" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 1 begin say_title(mob_name(20088)..":") say("") if game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") then say("Tu vrei sa te inscri la turneul PVP?.") say("") return end if pc.get_level() < 15 then say("Nivelul tau este prea mic.") say("") return end if pc.get_level() < game.get_event_flag("pvp_minlevel") or pc.get_level() > game.get_event_flag("pvp_maxlevel") then say("Nivelul tau este prea mare"..game.get_event_flag("pvp_minlevel").." y "..game.get_event_flag("pvp_maxlevel")) say("") return end ----"123456789012345678901234567890123456789012345678901234567890"| say("Bun venit in arena PVP") say("Aici se aduna toti Jucatori.") say("") say("Cu cele mai mari forte!") say("Esti sigur ca vrei sa participi?") say("") say("E alegerea ta?") say("") local s = select("Da, si eu particip.", "Nu, nu particip") say_title(mob_name(20088)..":") say("") if s == 1 then say("Va trebui sa ramai aici sau ;") say("Vei fi descalificat.") say("") say("Mult noroc!") say("") pvp_attenders[attender_count+1] = {name = pc.getname(), level = pc.get_level(), partner = nil, winner = true, fight_mode = 0, arena = 0} pc.setqf("attender_id", attender_count+1) pc.setqf("pvp_tournament", game.get_event_flag("pvp_tournament")) attender_count = attender_count + 1 elseif s == 2 then say("Pari un mic luptator..") say("Insa aici lupta doar luptatori mari, altfel poti murii.") say("") end end when 20088.chat."Inchide Inregistrarile" with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 1 begin say_title("Turneul PvP") say("In prezent exista "..tostring(attender_count).." playeri inregistrati.") say("Vrei sa te inregistrezi?") say("La aceasta batalie?") say("") local s = select("Inchide Inregistrarile", "Continua") if s == 1 then say_title("Inchide:") say("Inregistrarile vor fi oprite!.") say("Salut.") say("") game.set_event_flag("pvp", 2) betting_list = {} betting_state = {} end end when 20088.chat."Incepe Turneul." with pc.get_map_index() == 90 and pc.is_gm() and game.get_event_flag("pvp") == 2 begin say_title("Torneo PVP") say("Faza de Pariuri sa incheiat atat si turneul") say("Initiere?") say("") local s = select("Incepe turneul PVP acum", "Continua cu pariuri") if s == 1 then say_title("Sfarsitul pariurilor:") say("TImpul pariurului sa sfarsit!.") say("Batalia a inceput deja!.") say("") game.set_event_flag("pvp", 3) pvp_manager.make_duel_list() duel_list_index = 0 playerless_mode = false notice_all("Inregistrarea pentru turneul PVP a fost inchisa") notice_all("Batalia incepe acum!") pvp_round_num = 1 pvp_manager.refresh_arenas() end end when 20088.chat."Asigurativa Pariul" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 2 and betting_state != nil and betting_state[pc.get_player_id()] == nil begin say_title("Pariul:") say("Jucatorul pe care pariati?") say("") local player = input() say_title("Locul pariului:") say("") if pvp_manager.get_attender_id_by_name(player) == 0 then say("Jucatorul nu este inregistrat.") say("") return end say("Cat vrei sa pariezi?") say("") local bet_amount = tonumber(input()) if bet_amount < 1 then say_title("Error:") say("Cantitatea nu este valida.") say("") return end say_title("Confirmare:") say("Doriti sa pariati "..bet_amount.." yang pe acest") say(jucator.."?") say("") if select("Da", "Nu") == 2 then return end betting_state[pc.get_player_id()] = 1 table.insert(betting_list, {pc.get_name(), bet_amount, player}) say_title("Pariu:") say("Pariul a fost efectuat!.") say("Mult noroc!") say("") end when 20088.chat."Cine participa?" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 2 begin setskin(NOWINDOW) chat("Urmatoarele persoane participa la Turneul PVP:") for i = 1, attender_count, 4 do local chatline = "" for j = i, 4, 1 do if pvp_attenders[j] != nil then chatline = chatline..pvp_attenders[j].name.." " end end syschat(chatline) end syschat("Participanti "..attender_count.." Total") end when 20088.chat."Cine se va lupta cu mine in urmatoarea lupta?" with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") begin say_title(mob_name(20088)..":") say("") if pvp_manager.get_duel_partner() == nil then say("Nu exista nici un oponent disponibil chiar acum!.") say("") say("Daca nu vom gasi nici un adversat potrivit pentru tine, ") say("Te vom trece direct la urmatoarea etapa.") say("") return end say("In confirmite cu urmatorul jucator este luptatorul:") say("") say_reward(""..pvp_manager.get_duel_partner().."") say("") end function make_duel_list() duel_list = { } local i = 0 for ai = 1, attender_count, 1 do if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then local partner_id = pvp_manager.findpartner(tostring(pvp_attenders[ai].name), pvp_attenders[ai].level) if partner_id != nil then pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name) pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name) duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id} i = i + 1 end end end for ai = 1, attender_count, 1 do if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then local partner_id = pvp_manager.findpartner_for_partnerless(tostring(pvp_attenders[ai].name), pvp_attenders[ai].level) if partner_id != nil then pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name) pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name) duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id} i = i + 1 end end end end function findpartner(name, level) local closest_level = nil local partner_id = nil for ai = 1, attender_count, 1 do if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tonumber(pvp_attenders[ai].level) <= level + 30 and tonumber(pvp_attenders[ai].level) >= level - 30 and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then if closest_level == nil then closest_level = pvp_attenders[ai].level partner_id = ai elseif tonumber(pvp_attenders[ai].level) == tonumber(level) then closest_level = pvp_attenders[ai].level partner_id = ai elseif tonumber(level) < tonumber(closest_level) and tonumber(pvp_attenders[ai].level) < tonumber(closest_level) then closest_level = pvp_attenders[ai].level partner_id = ai elseif tonumber(level) > tonumber(closest_level) and tonumber(pvp_attenders[ai].level) > tonumber(closest_level) then closest_level = pvp_attenders[ai].level partner_id = ai end end end return tonumber(partner_id) end function findpartner_for_partnerless(name, level) local closest_level = nil local partner_id = nil for ai = 1, attender_count, 1 do if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then if closest_level == nil then closest_level = pvp_attenders[ai].level partner_id = ai elseif pvp_attenders[ai].level == level then closest_level = pvp_attenders[ai].level partner_id = ai elseif tonumber(level) < tonumber(closest_level) and pvp_attenders[ai].level < closest_level then closest_level = pvp_attenders[ai].level partner_id = ai elseif tonumber(level) > tonumber(closest_level) and pvp_attenders[ai].level > closest_level then closest_level = pvp_attenders[ai].level partner_id = ai end end end return partner_id end function is_player_in_map(name) if pc.getname() == name then return true end local myname = pc.getname() local target = find_pc_by_name(name) local t = pc.select(target) if pc.getname() == myname then pc.select(t) return false end pc.select(t) return true end when 20088.chat."GM: Actualizeaza Duelele" with pc.is_gm() and game.get_event_flag("pvp") == 3 begin for aArena = 1, 4, 1 do arena[aArena][3] = 0 arena[aArena][4] = "SLEEPING" end pvp_manager.refresh_arenas() end -- not working --[[ when 20088.chat."GM: Opreste o lupta" with pc.is_gm() and game.get_event_flag("pvp") == 2 begin say_title("Inchide Event:") say("Ce arena sa se inchida?") local s = select("Arena 1", "Arena 2", "Arena 3", "Arena 4", "Cerrar") if s == 5 then return end local fighter1 = nil local fighter2 = nil for ai = 1, attender_count, 1 do if pvp_attenders[ai].arena == s and pvp_attenders[ai].fight_mode != 0 then if fighter1 == nil then fighter1 = ai else fighter2 = ai end end end if fighter1 == nil then say_title("Inchide Batalia:") say("Nici o lupta in acest domeniu.") say("") return end say_title("Opreste o lupta") say("Cine va trebui sa fie considerat castigator cand arena se va inchide "..s.." ") say("In urmatoru moment?") local w = select(tostring(pvp_attenders[fighter1].name), tostring(pvp_attenders[fighter1].name), "Cancel") if w == 3 then return end if w == 1 then pvp_attenders[fighter2].winner = false notice_in_map(tostring(pvp_attenders[fighter1].name).." has won the battle against "..tostring(pvp_attenders[fighter2].name).."!", pc.get_map_index()) pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 126, 234)) pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 126, 24)) else pvp_attenders[fighter1].winner = false notice_in_map(tostring(pvp_attenders[fighter2].name).." has won the battle against "..tostring(pvp_attenders[fighter1].name).."!", pc.get_map_index()) pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 126, 24)) pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 126, 234)) end pvp_attenders[fighter1].fight_mode = 0 pvp_attenders[fighter2].fight_mode = 0 arena[s][3] = 0 pvp_manager.refresh_arenas() say_title("End fight:") say("The battle has been ended.") end --]] when 20088.chat."GM: Rasplata Winner" with pc.is_gm() begin say_title("Recompensa:") say("Recompensa actuala: "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." (vnum: "..game.get_event_flag("pvp_price_vnum")..")") say("") local s = select("Schimba recompensa", "Inchide") if s == 2 then return end say_title("Schimba recompensa:") say("Introdu codul recompensei") say("") local vnum = input() say_title("Schimba recomensa:") say("introdu o cantitate") say("") local count = input() game.set_event_flag("pvp_price_count", count) game.set_event_flag("pvp_price_vnum", vnum) say_title("Recompensa:") say("Recomensa schimbara.") say("Actuala recomensa: "..count.."x "..item_name(vnum).." (vnum: "..vnum..")") say("") end when 20088.chat."GM: Turneu de Aur runda de aur" with pc.is_gm() begin say_title("Recompensa runda de aur:") say("Valoare de baza curenta: "..game.get_event_flag("pvp_round_gold")) say("") local s = select("Schimba", "Inchide") if s == 2 then return end say_title("Numarul castigului:") say("Va rugam sa introduceti valoare de baza de aur") say("Pentru castigatorul rundei:") say("") local gold = input() game.set_event_flag("pvp_round_gold", gold) say_title("Schimba cantitatea:") say("Cantitatea a fost scimbata.") say("Actuala recompensa: "..gold) say("") end function refresh_arenas() for aArena = 1, 4, 1 do if duel_list[duel_list_index] == nil then if playerless_mode == true then pvp_manager.init_next_round() else pvp_manager.fight_playerless() end return end if arena[aArena][3] == 0 then arena[aArena][3] = 1 pvp_manager.fight_init(duel_list[duel_list_index].fighter_id1, duel_list[duel_list_index].fighter_id2, aArena) end end end function fight_init(pid1, pid2, arena_id) duel_list_index = duel_list_index + 1 if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid1].name)) == false then notice_in_map(tostring(pvp_attenders[pid1].name).." is not online and has been disqualified.", pc.get_map_index()) pvp_attenders[pid1].winner = false pvp_attenders[pid2].partner = nil arena[arena_id][3] = 0 pvp_manager.refresh_arenas() return end if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid2].name)) == false then notice_in_map(tostring(pvp_attenders[pid2].name).." is not online and has been disqualified.", pc.get_map_index()) pvp_attenders[pid2].winner = false pvp_attenders[pid1].partner = nil arena[arena_id][3] = 0 pvp_manager.refresh_arenas() return end notice_in_map(tostring(pvp_attenders[pid1].name).." and "..tostring(pvp_attenders[pid2].name).." por favor ingresar a la arena!", pc.get_map_index()) --[[ local f1_accept = ask_fight(tostring(pvp_attenders[pid1].name), tostring(pvp_attenders[pid2].name)) if f1_accept != CONFIRM_OK then notice_in_map(tostring(pvp_attenders[pid1].name).." no se tomó en la lucha contra el "..tostring(pvp_attenders[pid2].name)..".", pc.get_map_index()) pvp_attenders[pid1] = nil pvp_attenders[pid2].partner = nil pvp_manager.refresh_arenas() return end local f2_accept = confirm(find_pc_by_name(tostring(pvp_attenders[pid2].name)), "lucha contra "..tostring(pvp_attenders[pid1].name).. " an?", 15) if f2_accept != CONFIRM_OK then notice_in_map(tostring(pvp_attenders[pid2].name).." no se tomó en la lucha contra "..tostring(pvp_attenders[pid1].name)..".", pc.get_map_index()) pvp_attenders[pid2] = nil pvp_attenders[pid1].partner = nil pvp_manager.refresh_arenas() return end ]] pvp_attenders[pid1].fight_mode = 1 pvp_attenders[pid2].fight_mode = 1 pvp_attenders[pid1].arena = arena_id pvp_attenders[pid2].arena = arena_id pvp_manager.local_pc_warp(tostring(pvp_attenders[pid1].name), arena[arena_id][1][1], arena[arena_id][1][2]) pvp_manager.local_pc_warp(tostring(pvp_attenders[pid2].name), arena[arena_id][2][1], arena[arena_id][2][2]) end when login with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 1 begin affect.add(apply.MOV_SPEED, -10000, 2) affect.add_collect(apply.HP_REGEN, 5000, 30) affect.add_collect(apply.SP_REGEN, 5000, 30) pvp_manager.set_fight_mode(2) if arena[pvp_manager.get_arena()][3] == 2 then arena[pvp_manager.get_arena()][5] = 60 loop_timer("fight_start_countdown", 1) else timer("partner_timeout", 30) end arena[pvp_manager.get_arena()][3] = 2 end when partner_timeout.timer begin if pvp_manager.is_player_in_map(pvp_manager.get_duel_partner()) == true or game.get_event_flag("pvp") != 2 or pvp_manager.get_fight_mode() != 2 then return end pvp_manager.set_fight_mode(3) if arena[pvp_manager.get_arena()][3] == 3 then return end arena[pvp_manager.get_arena()][3] = 3 notice_in_map(pc.getname().." Se lupta contra "..pvp_manager.get_duel_partner().." por incomparecencia!", pc.get_map_index()) pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3 pvp_attenders[pvp_manager.get_my_attender_id()].winner = true pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false pc.warp_local(pc.get_map_index(), 12600, 23400) end when fight_start_countdown.timer begin if arena[pvp_manager.get_arena()][5] == -1 then return end local partner_vid = find_pc_by_name(pvp_manager.get_duel_partner()) local my_vid = pc.get_vid() if arena[pvp_manager.get_arena()][5] == 0 then arena[pvp_manager.get_arena()][5] = -1 pc.select(partner_vid) command("pvp "..my_vid) pc.select(my_vid) command("pvp "..partner_vid) notice_in_map("La lucha entre "..pvp_manager.get_duel_partner().." y "..pc.get_name().." comienza!", pc.get_map_index()) timer("fight_start_countdown_shutdown", 1) else pc.select(partner_vid) if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then syschat("La batalla inicia en "..tostring(arena[pvp_manager.get_arena()][5]).." seconds.") end affect.add(apply.MOV_SPEED, -10000, 2) pc.select(my_vid) if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then syschat("The fight starts in "..tostring(arena[pvp_manager.get_arena()][5]).." seconds.") end affect.add(apply.MOV_SPEED, -10000, 2) arena[pvp_manager.get_arena()][5] = arena[pvp_manager.get_arena()][5] - 1 end end when fight_start_countdown_shutdown.timer begin cleartimer("fight_start_countdown") end when logout with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 90 and pvp_manager.get_fight_mode() == 2 begin pvp_manager.set_fight_mode(3) arena[pvp_manager.get_arena()][3] = 3 notice_in_map(pvp_manager.get_duel_partner().." Se lupta cotra "..pc.getname().."!", pc.get_map_index()) pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3 pvp_attenders[pvp_manager.get_my_attender_id()].winner = false pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = true local target = find_pc_by_name(pvp_manager.get_duel_partner()) local t = pc.select(target) pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num) pc.select(t) pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 126, 24) end when kill with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 90 and npc.is_pc() and pvp_manager.get_fight_mode() == 2 begin pvp_manager.set_fight_mode(3) if arena[pvp_manager.get_arena()][3] == 3 then return end arena[pvp_manager.get_arena()][3] = 3 notice_in_map(pc.getname().." Se lupta contra "..pvp_manager.get_duel_partner().."!", pc.get_map_index()) pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3 pvp_attenders[pvp_manager.get_my_attender_id()].winner = true pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num) timer("fight_end", 5) end when fight_end.timer begin pc.warp_local(pc.get_map_index(), 12600, 23400) pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 126, 24) end when letter with pc.get_map_index() == 90 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 3 begin pvp_manager.set_fight_mode(0) if pvp_attenders[pvp_manager.get_my_attender_id()].winner == true then arena[pvp_manager.get_arena()][3] = 0 pvp_manager.refresh_arenas() end end function fight_playerless() for aArena = 1, 4, 1 do if arena[aArena][3] != 0 then return end end playerless_mode = true pvp_manager.make_duel_list() pvp_manager.refresh_arenas() end function init_next_round() for aArena = 1, 4, 1 do if arena[aArena][3] != 0 then return end end playerless_mode = false local winner_count = 0 local winner_id = 0 for ai = 1, attender_count, 1 do pvp_attenders[ai].partner = nil pvp_attenders[ai].fight_mode = 0 if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true then winner_count = winner_count + 1 winner_id = ai end end if winner_count == 1 then notice_all(pvp_attenders[winner_id].name.." A castigaat Turneul PVP!") notice_all(pvp_attenders[winner_id].name.." recibe "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." como recompensa!") pvp_manager.distribute_bets(pvp_attenders[winner_id].name) local target = find_pc_by_name(pvp_attenders[winner_id].name) local t = pc.select(target) pc.give_item2(game.get_event_flag("pvp_price_vnum"), game.get_event_flag("pvp_price_count")) pc.select(t) notice_all("Evenimentul PVP sa terminat.") game.set_event_flag("pvp", 0) pvp_attenders = nil return end pvp_manager.make_duel_list() duel_list_index = 0 if winner_count == 2 then notice_all("Runda finala a inceput din Turneul PVP!") elseif winner_count <= 4 then notice_all("Runda Semi-Finala a inceput din Turneul PVP!") else notice_all("Urmatoarea runda a turneului PVP incepe acum!") end pvp_round_num = pvp_round_num + 1 pvp_manager.refresh_arenas() end function distribute_bets(winner_name) table.insert(betting_list, {pc.get_name(), bet_amount, player}) local jackpot = 0 local jackpot_winner_only = 0 local winners = 0 for i = 1, table.getn(betting_list), 1 do if betting_list[i][3] == winner_name then jackpot_winner_only = jackpot_winner_only + betting_list[i][2] end jackpot = jackpot + betting_list[i][2] winners = winners + 1 end for i = 1, table.getn(betting_list), 1 do if betting_list[i][3] == winner_name then pvp_manager.give_jackpot_gold(betting_list[i][1], math.ceil( (betting_list[i][2] / jackpot_winner_only)*jackpot )) end end end function give_jackpot_gold(name, amount) local target = find_pc_by_name(name) if target == 0 then return end local t = pc.select(target) pc.change_money(amount) pc.select(t) end function local_pc_warp(name, x, y) local target = find_pc_by_name(name) local t = pc.select(target) pc.warp_local(pc.get_map_index(), x*100, y*100) pc.select(t) end function setqf_by_name(name, flag, value) local target = find_pc_by_name(name) local t = pc.select(target) pc.setqf(flag, value) pc.select(t) end function getqf_by_name(name, flag) local target = find_pc_by_name(name) local t = pc.select(target) local rflag = pc.getqf(flag) pc.select(t) return rflag end function get_attender_id_by_name(name) for ai = 1, attender_count, 1 do if tostring(pvp_attenders[ai].name) == name then return ai end end return 0 end function get_my_attender_id() return pvp_manager.get_attender_id_by_name(pc.get_name()) end function get_duel_partner() if pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].partner != nil then return pvp_attenders[pvp_manager.get_my_attender_id()].partner else return nil end end function get_fight_mode() if pvp_attenders != nil and pvp_manager.get_my_attender_id() != 0 and pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != nil then return pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode else return 0 end end function set_fight_mode(fmode) pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode = fmode end function get_arena() return pvp_attenders[pvp_manager.get_my_attender_id()].arena end function set_arena(id) pvp_attenders[pvp_manager.get_my_attender_id()].arena = id end function ask_fight(asker, target) return confirm(find_pc_by_name(target), "Van a luchar contra "..asker.. "?", 15) end end end
-
- Informaţie
-
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 24 vizitatori



daca te-am ajutat