quest main_quest_lv90 begin
	state start begin
		when login or levelup or enter with pc.level >= 90 begin
			set_state (state01_1)
		end
	end
	state state0 begin
		when login or levelup or enter with pc.level >= 90 begin
			set_state (state01_1)
		end
	end
	
	
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	-----------------<01> 이충의 호출-----------------
	state state01_1 begin 
		when letter begin 
			send_letter (gameforge.main_quest_lv90._1070_sendLetter)
			
			local v = find_npc_by_vnum(20369)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20369))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._1070_sendLetter)
			say(gameforge.main_quest_lv90._1080_say)
		end
		
		when 20369.chat.gameforge.main_quest_lv90._010_sendLetter begin 
			target.delete("__TARGET__")
			
			say_title(mob_name(20369))
			say(gameforge.main_quest_lv90._1090_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._1100_say)
			
			set_state (state01_2)
		end
		
	end
	
	state state01_2 begin 
		when letter begin 
			send_letter (gameforge.main_quest_lv90._1070_sendLetter)
			
			local v = find_npc_by_vnum(9012)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(9012))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._1110_sayTitle)
			say(gameforge.main_quest_lv90._1120_say)
		end
		
		-------<<< 공간 이동 술사가 캐릭터를 이동 시켜주는 내용이 추가되어야 한다. >>>--------
		--필요한 내용 : 이동할 좌표, npc 번호, 관련 스크립트.
		--
		--
		
		when login or enter with pc.get_map_index() == 301 begin
			--보상
			say_title(locale.reward)
			--say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 0))
			say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 50000))
--			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(REWARD01_ITEM1),REWARD01_ITEM1_COUNT,locale.count_postfix))
			say("")
			
			--pc.give_exp2(0)
			pc.change_money(50000)
--			pc.give_item2(REWARD01_ITEM1, REWARD01_ITEM1_COUNT)
			
			set_state (state1_1)
		end
	end
	
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	-----------------<1> 악룡군도의 상황-----------------
	state state1_1 begin 
		when letter begin 
			send_letter (gameforge.main_quest_lv90._010_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._010_sendLetter)
			say(gameforge.main_quest_lv90._020_say)
		end
		
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin 
			target.delete("__TARGET__")
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._030_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._040_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._050_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._060_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._070_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._080_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._090_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._100_say)
			wait()
			
			say_reward(string.format(gameforge.main_quest_lv90._110_sayReward, 226,731))
			
			set_state (state1_2)
		end
	end
	-- 첫번째 지역 정찰
	state state1_2 begin 
		when letter begin 
			target.pos ("__TARGET__",226,731,301,"")
			send_letter (gameforge.main_quest_lv90._010_sendLetter)
		end
		
		when button or info begin
			-- if pc.get_map_index() == 301 then
				-- addmapsignal(226 * 100, 731 * 100) 
			-- end
			say_title(gameforge.main_quest_lv90._120_sayTitle)
			say(gameforge.main_quest_lv90._130_say)
			say_reward(string.format(gameforge.main_quest_lv90._140_sayReward,226,731))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		when __TARGET__.target.arrive begin
			target.delete("__TARGET__")
			say_reward(string.format(gameforge.main_quest_lv90._150_sayReward,1093,285))
			set_state (state1_3)
		end
		
		when  20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			say(gameforge.main_quest_lv90._160_say)
		end
	end 
	-- 두번째 지역 정찰
	state state1_3 begin 
		when letter begin 
			target.pos ("__TARGET__",1093,285,301,"")
			send_letter (gameforge.main_quest_lv90._010_sendLetter)
		end
		
		when button or info begin
			-- if pc.get_map_index() == 301 then
				-- addmapsignal(1093 * 100, 285 * 100) 
			-- end
			say_title(gameforge.main_quest_lv90._120_sayTitle)
			say(gameforge.main_quest_lv90._130_say)
			say_reward(string.format(gameforge.main_quest_lv90._170_sayReward,1093,285))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		when __TARGET__.target.arrive begin
			target.delete("__TARGET__")
			say_reward(string.format(gameforge.main_quest_lv90._180_sayReward,1081,1289))
			set_state (state1_5)
		end
		
		when  20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			say(gameforge.main_quest_lv90._160_say)
		end
	end 
	-- 세번째 지역 정찰
	-- state state1_4 begin 
		-- when letter begin 
			-- target.pos ("__TARGET__",RECON3_X,RECON3_Y,RECON3_MAPINDEX,"")
			-- send_letter (gameforge.main_quest_lv90._010_sendLetter)
		-- end
		
		-- when button or info begin
			-- if pc.get_map_index() == RECON3_MAPINDEX then
				-- addmapsignal(RECON3_X * 100, RECON3_Y * 100) 
			-- end
			-- say_title(gameforge.main_quest_lv90._120_sayTitle)
			-- say(locale.main_quest_lv90.say_11)
			-- say_reward(string.format(gameforge.main_quest_lv90._190_say,RECON3_X,RECON3_Y))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		-- end
		
		-- when __TARGET__.target.arrive begin
			-- target.delete("__TARGET__")
			-- say_reward(string.format(gameforge.main_quest_lv90._200_say,1081,1289))
			-- set_state (state1_5)
		-- end
		
		-- when  20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			-- say(locale.main_quest_lv90.say_14)
		-- end
	-- end 
	-- 네번째 지역 정찰
	state state1_5 begin 
		when letter begin 
			target.pos ("__TARGET__",1081,1289,301,"")
			send_letter (gameforge.main_quest_lv90._010_sendLetter)
		end
		
		when button or info begin
			-- if pc.get_map_index() == 301 then
				-- addmapsignal(1081 * 100, 1289 * 100) 
			-- end
			say_title(gameforge.main_quest_lv90._120_sayTitle)
			say(gameforge.main_quest_lv90._130_say)
			say_reward(string.format(gameforge.main_quest_lv90._210_sayReward,1081,1289))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		when __TARGET__.target.arrive begin
			target.delete("__TARGET__")
			say_reward(gameforge.main_quest_lv90._220_sayReward)
			set_state (state1_6)
		end
		
		when  20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			say(gameforge.main_quest_lv90._160_say)
		end
	end 
	-- 정찰 완료
	state state1_6 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._010_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._010_sendLetter)
			say(gameforge.main_quest_lv90._230_say)
		end
		
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._240_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._250_say)
			wait()
			
			--보상
			say_title(locale.reward)
			--say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 0))
			say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 100000))
			--say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(REWARD1_ITEM1),REWARD1_ITEM1_COUNT,locale.count_postfix))
			say("")
			
			--pc.give_exp2(0)
			pc.change_money(100000)
			--pc.give_item2(REWARD1_ITEM1, REWARD1_ITEM1_COUNT)
			
			set_state (state2_1)
		end
	end
	
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	-----------------<2> 이충의 편지-----------------
	state state2_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._260_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._260_sendLetter)
			say(gameforge.main_quest_lv90._270_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._260_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._280_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._290_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._300_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._310_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._320_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._330_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._340_say)
			
			set_state (state2_2)
		end
	end
	state state2_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._260_sendLetter)
		end
		when button or info begin
			-- if pc.get_map_index() == 301 then
				-- addmapsignal(500 * 100, 500 * 100)
				-- addmapsignal(600 * 100, 500 * 100)
				-- addmapsignal(700 * 100, 300 * 100)
			-- end
			say_title(gameforge.main_quest_lv90._350_sayTitle)
			say(gameforge.main_quest_lv90._360_say)
			say_item_vnum(31016)
			
			-- say()
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._260_sendLetter begin
			if pc.count_item(31016) >= 1 then
				pc.remove_item ( 31016, pc.count_item(31016))	
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._400_say)
				wait()
			
				say_title(mob_name(20369))
				say(string.format(gameforge.main_quest_lv90._410_say,pc.getname()))
				wait()
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._420_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 6247460))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 137000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50705),10,locale.count_postfix))
				say("")
				
				pc.give_exp2(6247460)
				pc.change_money(137000)
				pc.give_item2(50705, 10)
				
				set_state (state3_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._370_say)
			end
		end
		
		when 3001.kill or 3002.kill or 3003.kill or 3004.kill or 3005.kill or 3090.kill or 3091.kill begin
			if number(1,1) == 1 then
				if pc.count_item(31016) < 1 then
					notice_multiline(gameforge.main_quest_lv90._380_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._380_2_notice,notice)
					pc.give_item2(31016, 1)
					set_state (state2_3)
				end
			end
		end
	end
	-- 퀘스트 완료
	state state2_3 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._260_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._260_sendLetter)
			say(gameforge.main_quest_lv90._390_say)
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3001.kill or 3002.kill or 3003.kill or 3004.kill or 3005.kill or 3090.kill or 3091.kill begin
			if number(1,1) == 1 then
				if pc.count_item(31016) < 1 then
					notice_multiline(gameforge.main_quest_lv90._380_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._380_2_notice,notice)
					pc.give_item2(31016, 1)
					set_state (state2_3)
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv90._260_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31016) >= 1 then
				pc.remove_item ( 31016, pc.count_item(31016))	
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._400_say)
				wait()
			
				say_title(mob_name(20369))
				say(string.format(gameforge.main_quest_lv90._410_say,pc.getname()))
				wait()
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._420_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 6247460))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 137000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50705),10,locale.count_postfix))
				say("")
				
				pc.give_exp2(6247460)
				pc.change_money(137000)
				pc.give_item2(50705, 10)
				
				set_state (state3_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._370_say)
				
				set_state (state2_2)
			end
		end
	end
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	-----------------<3> 낭인족의 단서1-1-----------------
	state state3_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._430_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._430_sendLetter)
			say(gameforge.main_quest_lv90._440_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._430_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._450_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._460_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._470_say)
			
			set_state (state3_2)
		end
	end
	state state3_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._430_sendLetter)
		end
		when button or info begin
			-- if pc.get_map_index() == 1 then
				-- addmapsignal(500 * 100, 500 * 100)
				-- addmapsignal(600 * 100, 500 * 100)
				-- addmapsignal(700 * 100, 300 * 100)
			-- end
			say_title(gameforge.main_quest_lv90._480_sayTitle)
			say(gameforge.main_quest_lv90._490_say)
			say_item_vnum(31009)
			
			-- say()
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._430_sendLetter begin
			if pc.count_item(31009) >= 1 then
				pc.remove_item ( 31009, pc.count_item(31009))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._530_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 10421740))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 148000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(72001),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30046),1,locale.count_postfix))
				say("")
				
				pc.give_exp2(10421740)
				pc.change_money(148000)
				pc.give_item2_select(72001)
				item.set_socket(2, 60)
				pc.give_item2(30046, 1)
				
				set_state (state4_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._500_say)
			end
		end
		
		when 3005.kill begin
			if number(1,500) == 1 then
				if pc.count_item(31009) < 1 then
					pc.give_item2(31009, 1)
					
					
					if pc.count_item(31009) >= 1 then
						notice_multiline(gameforge.main_quest_lv90._510_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._510_2_notice,notice)
						set_state (state3_3)
					end
				end
			end
		end
	end
	-- 퀘스트 완료
	state state3_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv90._430_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._430_sendLetter)
			say(gameforge.main_quest_lv90._520_say)
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3005.kill begin
			if number(1,500) == 1 then
				if pc.count_item(31009) < 1 then
					pc.give_item2(31009, 1)
					
					
					if pc.count_item(31009) >= 1 then
						notice_multiline(gameforge.main_quest_lv90._510_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._510_2_notice,notice)
					end
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv90._430_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31009) >= 1 then
				pc.remove_item ( 31009, pc.count_item(31009))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._530_say)
				wait()
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 10421740))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 148000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(72001),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30046),1,locale.count_postfix))
				say("")
				
				pc.give_exp2(10421740)
				pc.change_money(148000)
				pc.give_item2_select(72001)
				item.set_socket(2, 60)
				pc.give_item2(30046, 1)
				
				set_state (state4_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._500_say)
				
				set_state (state3_2)
			end
		end
	end
	
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	-----------------<4> 낭인족의 단서1-2-----------------
	state state4_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._560_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._560_sendLetter)
			say(gameforge.main_quest_lv90._570_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._560_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._580_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._590_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._600_say)
			
			set_state (state4_2)
		end
	end
	state state4_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._560_sendLetter)
		end
		when button or info begin
			-- if pc.get_map_index() == 1 then
				-- addmapsignal(500 * 100, 500 * 100)
			-- end
			say_title(gameforge.main_quest_lv90._610_sayTitle)
			say(gameforge.main_quest_lv90._620_say)
			say_item_vnum(31009)
			
			-- say()
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._560_sendLetter begin
			if pc.count_item(31009) >= 1 then
				pc.remove_item ( 31009, pc.count_item(31009))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._650_say)
				wait()
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._670_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 15421740))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 100000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30021),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50708),10,locale.count_postfix))
				say("")
				
				pc.give_exp2(15421740)
				pc.change_money(100000)
				pc.give_item2(30021, 1)
				pc.give_item2(50708, 10)
				
				set_state (state5_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._630_say)
			end
		end
		
		when 3090.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31009) < 1 then
					pc.give_item2(31009, 1)
					
					
					if pc.count_item(31009) >= 1 then
						notice_multiline(gameforge.main_quest_lv90._640_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._640_2_notice,notice)
						set_state (state4_3)
					end
				end
			end
		end
	end
	-- 퀘스트 완료
	state state4_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv90._560_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._560_sendLetter)
			say(gameforge.main_quest_lv90._680_say)
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3090.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31009) < 1 then
					pc.give_item2(31009, 1)
					
					
					if pc.count_item(31009) >= 1 then
						notice_multiline(gameforge.main_quest_lv90._640_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._640_2_notice,notice)
					end
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv90._560_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31009) >= 1 then
				pc.remove_item ( 31009, pc.count_item(31009))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._650_say)
				wait()
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._670_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 15421740))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 100000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30021),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50708),10,locale.count_postfix))
				say("")
				
				pc.give_exp2(15421740)
				pc.change_money(100000)
				pc.give_item2(30021, 1)
				pc.give_item2(50708, 10)
				
				set_state (state5_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._630_say)
				
				set_state (state4_2)
			end
		end
	end
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	-----------------<5> 범익족의 규모 파악-----------------
	state state5_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._690_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._690_sendLetter)
			say(gameforge.main_quest_lv90._700_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._690_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._710_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._720_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._730_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._740_say)
			
			set_state (state5_2)
		end
	end
	state state5_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._690_sendLetter)
			q.set_counter_name(gameforge.main_quest_lv90._750_say)
		end
		when button or info begin
			-- if pc.get_map_index() == 1 then
				-- addmapsignal(500 * 100, 500 * 100)
				-- addmapsignal(600 * 100, 500 * 100)
				-- addmapsignal(700 * 100, 300 * 100)
			-- end
			
			say_title(gameforge.main_quest_lv90._830_sayTitle)
			say(gameforge.main_quest_lv90._840_say)
			say(gameforge.main_quest_lv90._750_say)
			local remain1 = 50 - pc.getqf("mob5_1_kill")
			if remain1 < 0 then
				remain1 = 0
			end
			local remain2 = 40 - pc.getqf("mob5_2_kill")
			if remain2 < 0 then
				remain2 = 0
			end
			local remain3 = 20 - pc.getqf("mob5_3_kill")
			if remain3 < 0 then
				remain3 = 0
			end
			local remain4 = 10 - pc.getqf("mob5_4_kill")
			if remain4 < 0 then
				remain4 = 0
			end
			local total_remain = remain1 + remain2 + remain3 + remain4
			q.set_counter_value(total_remain)
			say_reward(string.format(gameforge.main_quest_lv90._760_say, mob_name(3201), remain1, mob_name(3202), remain2))
			say_reward(string.format(gameforge.main_quest_lv90._760_say, mob_name(3204), remain3, mob_name(3205), remain4))
			say()
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._690_sendLetter begin
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._770_say)
		end
		
		function kill_count() 
			local remain1 = 50 - pc.getqf("mob5_1_kill")
			if remain1 < 0 then
				remain1 = 0
			end
			local remain2 = 40 - pc.getqf("mob5_2_kill")
			if remain2 < 0 then
				remain2 = 0
			end
			local remain3 = 20 - pc.getqf("mob5_3_kill")
			if remain3 < 0 then
				remain3 = 0
			end
			local remain4 = 10 - pc.getqf("mob5_4_kill")
			if remain4 < 0 then
				remain4 = 0
			end
			local total_remain = remain1 + remain2 + remain3 + remain4
			q.set_counter_value(total_remain)
			
			return total_remain
		end
		
		when 3201.kill begin
			local kill_count = pc.getqf("mob5_1_kill")
			if kill_count < 50 then
				pc.setqf("mob5_1_kill", kill_count + 1)
				
				local total_remain = main_quest_lv90.kill_count()
				if total_remain == 0 then
					notice_multiline(gameforge.main_quest_lv90._780_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._780_2_notice,notice)
					set_state (state5_3)
				end
			end
		end
		when 3202.kill begin
			local kill_count = pc.getqf("mob5_2_kill")
			if kill_count < 40 then
				pc.setqf("mob5_2_kill", kill_count + 1)
				
				local total_remain = main_quest_lv90.kill_count()
				if total_remain == 0 then
					notice_multiline(gameforge.main_quest_lv90._780_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._780_2_notice,notice)
					set_state (state5_3)
				end
			end
		end
		when 3204.kill begin
			local kill_count = pc.getqf("mob5_3_kill")
			if kill_count < 20 then
				pc.setqf("mob5_3_kill", kill_count + 1)
				
				local total_remain = main_quest_lv90.kill_count()
				if total_remain == 0 then
					notice_multiline(gameforge.main_quest_lv90._780_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._780_2_notice,notice)
					set_state (state5_3)
				end
			end
		end
		when 3205.kill begin
			local kill_count = pc.getqf("mob5_4_kill")
			if kill_count < 10 then
				pc.setqf("mob5_4_kill", kill_count + 1)
				
				local total_remain = main_quest_lv90.kill_count()
				if total_remain == 0 then
					notice_multiline(gameforge.main_quest_lv90._780_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv90._780_2_notice,notice)
					set_state (state5_3)
				end
			end
		end
	end
	-- 퀘스트 완료
	state state5_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv90._690_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
			q.set_counter_name("")
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._690_sendLetter)
			say(gameforge.main_quest_lv90._820_say)

		end
		
		when 20378.chat.gameforge.main_quest_lv90._690_sendLetter begin
			target.delete("__TARGET__")
			
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._790_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._800_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv90._810_say)
			wait()
			
			--보상
			say_title(locale.reward)
			say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 12933740))
			say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 170000))
			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30023),1,locale.count_postfix))
			say("")
			
			pc.give_exp2(12933740)
			pc.change_money(170000)
			pc.give_item2(30023, 1)
			
			set_state (state6_1)
		end
	end
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	-----------------<6> 명시진의 방벽 강화1-1-----------------
	state state6_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._850_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._850_sendLetter)
			say(gameforge.main_quest_lv90._860_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._870_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._880_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._890_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._900_say)
			
			set_state (state6_2)
		end
	end
	state state6_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._850_sendLetter)
			q.set_counter_name(gameforge.main_quest_lv90._1180_say)
		end
		when button or info begin
			-- if pc.get_map_index() == 1 then
				-- addmapsignal(500 * 100, 500 * 100)
				-- addmapsignal(600 * 100, 500 * 100)
				-- addmapsignal(700 * 100, 300 * 100)
			-- end
			
			say_title(gameforge.main_quest_lv90._910_sayTitle)
			say(gameforge.main_quest_lv90._920_say)
			say_item_vnum(31027)
			say(gameforge.main_quest_lv90._1180_say)
			local remain =  50 - pc.count_item(31027)
			if remain < 0 then
				remain = 0
			end
			q.set_counter_value(remain)
			say_reward(string.format( gameforge.main_quest_lv90._1190_say,item_name(31027), remain))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
		
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			if pc.count_item(31027) >= 50 then
				pc.remove_item ( 31027, pc.count_item(31027))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._960_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 14425740))
				--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30006),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50707),5,locale.count_postfix))
				say("")
				
				pc.give_exp2(14425740)
				--pc.change_money(0)
				pc.give_item2(30006, 1)
				pc.give_item2(50707, 5)
				
				set_state (state7_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._930_say)
			end
		end
		
		when 3001.kill or 3002.kill or 3003.kill or 3004.kill or 3005.kill or 3090.kill or 3091.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31027) < 50 then
					pc.give_item2(31027, 1)
					
					local remain =  50 - pc.count_item(31027)
					if remain < 0 then
						remain = 0
					end
					q.set_counter_value(remain)
					
					if pc.count_item(31027) >= 50 then
						notice_multiline(gameforge.main_quest_lv90._940_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._940_2_notice,notice)
						set_state (state6_3)
					end
				end
			end
		end
	end
	-- 퀘스트 완료
	state state6_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv90._850_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
			q.set_counter_name("")
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._850_sendLetter)
			say(gameforge.main_quest_lv90._520_say)
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3001.kill or 3002.kill or 3003.kill or 3004.kill or 3005.kill or 3090.kill or 3091.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31027) < 50 then
					pc.give_item2(31027, 1)
					
					local remain =  50 - pc.count_item(31027)
					if remain < 0 then
						remain = 0
					end
					
					if pc.count_item(31027) >= 50 then
						notice_multiline(gameforge.main_quest_lv90._940_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._940_2_notice,notice)
					end
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31027) >= 50 then
				pc.remove_item ( 31027, pc.count_item(31027))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._960_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 14425740))
				--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30006),1,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50707),5,locale.count_postfix))
				say("")
				
				pc.give_exp2(14425740)
				--pc.change_money(0)
				pc.give_item2(30006, 1)
				pc.give_item2(50707, 5)
				
				set_state (state7_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._930_say)
				
				set_state (state6_2)
			end
		end
	end
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	-----------------<7> 명시진의 방벽 강화1-2-----------------
	state state7_1 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._970_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv90._970_sendLetter)
			say(gameforge.main_quest_lv90._980_say)
		end
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv90._990_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv90._1000_say)
			
			set_state (state7_2)
		end
	end
	state state7_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv90._970_sendLetter)
			q.set_counter_name(gameforge.main_quest_lv90._1180_say)
		end
		when button or info begin
			-- if pc.get_map_index() == 1 then
				-- addmapsignal(500 * 100, 500 * 100)
				-- addmapsignal(600 * 100, 500 * 100)
				-- addmapsignal(700 * 100, 300 * 100)
			-- end
			
			say_title(gameforge.main_quest_lv90._1020_sayTitle)
			say(gameforge.main_quest_lv90._1030_say)
			say_item_vnum(31028)
			say(gameforge.main_quest_lv90._1180_say)
			local remain =  100 - pc.count_item(31028)
			if remain < 0 then
				remain = 0
			end
			q.set_counter_value(remain)
			say_reward(string.format(gameforge.main_quest_lv90._1190_say,item_name(31028), remain))
			-- say_reward(gameforge.main_quest_lv90._1170_posInfo)
			
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			if pc.count_item(31028) >= 100 then
				pc.remove_item ( 31028, pc.count_item(31028))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._1060_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 14922580))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 192000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30015),2,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(70043),1,locale.count_postfix))
				say("")
				say_title(gameforge.main_quest_lv90._1200_say)
				
				pc.give_exp2(14922580)
				pc.change_money(192000)
				pc.give_item2(30015, 2)
				pc.give_item2_select(70043)
				item.set_socket(2, 120)
				
				clear_letter()
				set_quest_state ("main_quest_lv91", "state0")
				set_state (__COMPLETE__)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._1010_say)
			end
		end
		
		when 3201.kill or 3202.kill or 3203.kill or 3204.kill or 3205.kill or 3290.kill or 3291.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31028) < 100 then
					pc.give_item2(31028, 1)
					
					local remain =  100 - pc.count_item(31028)
					if remain < 0 then
						remain = 0
					end
					q.set_counter_value(remain)
					
					if pc.count_item(31028) >= 100 then
						notice_multiline(gameforge.main_quest_lv90._1040_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._1040_2_notice,notice)
						set_state (state7_3)
					end
				end
			end
		end
	end
	-- 퀘스트 완료
	state state7_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv90._970_sendLetter)
			
			local v = find_npc_by_vnum(20378)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20378))
			end
			q.set_counter_name("")
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv90._970_sendLetter)
			say(gameforge.main_quest_lv90._1050_say)
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3201.kill or 3202.kill or 3203.kill or 3204.kill or 3205.kill or 3290.kill or 3291.kill begin
			if number(1,200) == 1 then
				if pc.count_item(31028) < 100 then
					pc.give_item2(31028, 1)
					
					local remain =  100 - pc.count_item(31028)
					if remain < 0 then
						remain = 0
					end
					
					if pc.count_item(31028) >= 100 then
						notice_multiline(gameforge.main_quest_lv90._1040_1_notice,notice)
						notice_multiline(gameforge.main_quest_lv90._1040_2_notice,notice)
					end
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv90._010_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31028) >= 100 then
				pc.remove_item ( 31028, pc.count_item(31028))	
				
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._1060_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 14922580))
				say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 192000))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30015),2,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(70043),1,locale.count_postfix))
				say("")
				say_title(gameforge.main_quest_lv90._1200_say)
				
				pc.give_exp2(14922580)
				pc.change_money(192000)
				pc.give_item2(30015, 2)
				pc.give_item2_select(70043)
				item.set_socket(2, 120)
				
				clear_letter()
				set_quest_state ("main_quest_lv91", "state0")
				set_state (__COMPLETE__)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv90._1010_say)
				
				set_state (state7_2)
			end
		end
	end
	
	state __COMPLETE__ begin
		when enter begin
			q.done()
		end
	end
end
