quest main_quest_lv7 begin
	state start begin
	end
	state run begin
		when login or levelup or enter with pc.get_level() >= 7 begin
			set_state ( gotosmith )		
		end
	end
	state gotosmith begin
		when letter begin
			local v=find_npc_by_vnum(20016)
			if 0==v then
			else
				target.vid("__TARGET__", v, gameforge.main_quest_lv7._10_targetVid)
			end
		end
		when letter begin
			send_letter(gameforge.main_quest_lv7._10_targetVid)
		end
		when button or info begin
			say_title(gameforge.main_quest_lv7._10_targetVid)
				    		----------                                                   l
		  	say(gameforge.main_quest_lv7._20_sayReward)
		end
		when __TARGET__.target.click begin
			target.delete("__TARGET__")
	    	---                                                   l
			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.main_quest_lv7._30_say)
			wait()

	    		---                                                   l
  			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.main_quest_lv7._40_say)
			say_item(gameforge.main_quest_lv7._50_sayItem, 27490, "")
						wait()
  			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.main_quest_lv7._60_say)
			set_state ( gotofisher )
			q.done()
		end
	end


	state gotofisher begin
		when letter begin
			send_letter(gameforge.main_quest_lv7._70_sendLetter)
		end
		when button or info begin
			say_title(gameforge.main_quest_lv7._70_sendLetter)
				    	---                                                   l
			say(gameforge.main_quest_lv7._80_sayReward)
			say_item(gameforge.main_quest_lv7._50_sayItem, 27490, "")
					end
		when 20016.chat.gameforge.main_quest_lv7._90_npcChat begin
			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.main_quest_lv7._100_say)
		end
		when 9009.chat.gameforge.main_quest_lv7._110_npcChat begin
			say_title(gameforge.fisher._30_sayTitle)
			say(gameforge.main_quest_lv7._120_say)
			wait()
			say_title(gameforge.fisher._30_sayTitle)
				    		---                                                   l
			say(gameforge.main_quest_lv7._130_say)
			wait()

			say_title(gameforge.fisher._30_sayTitle)
			say(gameforge.main_quest_lv7._140_say)
			say_item(gameforge.main_quest_lv7._150_sayItem, 30001, "")
						set_state ( gotosmith2 )
		end
	end
	state gotosmith2 begin
		when letter begin
			local v=find_npc_by_vnum(20016)
			if 0==v then
			else
				target.vid("__TARGET__", v, gameforge.main_quest_lv6._200_sendLetter)
			end
		end
		when letter begin
			send_letter(gameforge.main_quest_lv6._200_sendLetter)
		end
		when button or info begin
			say_title(gameforge.main_quest_lv6._200_sendLetter)
				    	---                                                   l
			say(gameforge.main_quest_lv7._160_sayReward)
			say_item(gameforge.main_quest_lv7._150_sayItem, 30001, "")
		end
		when __TARGET__.target.click begin
			target.delete("__TARGET__")
		
			pc.setqf("refine_chance",0)
			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.main_quest_lv7._170_say)
			pc.change_money(5000)
			clear_letter()
			set_state (__COMPLETE__)
			set_quest_state("main_quest_lv9", "run")
		end
	end
	state refine begin
		when login with pc.getqf("refine_chance") == 0 begin
			clear_letter()
			set_state ( __COMPLETE__ )
		end
		when letter begin
			send_letter(gameforge.main_quest_lv7._180_sendLetter)
		end
		when button or info begin
			if pc.getqf("refine_chance") > 0 then
				say_title(gameforge.buy_fishrod._210_sayTitle)
									  ---                                                   l
				say_reward(gameforge.main_quest_lv7._190_sayReward)
				say_item(gameforge.main_quest_lv7._200_sayItem, 30001, "")
								wait()
				say_title(gameforge.main_quest_lv7._210_sayTitle)
								say_reward(gameforge.main_quest_lv7._220_sayReward)
							else
				say_title(gameforge.main_quest_lv7._230_sayTitle)
								say_reward(gameforge.main_quest_lv7._240_sayReward)

								clear_letter()
				set_state (__COMPLETE__)
				set_quest_state("main_quest_lv9", "run")
			end
		end
	end
	state __COMPLETE__ begin
	end
end
