Jump to content

Guerra Coliseu


Radamanthos
 Share

Recommended Posts

Olá caros amigos, estou deixando aqui uma quest da Guerra do Coliseu, que estou com o seguinte problema ela não esta gravando os resultados na tabela no navicat, se alguém tiver ela em seu servidor e puder me ajudar agradeço e posso ajudar em outras coisas, pois ja quebrei muito a cabeça com essa bendita quest!

Se alguém ver algum erro na quest me fale também por gentileza!

Desde já, agradeço!

 

------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------
quest batalha_coliseu begin
	state start begin
		when 11001.chat."Batalha no Coliseu" or 11003.chat."Batalha no Coliseu" or 11005.chat."Batalha no Coliseu" begin
			if game.get_event_flag("eventoColiseuObserve") == 0 then
				if game.get_event_flag("eventoColiseu") == 0 then
					say_title("Batalha no Coliseu")
					say("")
					say("A Batalha ainda não começou!")
					say("")
				elseif game.get_event_flag("eventoColiseu") == 1 then
					say_title("Batalha no Coliseu")
					say("")
					say("A grande Batalha no Coliseu foi iniciada,")
					say("aquí se encontra os mais fortes e mais bravos")
					say("combatentes da atualidade, prove que você é um.")
					say_reward("Sua duração é de: "..game.get_event_flag("tempo_coliseu").." minutos.")
					say("Deseja entrar na batalha?")
					say("")
					local bc = select("Sim", "Não")
					if bc == 1 then
						if pc.count_item(22010) > 0 or pc.count_item(22011) > 0 or pc.count_item(50200) > 0 or pc.count_item(71049) > 0 then
							say_title("Batalha no Coliseu")
							say("")
							say("Para entrar você deve se desfazer dos")
							say("Pergaminhos de Retorno e Pacotes.")
							say("")
							return
						else
							if pc.get_level() >= 65 and pc.get_level() <= 105 then
								pc.setqf("ColiseuObserve", 0)
								local nation = { "Shinsu","Chunjo","Jinno" }
								notice_all(pc.get_name().." do reino "..nation[pc.getempire()].." entrou na Batalha no Coliseu!")
								local cords = math.random(1,11)
								if cords == 1 then pc.warp(796800, 782700)
								elseif cords == 2 then pc.warp(790300, 783200)
								elseif cords == 3 then pc.warp(796000, 793400)
								elseif cords == 4 then pc.warp(790500, 798300)
								elseif cords == 5 then pc.warp(783200, 798000)
								elseif cords == 6 then pc.warp(782900, 790100)
								elseif cords == 7 then pc.warp(787300, 790100)
								elseif cords == 8 then pc.warp(784400, 786300)
								elseif cords == 9 then pc.warp(794800, 785000)
								elseif cords == 10 then pc.warp(797600, 796200)
								elseif cords == 11 then pc.warp(792000, 792400)
								end
							else
								say_title("Batalha no Coliseu")
								say("")
								say("Seu nível é superior ou não atingiu a quantidade necessária")
								say("permitida.")
								say("Seu nível deve ser entre 65 e 105 para participar desta batalha!!!")
								say("")
								return
							end			
						end
					elseif bc == 2 then
						return
					end
				end
			elseif game.get_event_flag("eventoColiseuObserve") == 1 then
				say_title("Batalha no Coliseu")
				say("")
				say("Os portões de entrada da batalha foram fechados,")
				say("mas em modo espectador você poderá assisti-la!")
				say("Deseja observar a batalha?")
				say("")
				local cb = select("Sim", "Não")
				if cb == 1 then
					pc.setqf("ColiseuObserve", 1)
					pc.warp(789800, 789800)
				elseif cb == 2 then
				end
			end
		end

		when chequeando_fin_coliseu.timer begin
			if game.get_event_flag("eventoColiseu") == 0 then
				warp_to_village()
			end
		end

		when login or enter with not pc.is_gm() and pc.get_map_index() == 206 begin
			loop_timer("chequeando_fin_coliseu", 1)
			if pc.getqf("ColiseuObserve") == 0 and not pc.is_gm() then
				if game.get_event_flag("eventoColiseu") == 1 and not pc.is_gm() then
					cmdchat("SetColiseuGetInputOn")
					pc.coliseu_ativo()
					command("pkmode")
					local charcoliseu = mysql_query("SELECT * FROM player.coliseu_war WHERE nome = '"..pc.get_name().."' LIMIT 1;")
					if (charcoliseu[1] or {})[1] == nil or charcoliseu.nome[1] != pc.get_name() then
						local vazio = 0
						mysql_query("INSERT INTO player.coliseu_war (player_id,nome,lvl,reino,top_shinsoo_g,top_chunjo_g,top_jinno_g,vitoria_g,derrota_g,top_shinsoo,top_chunjo,top_jinno,vitoria,derrota,ranking) VALUES ("..pc.get_player_id()..",'"..pc.get_name().."',"..pc.get_level()..","..pc.get_empire()..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..","..vazio..");")
					end

				elseif game.get_event_flag("eventoColiseu") == 0 and not pc.is_gm() then
					cmdchat("SetColiseuGetInputOff")
					pc.coliseu_desativo()
					pc.observer_mode_false()
					warp_to_village()
				end
			elseif pc.getqf("ColiseuObserve") == 1 and not pc.is_gm() then
				pc.coliseu_ativo()
				pc.observer_mode_true()
			end
		end

		when kill with npc.is_pc() and pc.get_map_index() == 206 and game.get_event_flag("eventoColiseu") == 1 and not pc.is_gm() begin
			local vid = npc.get_vid()
			local old_pc = pc.select(vid)
			if old_pc != 0 then
				local lev = pc.get_level()
				local name = pc.get_name()
				pc.select(old_pc)
				chat("Você matou: "..name..", level: "..lev)
				local dead = 1
				mysql_query("UPDATE player.coliseu_war SET derrota_g = derrota_g + "..dead..", derrota = derrota + "..dead.." WHERE nome = '"..name.."' LIMIT 1;")
			end

			local kill = 1
			if npc.get_empire() == 1 then
				mysql_query("UPDATE player.coliseu_war SET top_shinsoo_g = top_shinsoo_g + "..kill..", vitoria_g = vitoria_g + "..kill..", top_shinsoo = top_shinsoo + "..kill..", vitoria = vitoria + "..kill..", ranking = ranking + "..kill.." WHERE nome = '"..pc.get_name().."' LIMIT 1;")
			elseif npc.get_empire() == 2 then
				mysql_query("UPDATE player.coliseu_war SET top_chunjo_g = top_chunjo_g + "..kill..", vitoria_g = vitoria_g + "..kill..", top_chunjo = top_chunjo + "..kill..", vitoria = vitoria + "..kill..", ranking = ranking + "..kill.." WHERE nome = '"..pc.get_name().."' LIMIT 1;")
			elseif npc.get_empire() == 3 then
				mysql_query("UPDATE player.coliseu_war SET top_jinno_g = top_jinno_g + "..kill..", vitoria_g = vitoria_g + "..kill..", top_jinno = top_jinno + "..kill..", vitoria = vitoria + "..kill..", ranking = ranking + "..kill.." WHERE nome = '"..pc.get_name().."' LIMIT 1;")
			end

			local rankcoliseu = mysql_query("SELECT * FROM player.coliseu_war WHERE nome NOT LIKE '[%]%' ORDER BY vitoria DESC, nome ASC")
			if pc.get_name() == rankcoliseu.nome[1] then
				chat("Você está na primeira colocação!")
				local nation = { "Shinsu","Chunjo","Jinno" }
				notice_all(pc.get_name().." do reino "..nation[pc.getempire()].." está liderando o rank da Batalha no Coliseu!")
			elseif pc.get_name() == rankcoliseu.nome[2] and pc.get_name() != rankcoliseu.nome[1] and pc.get_name() != rankcoliseu.nome[3] then
				chat("Você está na segunda colocação!")
				local nation = { "Shinsu","Chunjo","Jinno" }
				notice_all(pc.get_name().." do reino "..nation[pc.getempire()].." está na segunda colocação da Batalha no Coliseu!")
			elseif pc.get_name() == rankcoliseu.nome[3] and pc.get_name() != rankcoliseu.nome[1] and pc.get_name() != rankcoliseu.nome[2] then
				chat("Você está na terceira colocação!")
				local nation = { "Shinsu","Chunjo","Jinno" }
				notice_all(pc.get_name().." do reino "..nation[pc.getempire()].." está na terceira colocação da Batalha no Coliseu!")
			end
		end

    end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

Link to comment
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
 Share

×
×
  • Create New...