antiblock
Cyphriun
  • Chatbox

    You don't have permission to chat.
    Load More
  • 0
Sign in to follow this  
Bass

[Ajuda] Problemas Com Quest Monarch_Election

Question

Olá Cyber's,

 

 

Recentemente fiz o download das Files Invoice v3, fazendo alguns testes para para ver o que precisava de ajustes, me deparei com o seguinte problema:

 

Ao ativar a quest do sistema imperial inicialmente tudo ocorre normalmente, o período de candidatura é aberto,  após fecha-lo, as votações são abertas, o sistema mostra quem esta ganhando em cada reino tudo bonitinho até que ao encerrar a votação nada mais acontece, apenas é feito o anuncio de que a votação foi encerrada. Ou seja, não é anunciado o vencedor e nem o mesmo recebe os itens imperiais. Abaixo segue o script da quest.

 

(Obs. Retirei a parte que exige o "Certificado de fidelização, item 60004", fiz testes antes e depois de retirar essa parte).

 

 

-- World of Metin2 Monarch Election quest
-- by Musicinstructor and Shogun
quest monarch_election begin
  state start begin
  when login or enter begin
  if oh.ismonarch() > 0 and pc.count_item(70021) == 0 then
  set_state(newking)
  elseif oh.ismonarch() == 0 then
  if pc.count_item(70021) > 0 then
  pc.remove_item(70021)
  syschat("Benção Angelical foi removida.")
  end
  if pc.count_item(11971) > 0 or pc.count_item(11972) > 0 or pc.count_item(11973) > 0 or pc.count_item(11974) > 0 then
  if pc.get_part(PART_MAIN) > 11970 and pc.get_part(PART_MAIN) < 11975 then
  syschat("Por favor desequipe a Armadura imperial e relogue.")
  syschat("Você não tem permissão para usá-lo mais.")
  else
  local armor = 11971 + pc.get_job()
  pc.removeitem(armor)
  syschat("Sua armadura imperial foi removida.")
  end
  end
  end
  if game.get_event_flag("monarch_elect") > 0 and pc.get_level() >= 40 then
  send_letter("Monarch Election")
  end

  end
  when button or info begin
  ----"123456789012345678901234567890123456789012345678901234567890"|
  addimage(20, 12, "monarch.tga")
  say("")
  say("")
  say("")
  say("")

  if game.get_event_flag("monarch_elect") == 1 then
  say_title("Monarch Candidacy")
  say("")
  ----"123456789012345678901234567890123456789012345678901234567890"|
  say("Se você quer se candidatar para imperador do reino "..locale.empire_names[pc.get_empire()]..",")
  say("vá conversar com o Arqueiro da Praça. E lembre-se")
  say("Você precisa ter 1.000.000,00 de golds e no minimo 65 niveis.")
  say("")
  say("Quando as candidaturas forem encerradas, você podera votar!")
  elseif game.get_event_flag("monarch_electionid") == pc.getqf("electionid") then
  say_title("Eleição Imperial")
  say("")
  say("Voto computado com sucesso. Os resultados serão")
  say("divulgados assim que as votações forem encerradas.")
  else
  say_title("Eleição Imperial")
  say("")
  say("Dirija-se ao Arqueiro da Praça para votar.")
  say("Você irá precisar de:")
  say("")
  say_item_vnum(60004)
  say("Este item pode ser obtido durante combates com inimigos.")
  end
  say("")
  end
 
  when kill with game.get_event_flag("monarch_elect") > 0 and pc.level >= 45 begin
  if game.get_event_flag("monarch_electionid") != pc.getqf("electionid") then
  if not npc.is_pc() then
  local limit = get_mob_level[npc.get_race()]
  if limit == nil then
  return
  else
  if pc.get_level() > limit+10 then
  return
  end
  end
  end
  if number(1, 500) == 1 then
  if pc.count_item(60004) == 0 and pc.enough_inventory(60004) then
  pc.give_item2(60004, 1)
  syschat("Agora você pode votar para imperador!")
  end
  end
  end
  end
 
  when electionman1.chat."GM: Ajustes Imperio" or electionman2.chat."GM: Ajustes Imperio" or electionman3.chat."GM: Ajustes Imperio" with pc.is_gm() begin
  if game.get_event_flag("monarch_elect") == 1 then
  say_title("Eleição Imperial")
  say("")
  ----"123456789012345678901234567890123456789012345678901234567890"|
  say("As candidaturas para assumir o imperio estão abertas!")
  say("")
  say("Será que ser fechado agora?")
  say("")
  local s = select("Close", "Continue" )

  if s == 1 then
  notice_all("A Eleição para imperador esta começando!")
  notice_all("Apresente o seu certificado para o Arqueiro da Praça.")
  game.set_event_flag("monarch_elect", 2)
  game.set_event_flag("monarch_electionid", get_global_time())
  say_title("Eleição Imperial")
  say("")
  say("As candidaturas foram encerradas,")
  say("as votação para imperador já começou.")
  say("")
  end
 
  elseif game.get_event_flag("monarch_elect") == 2 then
  say_title("Eleição Imperial")
  say("")
  say("A eleição para imperador esta em execução!")
  say("Deseja encerrar?")
  say("")
  say_reward("Classificação atual:")
  say_reward("Pandemonia: "..monarch_election.getcurrentwinner(1)[1])
  say_reward("Chonjo: "..monarch_election.getcurrentwinner(2)[1])
  say_reward("Elgoria: "..monarch_election.getcurrentwinner(3)[1])
  say("")
  local s = select("End", "Continue")
 
  if s == 1 then
  notice_all("A eleição imperial foi encerrada!")
  game.set_event_flag("monarch_elect", 0)
  if monarch_election.getcurrentwinner(1)[2] != 0 then mgmt.monarch_change_lord(1, monarch_election.getcurrentwinner(1)[2]) end
  if monarch_election.getcurrentwinner(2)[2] != 0 then mgmt.monarch_change_lord(2, monarch_election.getcurrentwinner(2)[2]) end
  if monarch_election.getcurrentwinner(3)[2] != 0 then mgmt.monarch_change_lord(3, monarch_election.getcurrentwinner(3)[2]) end
  end
 
  elseif game.get_event_flag("monarch_elect") == 0 then
  say_title("Eleição Imperial")
  say("")
  say("Aqui você pode iniciar as eleições para imperador.")
  say("")
  say("Deseja iniciar as eleiçoes?")
  say("")
  local s = select("Start", "Don't start")

  if s == 1 then
  notice_all("O período de candidatura a imperador começa agora!")
  notice_all("Aproxime-se do Arqueiro da Praça da cidade para candidatar-se para a eleição.")
  game.set_event_flag("monarch_elect", 1)
  game.set_event_flag("monarch_electionid", get_global_time())
  monarch_election.clearcandidacy()
  end

  end

  end


  when electionman1.chat."Eleinção Imperial" or electionman2.chat."Eleinção Imperial" or electionman3.chat."Eleinção Imperial" with game.get_event_flag("monarch_elect") == 2 begin
  say_title("Eleinção Imperial")
  say("")
 
  if pc.get_level() < 45 then
  say("Apenas player com niveis acima de 45 podem votar.")
  say("Volte quando atingir nivel mais alto.")
  say("")
  return
  end
 
  if game.get_event_flag("monarch_electionid") == pc.getqf("electionid") then
  say("Você já votou! Só é permitido um voto por player.")
  say("")
  return
  end

  local gname_table = monarch_election.candidacy_list(pc.get_empire())
  if table.getn(gname_table) == 0 then
  -- no currently war
  say("Não há candidatos!")
  say("")
  else
  table.insert(gname_table, "Cancel")
  ----"123456789012345678901234567890123456789012345678901234567890"|
  say("Você está habilitado a participar. Por favor vote com cuidado,")
  say("você podera fazer isso apenas uma vez!")
  say("")
  wait()
  local s = select_table(gname_table)

  if s == table.getn(gname_table) then
  return;
  else
  monarch_election.election(s)
  pc.setqf("electionid", game.get_event_flag("monarch_electionid"))
  pc.remove_item(60004, 1)
  say_title("Eleinção Imperial")
  say("")
  say("Obrigado por participar!")
  say("")
  say_reward("Você votou em: "..gname_table)
  say("")
  end
  end
  end


  when electionman1.chat."Candidate-se a eleição" or electionman2.chat."Candidate-se a eleição" or electionman3.chat."Candidate-se a eleição" with game.get_event_flag("monarch_elect") == 1 begin
  local NEED_MONEY = 1000000
  local NEED_LEVEL = 65
  say_title("Eleinção Imperial")
  say("")
  say("Os seguintes requisitos são necessários para ser um Imperador:")
  say("")
  say_reward("1. A taxa de candidatura é de "..NEED_MONEY.." Yang.")
  say_reward("2. Nivel "..NEED_LEVEL.." deve ser alcançado.")
  say("")
 
  if game.get_event_flag("monarch_elect") == 0 then
  say("O período eleitoral ainda não começou.")
  say("Volte quando começar.")
  say("")
  return
  end
  if game.get_event_flag("monarch_electionid") == pc.getqf("electionid") then
  say("Você já se candidatou para Imperador.")
  say("")
  return
  end

  say("Você quer participar da eleição?")
  say("")

  local s = select("Yes, I want to participate.", "No, thanks.")

  if s == 1 then
  say_title("Eleição Imperial")
  say("")
  if monarch_election.candidacycount(pc.get_empire()) >= 8 then
  say("Desculpe, mas já temos candidatos suficientes.")
  say("")
  say("Você pode tentar novamente na próxima eleição.")
  elseif pc.get_gold() >= NEED_MONEY and pc.get_level() >= NEED_LEVEL then
  say("Agora você está registrado para a eleição.")
  say("")
  say("Boa Sorte")
  pc.change_gold(-NEED_MONEY);
  monarch_election.candidacy();
  pc.setqf("electionid", game.get_event_flag("monarch_electionid"))
  else
  say("Desculpe, preenche todos os requisitos.")
  end
  say("")
  end
  end
 
  function candidacy()
  local f = io.open("data/monarch_election", "a+")
  f:write(pc.get_player_id().."t"..pc.get_empire().."t0t"..pc.get_name().."tn")
  f:close()
  end
 
  function clearcandidacy()
  local f = io.open("data/monarch_election", "w+")
  f:close()
  end
 
  function candidacycount(empire)
  local count = 0
  local f = io.open("data/monarch_election", "r")
  for line in f:lines() do
  local e = string.split(line, "t")
  if e != nil and tonumber(e[2]) == empire then
  count = count + 1
  end
  end
  f:close()
  return count
  end
 
  function candidacy_list(empire)
  local res = {}
  local f = io.open("data/monarch_election", "r")
  for line in f:lines() do
  cinfo = string.split(line, "t")
  if tonumber(cinfo[2]) == empire then
  table.insert(res, cinfo[4])
  end
  end
  f:close()
  return res
  end
 
  function election(id)
  local c_list = {}
  local c_count = 0
  local f = io.open("data/monarch_election", "r")
  for line in f:lines() do
  table.insert(c_list, string.split(line, "t"))
  c_count = c_count + 1
  end
  f:close()
  f = io.open("data/monarch_election", "w+")
  local e_i = 1
  for i = 1, c_count, 1 do
  if e_i == id then
  c_list[3] = tonumber(c_list[3]) + 1
  end
  if tonumber(c_list[2]) == pc.get_empire() then
  e_i = e_i + 1
  end
  f:write(c_list[1].."t"..c_list[2].."t"..c_list[3].."t"..c_list[4].."tn")
  end
  f:close()
  end
 
  function getcurrentwinner(empire)
  local res = {"Nobody", 0}
  local f = io.open("data/monarch_election", "r")
  local maxvotes = -1
  for line in f:lines() do
  local exploded = string.split(line, "t")
  if tonumber(exploded[2]) == empire and tonumber(exploded[3]) > maxvotes then
  maxvotes = tonumber(exploded[3])
  res = {exploded[4], tonumber(exploded[1])}
  end
  end
  f:close()
  return res
  end
 
 
  end
  state newking begin
  when login or enter begin
  send_letter("Parabéns")
  end
  when button or info begin
  local treatment = {
  [0] = "King",
  [1] = "Queen",
  }
  local armor = 11971 + pc.get_job()

  ----"123456789012345678901234567890123456789012345678901234567890"|
  say_title("Parabéns!")
  say("")
  say("Você foi eleito como o "..treatment[pc.get_sex()].." do reino "..locale.empire_names[pc.get_empire()].."!")
  say("")
  say("Como "..treatment[pc.get_sex()]..", você tem direito a Armadura Imperial e a")
  say("Benção Angelical durante o seu governo.")
  say("")
  say("A Benção Angelical permite que você use o seus poderes de governate,")
  say("Mas cuidado para não levar o seu reino a mizeria!")
  say("Então use-a com sabedoria.")
  say("")
  say("Que o seu governo seja prospero!")
  say("")
  clear_letter()
  set_state(start)
  if pc.count_item(armor) == 0 then
  pc.give_item2(armor)
  end
  if pc.count_item(70021) == 0 then
  pc.give_item2(70021)
  end

  notice_all(""..treatment[pc.get_sex()].." "..pc.getname().." de "..locale.empire_names[pc.get_empire()].." foi coroado! Todos saúdem o "..treatment[pc.get_sex()].."!")
  end
  end
end

 

 

 

 

A tradução está faltando alguns ajustes, mas se alguém gostar fique a vontade.

 

Desde já agradeço a atenção de todos.

 

 

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

deves ir em /noemdasfiles/share/data lá tem um arquivo que mostra quem foi eleito depois ir no navicat na tabela monarca e preencher lá com dados do imperador após colocar o player imperador quando ele logar

vai aparecer isso, e player ganha a bênção e a armadura.

state newking begin	    when login or enter begin			    send_letter("Parabéns")	    end	    when button or info begin			    local treatment = {				    [0] = "King",				    [1] = "Queen",			    }			    local armor = 11971 + pc.get_job()			    ----"123456789012345678901234567890123456789012345678901234567890"|			    say_title("Parabéns!")			    say("")			    say("Você foi eleito como o "..treatment[pc.get_sex()].." do reino "..locale.empire_names[pc.get_empire()].."!")			    say("")			    say("Como "..treatment[pc.get_sex()]..", você tem direito a Armadura Imperial e a")			    say("Benção Angelical durante o seu governo.")			    say("")			    say("A Benção Angelical permite que você use o seus poderes de governate,")			    say("Mas cuidado para não levar o seu reino a mizeria!")			    say("Então use-a com sabedoria.")			    say("")			    say("Que o seu governo seja prospero!")			    say("")			    clear_letter()			    set_state(start)			    if pc.count_item(armor) == 0 then				    pc.give_item2(armor)			    end			    if pc.count_item(70021) == 0 then				    pc.give_item2(70021)			    end			    notice_all(""..treatment[pc.get_sex()].." "..pc.getname().." de "..locale.empire_names[pc.get_empire()].." foi coroado! Todos saúdem o "..treatment[pc.get_sex()].."!")

Share this post


Link to post
Share on other sites
antiblock
Rodnia | Alpha & Omega
  • 0

Um pequeno à parte, é miséria e não mizeria.

Share this post


Link to post
Share on other sites
  • 0

Um pequeno á parte visto que o sinvalindo já resolveu o problema, para a próxima se a quest for grande mete em spoiler, e dentro de

[/code.] (sem o ponto) para a leitura ser mais fácil

Share this post


Link to post
Share on other sites
  • 0

Obrigado a todos que deixaram seu afazeres de lado para dar um pouquinho de atenção a minha duvida.

 

Em especial:

 

Obrigado pela resposta Sinvalindo;

Obrigado pela dica StriK€

E desculpe pelos erros de gramática IronMan agradeço pela correção!

Nos próximos me atentarei mais a esse respeito.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this