quest main_quest_lv91 begin
	state start begin
	end
	state state0 begin
		when login or levelup or enter with pc.level >= 91 begin
			set_state (state1_1)
		end
	end
	
	
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	-----------------<1> 초마단의 서신을 찾아라!1-1-----------------
	state state1_1 begin 
		when letter begin 
			send_letter (gameforge.main_quest_lv91._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_lv91._010_sendLetter)
			say(gameforge.main_quest_lv91._020_say)
			
		end
		
		when 20378.chat.gameforge.main_quest_lv91._010_sendLetter  begin 
			target.delete("__TARGET__")
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._030_say)
			wait()
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._050_say)
			wait()
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._060_say)
			wait()
			
			set_state (state1_2)
		end
	end
	state state1_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._010_sendLetter)
			--q.set_counter_name(locale.main_quest_lv91.remain_mob)
		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_lv91._070_sayTitle)
			say(gameforge.main_quest_lv91._080_say)
			
			-- say()
			-- say_reward(locale.main_quest_lv91.pos_info)
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
			--say_title(gameforge.main_quest_lv91._760_say)
			--local remain = 10 - pc.getqf("mob1_1_killed")
			--if remain < 0 then
			--	remain = 0
			--end
			--q.set_counter_value(remain)
			--say_title(string.format(gameforge.main_quest_lv91._770_say,mob_name(3205),remain))
		end
		
		--[[
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv91._010_sendLetter begin
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._520_say)
		end
		--]]
		
		when 3205.kill begin
			local mob1_1_killed = pc.getqf("mob1_1_killed")
			if mob1_1_killed < 10 then
				pc.setqf("mob1_1_killed", mob1_1_killed + 1)
				
				local remain = 10 - pc.getqf("mob1_1_killed")
				if remain < 0 then
					remain = 0
				end
				--q.set_counter_value(remain)
				
				if remain == 0 then
					say_title(mob_name(3205))
					say(gameforge.main_quest_lv91._100_say)
				
					notice_multiline(gameforge.main_quest_lv91._090_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv91._090_2_notice,notice)
					set_state (state1_3)
				end
			end
		end
	end
	state state1_3 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._010_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_lv91._010_sendLetter)
			say(gameforge.main_quest_lv91._110_say)
			
		end
		
		when 20378.chat.gameforge.main_quest_lv91._010_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._120_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._130_say)
			wait()
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._150_say)
			wait()
			
			--보상
			say_title(locale.reward)
			say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 18803050))
			--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30051),1,locale.count_postfix))
			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50814),10,locale.count_postfix))
			say("")
			
			pc.give_exp2(18803050)
			--pc.change_money(0)
			pc.give_item2(30051, 1)
			pc.give_item2(50814, 10)
			
			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_lv91._160_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_lv91._160_sendLetter)
			say(gameforge.main_quest_lv91._170_say)
			
		end
		when 20378.chat.gameforge.main_quest_lv91._160_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._180_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._190_say)
			
			set_state (state2_2)
		end
	end
	state state2_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._160_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_lv91._200_sayTitle)
			say(gameforge.main_quest_lv91._210_say)
			say_item_vnum(31075)

			-- say()
			-- say_reward(locale.main_quest_lv91.pos_info)
			-- say()
			-- say()
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20378.chat.gameforge.main_quest_lv91._160_sendLetter begin
			say_title(mob_name(20378))
			say(gameforge.main_quest_lv91._220_say)
		end
		
		when 3291.kill begin
			if number(1,500) == 1 then
				if pc.count_item(31075) < 1 then
					notice_multiline(gameforge.main_quest_lv91._230_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv91._230_2_notice,notice)
					pc.give_item2(31075, 1)
					set_state (state2_3)
				end
			end
		end
	end
	-- 퀘스트 완료
	state state2_3 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._160_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_lv91._160_sendLetter)
			say(gameforge.main_quest_lv91._240_say)
			
		end
		
		-- 중간에 퀘스트 아이템을 버릴 경우를 대비한 부분.
		when 3291.kill begin
			if number(1,500) == 1 then
				if pc.count_item(31075) < 1 then
					notice_multiline(gameforge.main_quest_lv91._230_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv91._230_2_notice,notice)
					pc.give_item2(31075, 1)
				end
			end
		end
		
		when 20378.chat.gameforge.main_quest_lv91._160_sendLetter begin
			target.delete("__TARGET__")
			
			if pc.count_item(31075) >= 1 then
				pc.remove_item ( 31075, pc.count_item(31075))	
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv91._250_say)
				wait()
			
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv91._260_say)
				wait()
				
				--보상
				say_title(locale.reward)
				say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 24873650))
				--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(50722),20,locale.count_postfix))
				say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(72016),1,locale.count_postfix))
				say("")
				
				pc.give_exp2(24873650)
				--pc.change_money(0)
				pc.give_item2(50722, 20)
				pc.give_item2_select(72016)
				item.set_socket(2, 120)
				
				set_state (state3_1)
			else
				say_title(mob_name(20378))
				say(gameforge.main_quest_lv91._220_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_lv91._270_sendLetter)
			
			local v = find_npc_by_vnum(20380)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20380))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv91._270_sendLetter)
			say(gameforge.main_quest_lv91._280_say)
			
		end
		when 20380.chat.gameforge.main_quest_lv91._270_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._290_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._300_say)
			wait()
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._310_say)
			wait()
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._320_say)
			wait()
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._330_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._340_say)
			
			set_state (state3_2)
		end
	end
	state state3_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._270_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_lv91._350_sayTitle)
			say(gameforge.main_quest_lv91._360_say)
			say_item_vnum(31018)
			say(gameforge.main_quest_lv90._1180_say)
			local remain = 10 - pc.getqf("item3_1_checked")
			if remain < 0 then
				remain = 0
			end
			q.set_counter_value(remain)
			say_reward(string.format(gameforge.main_quest_lv90._1190_say,item_name(31018),remain))
			
			-- say()
			-- say_reward(locale.main_quest_lv91.pos_info)
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20380.chat.gameforge.main_quest_lv91._270_sendLetter with pc.count_item(31018) > 0  begin
			if pc.count_item(31018) > 0 then
				pc.remove_item(31018, 1)
				
				if number(1, 100 ) <= 70 then -- 납품 성공
					say_title(mob_name(20380 ))
					say(gameforge.main_quest_lv91._380_say)
					pc.setqf("item3_1_checked", pc.getqf("item3_1_checked") + 1)
					
					local remain = 10 - pc.getqf("item3_1_checked")
					if remain < 0 then
						remain = 0
					end
					q.set_counter_value(remain)
					
					if pc.getqf("item3_1_checked") >= 10 then -- 납품 갯수 달성
						pc.remove_item(31018, pc.count_item(31018))
						
						wait()
						
						say_title(mob_name(20380 ))
						say(gameforge.main_quest_lv91._390_say)
						wait()
						
						--보상
						say_title(locale.reward)
						say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 25805450))
						say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 214000))
						say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30009),2,locale.count_postfix))
						say("")
						
						pc.give_exp2(25805450)
						pc.change_money(214000)
						pc.give_item2(30009, 2)
						
						set_state (state4_1)
						q.set_counter_name("")
					else  -- 납품 갯수 미달
						say(string.format(gameforge.main_quest_lv91._400_say,remain))
					end
				else -- 납품 실패
					say_title(mob_name(20380 ))
					say(gameforge.main_quest_lv91._370_say)
				end
				
			end
		end
		
		when 3601.kill or 3602.kill or 3603.kill or 3604.kill or 3605.kill begin
			if number(1,300) == 1 then
					pc.give_item2(31018, 1)
					
					notice_multiline(gameforge.main_quest_lv91._410_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv91._410_2_notice,notice)
			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_lv91._420_sendLetter)
			
			local v = find_npc_by_vnum(20380)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20380))
			end
		end
		when button or info begin
			say_title(gameforge.main_quest_lv91._420_sendLetter)
			say(gameforge.main_quest_lv91._430_say)
			
		end
		when 20380.chat.gameforge.main_quest_lv91._420_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._440_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._450_say)
			wait()
			
			say_title(mob_name(20380 ))
			say(gameforge.main_quest_lv91._460_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._470_say)
			
			set_state (state4_2)
		end
	end
	state state4_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._420_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_lv91._480_sayTitle)
			say(gameforge.main_quest_lv91._490_say)
			say_item_vnum(31019)
			say(gameforge.main_quest_lv90._1180_say)
			local remain = 3 - pc.getqf("item4_1_checked")
			if remain < 0 then
				remain = 0
			end
			q.set_counter_value(remain)
			say_reward(string.format(gameforge.main_quest_lv90._1190_say,item_name(31019),remain))

			-- say()
			-- say_reward(locale.main_quest_lv91.pos_info)
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		--클리어 전--
		when 20380.chat.gameforge.main_quest_lv91._420_sendLetter with pc.count_item(31019) > 0  begin
			if pc.count_item(31019) > 0 then				
				local cur_t = get_global_time() - 60 * 60 * 9
				local today_date = cur_t - math.mod(cur_t,86400)
				
				local last_checked_date = pc.getqf("last_checked_date")
				
				if today_date ~= last_checked_date then
					pc.setqf("last_checked_date", today_date)
					pc.setqf("today_item4_1_checked",0)
				end
				
				local today_item4_1_checked = pc.getqf("today_item4_1_checked")
				if today_item4_1_checked >= 1 then 					--1일 납품 갯수 초과
					say_title(mob_name(20380 ))
					say(gameforge.main_quest_lv91._500_say)
				else																									-- 납품 시도.
					pc.remove_item(31019, 1)
					
					if number(1, 100 ) <= 70 then -- 납품 성공
						say_title(mob_name(20380 ))
						say(gameforge.main_quest_lv91._510_say)
						pc.setqf("item4_1_checked", pc.getqf("item4_1_checked") + 1)
						pc.setqf("today_item4_1_checked", pc.getqf("today_item4_1_checked") + 1)
						
						local remain = 3 - pc.getqf("item4_1_checked")
						if remain < 0 then
							remain = 0
						end
						q.set_counter_value(remain)
						
						if pc.getqf("item4_1_checked") >= 3 then -- 납품 갯수 달성
							pc.remove_item(31019, pc.count_item(31019))
							
							wait()
							
							say_title(mob_name(20380 ))
							say(gameforge.main_quest_lv91._520_say)
							wait()
							
							--보상
							say_title(locale.reward)
							say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 27874000))
							say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 225000))
							say("")
							
							pc.give_exp2(27874000)
							pc.change_money(225000)
							
							set_state (state5_1)
							q.set_counter_name("")
						else 																						-- 납품 갯수 미달
							say(string.format(gameforge.main_quest_lv91._530_say,remain))
						end
					else																	-- 납품 실패
						say_title(mob_name(20380 ))
						say(gameforge.main_quest_lv91._540_say)
					end
				end
			end
		end
		
		when 3690.kill or 3691.kill begin
			if number(1,300) == 1 then
					pc.give_item2(31019, 1)
					
					notice_multiline(gameforge.main_quest_lv91._550_1_notice,notice)
					notice_multiline(gameforge.main_quest_lv91._550_2_notice,notice)
			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_lv91._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_lv91._560_sendLetter)
			say(gameforge.main_quest_lv91._570_say)
			
		end
		when 20378.chat.gameforge.main_quest_lv91._560_sendLetter begin
			target.delete("__TARGET__")
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv91._580_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv91._590_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._600_say)
			wait()
			
			say_title(mob_name(20378 ))
			say(gameforge.main_quest_lv91._610_say)
			
			set_state (state5_2)
		end
	end
	state state5_2 begin
		when letter begin
			send_letter(gameforge.main_quest_lv91._560_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_lv91._620_sayTitle)
			say(gameforge.main_quest_lv91._630_say)
			say_item_vnum(31020)

			-- say()
			-- say_reward(locale.main_quest_lv91.pos_info)
			-- select(gameforge.main_quest_lv90._950_say)
			-- setskin(NOWINDOW)
			-- clearmapsignal()
		end
		
		when 20382.click begin
			if pc.count_item(31020) < 1 then
				pc.give_item2(31020, 1)
				notice_multiline(gameforge.main_quest_lv91._640_1_notice,notice)

				set_state (state5_3)
			end
		end
		when 20380.chat.gameforge.main_quest_lv91._560_sendLetter with pc.count_item(31020) >= 1 begin
			target.delete("__TARGET__")
			pc.remove_item(31020, pc.count_item(31020))
			
			say_title(mob_name(20380))
			say(gameforge.main_quest_lv91._650_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._660_say)
			wait()
			
			say_title(mob_name(20380))
			say(gameforge.main_quest_lv91._670_say)
			wait()
			
			--보상
			say_title(locale.reward)
			say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 6766050))
			--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30045),2,locale.count_postfix))
			say("")
			say_title(gameforge.main_quest_lv91._780_say)
			
			pc.give_exp2(6766050)
			--pc.change_money(0)
			pc.give_item2(30045, 2)
			
			clear_letter()
			set_quest_state ("main_quest_lv92", "state0")
			set_state (__COMPLETE__)
		end
	end
	-- 퀘스트 완료
	state state5_3 begin
	
		when letter begin
			send_letter(gameforge.main_quest_lv91._560_sendLetter)
			
			local v = find_npc_by_vnum(20380)
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(20380))
			end
		end
		
		when button or info begin
			say_title(gameforge.main_quest_lv91._560_sendLetter)
			say(gameforge.main_quest_lv91._680_say)
			
		end
		
		-- 아이템 분실 대비.
		when 20382.click begin
			if pc.count_item(31020) < 1 then
				pc.give_item2(31020, 1)
				notice_multiline(gameforge.main_quest_lv91._640_1_notice,notice)
			end
		end
		
		when 20380.chat.gameforge.main_quest_lv91._560_sendLetter with pc.count_item(31020) >= 1 begin
			target.delete("__TARGET__")
			pc.remove_item(31020, pc.count_item(31020))
			
			say_title(mob_name(20380))
			say(gameforge.main_quest_lv91._650_say)
			wait()
			
			say_title(pc.getname())
			say(gameforge.main_quest_lv91._660_say)
			wait()
			
			say_title(mob_name(20380))
			say(gameforge.main_quest_lv91._670_say)
			wait()
			
			--보상
			say_title(locale.reward)
			say_reward(string.format (gameforge.main_quest_lv60._190_sayReward, 6766050))
			--say_reward(string.format (gameforge.main_quest_lv60._200_sayReward, 0))
			say_reward(string.format (gameforge.main_quest_lv60._210_sayReward, item_name(30045),2,locale.count_postfix))
			say("")
			say_title(gameforge.main_quest_lv91._780_say)
			
			pc.give_exp2(6766050)
			--pc.change_money(0)
			pc.give_item2(30045, 2)
			
			clear_letter()
			set_quest_state ("main_quest_lv92", "state0")
			set_state (__COMPLETE__)
		end
	end
	
	state __COMPLETE__ begin
		when enter begin
			q.done()
		end
	end
end
