devil catacomb bug time

01/23/2015 18:07 botyk#1
Hey guys I have this quest:

Code:
-------------------------------
-- SERVERFILE BY HOPE v2 
-------------------------------
quest devils_catacomb begin
	state start begin
		when 20367.chat."Intră în Catacomba Diavolului" with pc.get_level() < 75 and pc.get_map_index() != 206 begin
			say_title("Paznicul catacombei:")
			say("")
			say("Nu voi lasa în Catacomba Diavolului un")
			say("cavaler lipsit de experiență ca tine.")
			say("")
			say("Este pentru siguranța ta.")
			say("")
			say_reward("Nivel necesar: 75")
			say("")
		end
		when 20367.chat."Intră în Catacomba Diavolului" with pc.get_level() >= 75 and pc.get_map_index() != 206 begin
			say_title("Paznicul catacombei:")
			say("")
			say("Dorești să intri în Catacomba Diavolului?")
			say("")
			local s = select("Da, vreau să intru.", "Nu, vreau să plec.")
			if s == 1 then
				if pc.count_item(30319) < 1 then
					say_title("Paznicul catacombei:")
					say("")
					say("Nu poți intra fără ")
					say_item_vnum(30319)
					say("")
					return
				end
				pc.warp(314700,1210100)	
			end
		end
		when 20367.chat."Înapoi în Templul Întunecat" with pc.get_map_index() == 206 begin
			say_title("Paznicul catacombei:")
			say("")
			say("Ești sigur că vrei să te dai bătut")
			say("și să te întorci în Templul Întunecat?")
			say("")
			local s = select("Da, sunt prea slab.", "Nu!")
			if s == 1 then
				pc.warp(591400, 99900)
			end
		end
		function get_devil_base()
			local x = pc.get_local_x()
			local y = pc.get_local_y()
			if pc.get_map_index() == 206 and x > 30 and y > 45 and x < 450 and y < 450 then
				return 1
			end
			if pc.get_map_index() >= 2060000 and pc.get_map_index() < 2070000 then
				if x > 30 and y > 45 and x < 450 and y < 450 then
					return 1
				elseif x > 540 and y > 39 and x < 1000 and y < 462 then
					return 2
				elseif x > 1048 and y > 35 and x < 1455 and y < 458 then
					return 3
				elseif x > 31 and y > 541 and x < 564 and y < 1058 then
					return 4
				elseif x > 650 and y > 540 and x < 1050 and y < 955 then
					return 5
				elseif x > 1175 and y > 576 and x < 1420 and y < 810 then
					return 6
				elseif x > 46 and y > 1091 and x < 102 and y < 1164 then
					return 7
				end
			end
			return 0
		end
		function register_player(vid)
			local player_count = d.getf("player_count")
			player_count = player_count + 1
			d.setf("player_count", tonumber(player_count))
			d.setf(string.format("player%d", player_count), tonumber(vid))
		end
		function unregister_player(vid)
			local player_count = d.getf("player_count")
			local found = false
			for i = 1, player_count, 1 do
				if found == true then
					d.setf(string.format("player%d", tonumber(i)), d.getf(string.format("player%d", i+1)))
				end
				p = d.getf("player"..tostring(i))
				if p == vid then
					i = i -1
					found = true
				end
			end
			if found == true then
				d.setf("player_count", tonumber(player_count - 1))
			end
		end
		function get_players()
			local players = {}
			local player_count = d.getf("player_count")
			for i = 1, player_count, 1 do
				players[i] = d.getf("player"..tostring(i))
			end
			return players
		end
		function checkbase3item(pindex)
			local self_checked = false
			local self = pc.select(d.getf("player"..tostring(pindex)))
			if pc.count_item(30319) < 1 and self_checked == false then
				warp_to_village()
			else
				pc.remove_item(30319, 1)
			end
			if pc.get_vid() == self then
				self_checked = true
			end
			pc.select(self)
		end
		function get_remaining_minutes()
			local m = 60 - (get_global_time() - d.getf("start_time"))/60
			if m <= 1 then
				return "un minut"
			else
				return string.format("%d de minute", m)
			end
		end
		when login with devils_catacomb.get_devil_base() == 1 begin
			addimage(20, 12, "catacombs.tga")
			say("")
			say("")
			say("")
			say("")
			say_title("Catacomba Diavolului: Nivel 1")
			say("")
			say("Distruge creaturile pentru a primi Cheia")
			say("Suflet Cristalizat. Aceasta deschide poarta")
			say("etajului 2.")	
			say("")
			say_item("Cheie suflet cristalizat", 30311, "")
			pc.remove_item(30311, pc.count_item(30311))
			pc.remove_item(30312, pc.count_item(30312))
		end		
		when kill with devils_catacomb.get_devil_base() == 1 begin
			chance = math.random ( 1 , 100 )
					if chance == 1 then		
				game.drop_item(30311, 1)
			end
		end		
		when 30101.take with item.vnum == 30311 and devils_catacomb.get_devil_base() == 1 begin
			if not party.is_party() then
				say_title("Statuia Kud:")
				say("")
				say("Trebuie să fii intr-o grupă.")
				say("")
				return
			end			
			if not party.is_leader() then
				say_title("Statuia Kud:")
				say("")
				say("Trebuie să fi liderul unei grupe.")
				say("")
				return
			end			
			if party.is_leader() then			
				item.remove()
				npc.purge()
				say_title("Statuia Kud:")
				say("")
				say("Intrarea a fost deblocată.")
				say("Treci repede!")
				say("")
				wait()
				say_title("Statuia Kud:")
				say("")				
				say("Aici începe adevărata aventură. De acum ai o")
				say("oră pentru a explora Catacomba Diavolului.")
				say("")
				wait()
				d.new_jump_all(206, 3626, 12083)
				d.clear_regen()
				d.regen_file("data/dungeon/devilscatacomb/base2_regen.txt")
				d.regen_file("data/dungeon/devilscatacomb/base2_npc.txt")
				d.setf("doors", 0)
				d.setf("start_time", get_global_time())
				server_timer("dc_time_expired", 60*60, d.get_map_index())
				server_timer("dc_time_notice", 55*60, d.get_map_index())
			end
		end		
		when login with pc.in_dungeon() == true and devils_catacomb.get_devil_base() != 0 begin
			pc.set_warp_location(65, 5914, 999)
			devils_catacomb.register_player(pc.get_vid())
			loop_timer("base7_smashout", 10)
			if party.is_leader() == true then
				d.setf("leader", pc.get_vid())
			end
			if devils_catacomb.get_devil_base() != 2 then return end
			say_title("Catacomba Diavolului: Nivel 2")
			say("")
			say("Sparge porțile și distruge sigiliul pentru")
			say("a trece mai departe.")	
			say("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
			say("")
		end
		when logout with pc.in_dungeon() == true and devils_catacomb.get_devil_base() > 1 begin
			devils_catacomb.unregister_player(pc.get_vid())
		end
		when 30111.kill or 30112.kill or 30113.kill or 30114.kill or 30115.kill or 30116.kill or 30117.kill or 30118.kill or 30119.kill with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 2 begin
			d.setf("doors", d.getf("doors") + 1)
			d.notice("Ați spart "..d.getf("doors").." uși din 11.")
		end
		when 30103.click with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 2 and pc.get_vid() == d.getf("leader") begin
			if d.getf("doors") < 11 then
			say_title("Piatră Testoasă:")
			say("")		
			say("Ai spart doar "..d.getf("doors").." uși din 11.")	
			say("Revin-o când le-ai spart pe toate.")
			say("")
			return
			end
			npc.lock()
			say_title("Piatră Testoasă:")
			say("")
			say("Doar cei care au cap mumificat pot trece")
			say("mai departe.")
			say("")
			say_reward("Dacă nu ai cap mumificat vei fi teleportat")
			say_reward("afară din Catacomba Diavolului.")
			say("")
			wait()
			local s = select("Da, lasă-ma să trec.", "Nu am capul mumificat.")
			if s == 1 then
				if pc.count_item(30319) < 1 then
					say_title("Piatră Testoasă:")
					say("")
					say("Nu ai capul mumificat.")
					say("Vei fi teleportat afară din Catacomba Diavolului.")
					say("")
					pc.warp(591400, 99900)
					return
				end
				say_title("Piatră Testoasă:")
				say("")
				say("Imediat vei fi teleportat la nivelul 3.")
				say("")
				timer("base3_jump", 4)
				wait()
			else
				say_title("Piatră Testoasă:")
				say("")
				say("Nu ai capul mumificat.")
				say("Vei fi teleportat afară din Catacomba Diavolului.")
				say("")
				wait()
				pc.warp(591400, 99900)
			end
		end		
		when base3_jump.timer begin
			if d.getf("base3jump") == 1 then
				return
			end
			d.setf("base3jump", 1)
			d.purge()
			if pc.count_item(30319) < 1 then
				d.exit_all()
			else
				pc.remove_item(30319, 1)
			end
			
			d.jump_all(4443, 12282)
			d.notice("Caută piatra Metin corectă și distruge-o.")
			d.notice("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
			d.clear_regen()
			d.regen_file("data/dungeon/devilscatacomb/base3_regen.txt")
			d.regen_file("data/dungeon/devilscatacomb/base3_stone_regen.txt")
		end
		when 8038.kill with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 3 and d.getf("warp_countdown_mode") != 1 begin
			local stone_count = d.getf("stone_count")
			stone_count = stone_count + 1
			if stone_count >= 5 or number(1, 5) == 5 then
				d.notice("Ai găsit piatra Metin corectă. Acum vei fi teleportat la nivelul 4.")
				d.setf("warp_countdown_mode", 1)
				server_timer("base4_jump", 4, pc.get_map_index())
			else
				d.setf("stone_count", stone_count + 1)
				d.notice("Piatra Metin este falsă. Găsește-o pe cea adevărată.")
			end
		end
		when base4_jump.server_timer begin
			if d.select(get_server_timer_arg()) then
				d.purge()
				d.jump_all(3144, 12617)
				d.clear_regen()
				d.regen_file("data/dungeon/devilscatacomb/base4_regen.txt")				
			end
		end
		when 30104.click with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 4 begin
			npc.purge()
			say_title("Fragment de Rună:")
			say("")
			say("Ai găsit ieșirea din labirint!")
			say("")
			server_timer("base5_jump", 4, pc.get_map_index())
		end
		when base5_jump.server_timer begin
			if d.select(get_server_timer_arg()) then
				d.purge()
				d.jump_all(3918, 12922)
				d.notice("Înfrânge Gardienii Demoni pentru a primi Totemul Schimonosit. După ce ai găsit totemul du-te")
				d.notice("și pune-l pe obeliscul din vârful muntelui.")
				d.notice("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
				local pos =
				{
					{850, 588},
					{714, 655},
					{701, 817},
					{987, 838},
					{994, 657},
				}
				cid = number(1, 5)
				d.spawn_mob(2591, pos[cid][1], pos[cid][2])
				
				d.regen_file("data/dungeon/devilscatacomb/base5_regen.txt")
			end
		end
		when 2591.kill with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 5 begin
			game.drop_item(30312, 1)
		end
		when 30102.take with item.vnum == 30312 and pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 5 begin
			item.remove()
			d.purge()
			d.notice("Ecoul strigătului de sânge coagulat se aude din adâncul Catacombei Diavolului.")
			d.notice("Charon s-a trezit!")
			d.jump_all(4339, 12702)
			d.clear_regen()
			d.spawn_mob(2597, 1305, 703)
			d.regen_file("data/dungeon/devilscatacomb/base6_regen.txt")
			server_loop_timer('base6_update', 10, pc.get_map_index())
			d.notice("Înfrânge-l pe Charon și demonii lui pentru a trece la următorul nivel.")
			d.notice("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
		end
		when base6_update.server_timer begin
			if not d.select(get_server_timer_arg()) then
				server_timer("base6_update_stop_timer", 1, get_server_timer_arg())
				return
			end
		end
		when 2597.kill with pc.in_dungeon() == true and devils_catacomb.get_devil_base() == 6 begin 
			say("L-ai învis pe Charon! Ai ajuns la ultimul[ENTER]nivel al Catacombei Diavolului![ENTER]")
			server_timer("base7_jump", 5, get_server_timer_arg())
		end
		when base6_update_stop_timer.server_timer begin
			clear_server_timer("base6_update", get_server_timer_arg())
		end
		when base7_jump.server_timer begin
			clear_server_timer("base6_update", get_server_timer_arg())
			if not d.select(get_server_timer_arg()) then
				return
			end
			d.purge()
			d.jump_all(3146, 13185)
			d.clear_regen()
			d.regen_file("data/dungeon/devilscatacomb/base7_regen.txt")
			d.set_unique("boss", d.spawn_mob(2598, 74, 1105))
			server_loop_timer("base7_boss_update", 10, get_server_timer_arg())
			d.notice("Înfruntă-l pe Azrael!")	
			d.notice("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
			d.setf("level", 7)
		end
		when base7_boss_update.server_timer begin
			if d.select(get_server_timer_arg()) then
				if d.is_unique_dead("boss") then
					d.clear_regen()
					d.purge()
					clear_server_timer("dc_time_expired", get_server_timer_arg())
					say_in_map(d.get_map_index(), color256(255, 230, 186).."Catacomba Diavolului:[ENTER][ENTER]"..color256(196, 196, 196).."Azrael a fost ucis. Înșfârsit[ENTER]pacea se poate reîntoarce în Catacombe.[ENTER]Acum vei fi teleportat afară.[ENTER]")
					server_timer("base7_update_stop_timer", 1, get_server_timer_arg())
					server_timer("dc_end_jump", 60, get_server_timer_arg())
				end
				return
			end
			server_timer("base7_update_stop_timer", 1, get_server_timer_arg())
		end
		when base7_update_stop_timer.server_timer begin
			clear_server_timer("base7_boss_update", get_server_timer_arg())
		end
		when base7_smashout.timer begin
			if d.getf("level") == 7 and devils_catacomb.get_devil_base() != 7 and d.select(pc.get_map_index()) then
				d.jump_all(3146, 13185)
			end
		end
		when dc_end_jump.server_timer begin
			if d.select(get_server_timer_arg()) then
				d.setf("level", 0)
				clear_server_timer("dc_time_expired", get_server_timer_arg())
				clear_server_timer("base7_smashout", get_server_timer_arg())
				clear_server_timer("base7_update_stop_timer", get_server_timer_arg())
				clear_server_timer("base7_boss_update", get_server_timer_arg())
				clear_server_timer("base6_update_stop_timer", get_server_timer_arg())
				clear_server_timer("base6_update", get_server_timer_arg())
				clear_server_timer("base5_jump", get_server_timer_arg())
				clear_server_timer("base4_jump", get_server_timer_arg())
				d.clear_regen()
				d.exit_all()
			end
		end
		when dc_time_expired.server_timer begin
			if d.select(get_server_timer_arg()) then
				d.setf("level", 0)
				d.notice("Timpul a expirat. Vei fi teleportat afară din Catacomba Diavolului.")
				clear_server_timer("base7_smashout", get_server_timer_arg())
				clear_server_timer("base7_update_stop_timer", get_server_timer_arg())
				clear_server_timer("base7_boss_update", get_server_timer_arg())
				clear_server_timer("base6_update_stop_timer", get_server_timer_arg())
				clear_server_timer("base6_update", get_server_timer_arg())
				clear_server_timer("base5_jump", get_server_timer_arg())
				clear_server_timer("base4_jump", get_server_timer_arg())
				d.clear_regen()
				d.exit_all()
			end
		end
		
		when dc_time_notice.server_timer begin
			if d.select(get_server_timer_arg()) then
				d.notice("Ti-au mai rămas "..devils_catacomb.get_remaining_minutes()..".")
			end
		end
		
	end
end
The bug is : When run the catacomb, on levle 2-3, error: TIME EXPIRED, and teleport all in the towers. I want to resolve that, is a time error...

From all the time the quest expire 10 minutes... And he say : time expired...