--2013.02.12 김용욱

--퀘스트 진행 npc
define YACKHWAN 	20377 -- 약령도장 약환
define SCHOLAR 		20380 -- 학자
define ALCHEMIST 	20001 -- 연금술사
define BLACKSMITH 	20016 -- 대장장이
define YUHWAN		20017 -- 유환

define MOB1_1 6091 -- 염왕 야마천

define ITEM2_1 31082 -- 뜨거운 핵
define DUNGEON_MAP_INDEX 351

quest main_quest_flame_lv104 begin
	state start begin
	end
	state state0 begin
		when login or levelup or enter with pc.level >= 104 begin
			set_state (state1_1)
		end
	end
	
	-- 야마천 토벌 1-2
	state state1_1 begin 
		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._010_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(YACKHWAN) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(YACKHWAN))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._010_sendLetter) 
			say(gameforge.main_quest_flame_lv104._020_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when YACKHWAN.chat.gameforge.main_quest_flame_lv104._010_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._030_say) 
			wait()--추가 대화 

			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._040_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._050_say) 
			--다음 스테이트로
			set_state (state1_2)
		end

		when leave begin 
			--q.done()
		end
	end
	state state1_2 begin 
		when enter begin 
			--몬스터 처치 수 설정
			pc.setqf("kill_count_1", 0)
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._060_notice,notice)
		end
		

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._010_sendLetter) 
 			--남은 처치 수 안내문 
			q.set_counter_name(gameforge.main_quest_lv98._680_counterName)
			
			-- 파티원에 의해 야마천을 잡았을 때, 퀘스트가 클리어 되도록 하는 코드.
			if party.is_party() then
				local map_index = pc.get_map_index()
				-- 적룡성에 입장했다는 것을 기록함.
				if map_index >= DUNGEON_MAP_INDEX * 10000 and  map_index < (DUNGEON_MAP_INDEX + 1) *10000 then
					pc.setqf("in_dungeon", 1)
				else -- 적룡성으로 부터 나왔을때, 보스를 잡고 나왔으면 퀘스트를 클리어 해준다.
					if pc.getqf("in_dungeon") == 1 then
						if party.getf("flame_dungeon_boss_kill_count") == 1 then
							set_state (state1_3)
						end
						pc.setqf("in_dungeon", 0)
					end
				end
			end
			
			main_quest_flame_lv104.kill_count() 
		end
		
		when logout begin 
			if party.is_party() then
				if party.getf("flame_dungeon_boss_kill_count") == 0 then
					pc.setqf("in_dungeon", 0)
				end
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._070_sayTitle) 
			say(gameforge.main_quest_flame_lv104._080_say) 
			--남은 처치 수 안내문
			say(gameforge.main_quest_lv98._680_counterName)
			say(string.format(gameforge.main_quest_lv98._670_sayReward,mob_name(MOB1_1), 1 - pc.getqf("kill_count_1")))
			say_reward(gameforge.main_quest_flame_lv104._090_sayReward)
		end

		when YACKHWAN.chat.gameforge.main_quest_flame_lv104._010_sendLetter begin 
			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._100_say) 
		end
		
		
		when 31078.use begin -- 정화액
			affect.add(apply.MAX_HP, 1000, 60 * 60)
			affect.add(apply.DEF_GRADE_BONUS, 25, 60 * 60)
			affect.add(apply.MELEE_MAGIC_ATTBONUS_PER, 10, 60 * 60)
			pc.remove_item(31078,1)
		end

		when MOB1_1.kill begin
			local kill_count = pc.getqf("kill_count_1")
			pc.setqf("kill_count_1", kill_count+1)
			main_quest_flame_lv104.kill_count() 
		end

		function kill_count()
			local total_remain = 0
			local remain1 = 1 - pc.getqf("kill_count_1")
			if remain1 < 0 then
				remain1 = 0
			end
			total_remain = total_remain + remain1
			q.set_counter_value(total_remain)
			if total_remain == 0 then
				set_state ("state1_3")
			end
		end

		when leave begin 
			pc.setqf("kill_count_1", 0)
			pc.setqf("in_dungeon", 0)
			--q.done()
		end
	end
	state state1_3 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._120_notice,notice)
			
			say_title(mob_name(MOB1_1)) 
			say(gameforge.main_quest_flame_lv104._110_say) 
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._010_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(YACKHWAN) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(YACKHWAN))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._010_sendLetter) 
			say(gameforge.main_quest_flame_lv104._130_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when YACKHWAN.chat.gameforge.main_quest_flame_lv104._010_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._140_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._150_say) 
			wait()--추가 대화 

			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._160_say) 
			--보상
			wait()--reward

			say_reward(string.format(gameforge.main_quest_lv60._190_sayReward, 64491000))
			pc.give_exp2(64491000)
			say_reward(string.format(gameforge.main_quest_lv60._200_sayReward, 168000))
			pc.change_money(168000)
			say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(71095),1))
			pc.give_item2(71095, 1)
			say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(71026),1)) -- 현철
			pc.give_item2(71026, 1)
			say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(71025),2)) -- 야공석
			pc.give_item2(71025, 1)
			pc.give_item2(71025, 1)
			say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(70102),5)) -- 선두
			pc.give_item2(70102, 1)
			pc.give_item2(70102, 1)
			pc.give_item2(70102, 1)
			pc.give_item2(70102, 1)
			pc.give_item2(70102, 1)
			say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(50706),20)) -- 영지버섯
			pc.give_item2(50706, 20)
			say()
			--다음 스테이트로
			set_state (state2_1)
		end

		when leave begin 
			--q.done()
		end
	end
	
	-- 음모의 저지1-1
	state state2_1 begin 
		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._170_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(YACKHWAN) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(YACKHWAN))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._170_sendLetter) 
			say(gameforge.main_quest_flame_lv104._020_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when YACKHWAN.chat.gameforge.main_quest_flame_lv104._170_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._180_say) 
			wait()--추가 대화 

			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._190_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._050_say) 
			--다음 스테이트로
			set_state (state2_2)
		end

		when leave begin 
			--q.done()
		end
	end
	state state2_2 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._200_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._170_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(SCHOLAR) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(SCHOLAR))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._210_sayTitle) 
			say(gameforge.main_quest_flame_lv104._220_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when YACKHWAN.chat.gameforge.main_quest_flame_lv104._170_sendLetter begin 
			say_title(mob_name(YACKHWAN)) 
			say(gameforge.main_quest_flame_lv104._230_say) 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._170_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._240_say) 
			wait()--추가 대화 

			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._250_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._260_say) 
			wait()--추가 대화 

			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._270_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._050_say) 
			--다음 스테이트로
			set_state (state2_3)
		end

		when leave begin 
			--q.done()
		end
	end
	state state2_3 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._280_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._170_sendLetter) 
 			--아이템 지급 설정
			q.set_counter_name(gameforge.main_quest_lv97._670_counterName)
			main_quest_flame_lv104.item_count_state2_3() 
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._280_notice) 
			say(gameforge.main_quest_flame_lv104._290_say) 
			--남은 아이템 안내문
			say(gameforge.main_quest_lv97._670_counterName)
			local item_count = pc.getqf("item_count_1")
			local remain = 5 - item_count
			if remain < 0 then
				remain = 0
			end
			say(string.format(gameforge.main_quest_lv90._1190_say,item_name(ITEM2_1), remain))
			say_reward(gameforge.main_quest_flame_lv104._090_sayReward)
			main_quest_flame_lv104.item_count_state2_3() 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._170_sendLetter with pc.count_item(ITEM2_1) > 0 begin 
			pc.remove_item(ITEM2_1, 1)
			-- 납품 성공
			if number(1, 100) <= 90 then 
				local item_count = pc.getqf("item_count_1")
				item_count = item_count + 1
				pc.setqf("item_count_1", item_count)
				if  item_count < 5 then 				-- 아직 부족함.
					say_title(mob_name(SCHOLAR)) 
					say(string.format(gameforge.main_quest_flame_lv104._300_say, 5 - item_count)) 
				else								-- 납품 갯수를 모두 채움.
					pc.remove_item(ITEM2_1, pc.count_item(ITEM2_1))
					say_title(mob_name(SCHOLAR)) 
					say(gameforge.main_quest_flame_lv104._310_say) 
					wait()

					say_reward(string.format(gameforge.main_quest_lv60._190_sayReward, 57583000))
					pc.give_exp2(57583000)
					say_reward(string.format(gameforge.main_quest_lv60._200_sayReward, 170000))
					pc.change_money( 170000)
					say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(72723),1)) -- 화룡의 축복(소)
					pc.give_item2(72723, 1)
					say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(70050),1)) -- 선왕의 증표
					pc.give_item2(70050, 1)
					say()
					--다음 스테이트로
					set_state (state3_1)
				end
			else 				-- 납품 실패
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._320_say) 
			end
			
			main_quest_flame_lv104.item_count_state2_3() 
		end

		when 6005.kill begin
			if number(1,50) == 1 then
				pc.give_item2(ITEM2_1, 1)
				main_quest_flame_lv104.item_count_state2_3() 
			end
		end

		when 6006.kill begin
			if number(1,50) == 1 then
				pc.give_item2(ITEM2_1, 1)
				main_quest_flame_lv104.item_count_state2_3() 
			end
		end

		when 6007.kill begin
			if number(1,50) == 1 then
				pc.give_item2(ITEM2_1, 1)
				main_quest_flame_lv104.item_count_state2_3() 
			end
		end

		when 6008.kill begin
			if number(1,50) == 1 then
				pc.give_item2(ITEM2_1, 1)
				main_quest_flame_lv104.item_count_state2_3() 
			end
		end

		when 6009.kill begin
			if number(1,50) == 1 then
				pc.give_item2(ITEM2_1, 1)
				main_quest_flame_lv104.item_count_state2_3() 
			end
		end

		function item_count_state2_3()
			local item_count = pc.getqf("item_count_1")
			local remain = 5 - item_count
			if remain <= 0 then
				remain = 0
			end
			q.set_counter_value(remain)
		end

		when leave begin 
			pc.setqf("item_count_1", 0)
			--q.done()
		end
	end
	
	-- 음모의 저지1-2
	state state3_1 begin 
		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._330_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(SCHOLAR) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(SCHOLAR))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._330_sendLetter) 
			say(gameforge.main_quest_flame_lv104._340_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._330_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._350_say) 
			wait()--추가 대화 

			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._360_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._050_say)
			--다음 스테이트로
			set_state (state3_2)
		end

		when leave begin 
			--q.done()
		end
	end
	state state3_2 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._370_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._330_sendLetter) 
			q.set_counter_name(gameforge.main_quest_lv97._670_counterName)
 		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._280_notice) 
			say(gameforge.main_quest_flame_lv104._380_say) 
			say(gameforge.main_quest_lv97._670_counterName)			
			
			local remain1 = 100 - pc.count_item(50814)
			if remain1 < 0 then
				remain1 = 0
			end
			
			say(string.format(gameforge.main_quest_lv90._1190_say,item_name(50814) ,remain1))
			say()
			q.set_counter_value(remain1)
			
			if remain1 == 0 then
				set_state (state3_3)
			end
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._330_sendLetter begin 
			--아이템 제거
			if pc.count_item(50814) >= 100 then
				pc.remove_item(50814, 100) 
				
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._390_say) 
				wait()--추가 대화 

				say_title(pc.getname()) 
				say(gameforge.main_quest_flame_lv104._400_say) 
				wait()--추가 대화 

				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._410_say) 
				
				say_reward(string.format(gameforge.main_quest_lv60._190_sayReward, 46581000))
				pc.give_exp2(46581000)
				say_reward(string.format(gameforge.main_quest_lv60._200_sayReward, 171000))
				pc.change_money( 171000)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(30045),2)) -- 전갈의 독침
				pc.give_item2(30045, 2)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(50817),10)) -- 진활심액
				pc.give_item2(50817, 10)
				say()
				--다음 스테이트로
				set_state (state4_1)
			else
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._420_say) 
			end
		end

		when leave begin 
			--q.done()
		end
	end
	state state3_3 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._430_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._330_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(SCHOLAR) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(SCHOLAR))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._280_notice) 
			say(gameforge.main_quest_flame_lv104._440_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._330_sendLetter begin 
			target.delete("__TARGET__") 
			--아이템 제거
			if pc.count_item(50814) >= 100 then
				pc.remove_item(50814, 100) 
				
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._390_say) 
				wait()--추가 대화 

				say_title(pc.getname()) 
				say(gameforge.main_quest_flame_lv104._400_say) 
				wait()--추가 대화 

				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._410_say) 
				
				say_reward(string.format(gameforge.main_quest_lv60._190_sayReward, 46581000))
				pc.give_exp2(46581000)
				say_reward(string.format(gameforge.main_quest_lv60._200_sayReward, 171000))
				pc.change_money( 171000)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(30045),2)) -- 전갈의 독침
				pc.give_item2(30045, 2)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(50817),10)) -- 진활심액
				pc.give_item2(50817, 10)
				say()
					
				--다음 스테이트로
				set_state (state4_1)
			else
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._420_say) 
				
				set_state (state3_2)
			end
		end

		when leave begin 
			--q.done()
		end
	end
	
	-- 음모의 저지1-3
	state state4_1 begin 
		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._450_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(SCHOLAR) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(SCHOLAR))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._450_sendLetter) 
			say(gameforge.main_quest_flame_lv104._340_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._450_sendLetter begin 
			target.delete("__TARGET__") 
			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._460_say) 
			wait()--추가 대화 

			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._470_say) 
			wait()--추가 대화 

			say_title(pc.getname()) 
			say(gameforge.main_quest_flame_lv104._050_say) 
			--다음 스테이트로
			set_state (state4_2)
		end

		when leave begin 
			--q.done()
		end
	end
	state state4_2 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._480_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._450_sendLetter) 
 			--아이템 지급 설정
			q.set_counter_name(gameforge.main_quest_lv97._670_counterName)
			main_quest_flame_lv104.item_count_state4_2() 
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._450_sendLetter) 
			say(gameforge.main_quest_flame_lv104._490_say) 
			--남은 아이템 안내문
			say(gameforge.main_quest_lv97._670_counterName)
			local remain = 5 - pc.count_item(31024)
			if remain < 0 then
				remain = 0
			end
			say(string.format(gameforge.main_quest_lv90._1190_say,item_name(31024), remain))
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._450_sendLetter begin 
			say_title(mob_name(SCHOLAR)) 
			say(gameforge.main_quest_flame_lv104._500_say) 
		end

		when 3291.kill begin
			if number(1,1) == 1 then
				pc.give_item2(31024, 1)
				main_quest_flame_lv104.item_count_state4_2() 
			end
		end

		function item_count_state4_2()
			if pc.count_item(31024) >= 5 then
				set_state ("state4_3")
			end
			q.set_counter_value(5 - pc.count_item(31024))
		end

		when leave begin 
			--q.done()
		end
	end
	state state4_3 begin 
		when enter begin 
			-- notice 설정
			notice_multiline(gameforge.main_quest_flame_lv104._520_notice,notice)
		end

		when letter begin 
			send_letter(gameforge.main_quest_flame_lv104._450_sendLetter) 
 			--npc 타겟 
			local v = find_npc_by_vnum(SCHOLAR) 
			if 0 != v then
				target.vid("__TARGET__", v, mob_name(SCHOLAR))
			end
		end

		when button or info begin 
			say_title(gameforge.main_quest_flame_lv104._450_sendLetter) 
			say(gameforge.main_quest_flame_lv104._440_say) 
			--npc 타겟 안내문
			--say_reward(locale.target_npc_info) 
		end

		when SCHOLAR.chat.gameforge.main_quest_flame_lv104._450_sendLetter begin 
			target.delete("__TARGET__") 
			if pc.count_item(31024) < 5 then
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._500_say) 
				
				set_state (state4_2)
			else
				pc.remove_item(31024, 5)
				say_title(mob_name(SCHOLAR)) 
				say(gameforge.main_quest_flame_lv104._510_say) 
				
				wait()
				say_reward(string.format(gameforge.main_quest_lv60._190_sayReward, 45580000))
				pc.give_exp2( 45580000)
				say_reward(string.format(gameforge.main_quest_lv60._200_sayReward, 173000))
				pc.change_money(173000)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(71095),1))
				pc.give_item2(71095, 1)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(30015),2)) -- 사귀의 유품
				pc.give_item2(30015, 2)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(70043),1))  -- 도둑의 장갑
				pc.give_item2_select(70043)
				item.set_socket(2, 60)
				say_reward(string.format(gameforge.main_quest_lv60._210_sayReward, item_name(31083),3)) -- 금제 주머니
				pc.give_item2(31083, 3)
				
				say()
				say_title(string.format(gameforge.main_quest_flame_lv99._430_say, 105))
				--다음 스테이트로
				set_quest_state ("main_quest_flame_lv105", "state0")
				set_state (__COMPLETE__)
			end
		end

		when leave begin 
			--q.done()
		end
	end
	
	
	state __COMPLETE__ begin
		when enter begin
			--q.done()
		end
	end	
	
	
	
end