quest subquest_4 begin
	state start begin
		when login or levelup with pc.level >= 9 and pc.level <= 14 begin
			set_state(information)
		end
	end

	state information begin
		when letter begin
			local v = find_npc_by_vnum(20016)
			if v != 0 then
				target.vid("__TARGET__", v, gameforge.subquest_04._10_targetVid)
			end
		end
		when __TARGET__.target.click or	20016.chat.gameforge.subquest_04._10_targetVid with pc.level >= 9 begin
			target.delete("__TARGET__")

			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.subquest_04._20_say)
			wait()

			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.subquest_04._30_say)
			say_item_vnum(30131)
			wait()

			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.subquest_04._40_say)

			local s= select(gameforge.subquest_04._50_select, gameforge.subquest_04._60_select)
			if 2==s then
				say(gameforge.subquest_04._70_say)
				local a= select(gameforge.locale.guild.yes, gameforge.locale.guild.no)
				if  2==a then
					say_title(gameforge.blacksmith._20_sayTitle)
					say(gameforge.subquest_04._80_say)
					return
				end
				say_title(gameforge.blacksmith._20_sayTitle)
				say(gameforge.subquest_04._90_say)

				clear_letter()
				set_state(__GIVEUP__)
				return
			end

			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.subquest_04._100_say)
			pc.give_item2("30131", 1)
			say_item_vnum(30131)
			set_state(deliver_letter)

		end
	end

	state deliver_letter begin
		when info or button begin
			say_title(gameforge.buy_fishrod._210_sayTitle)
						say_reward(gameforge.subquest_04._110_sayReward)
					end

		when letter begin
			send_letter(gameforge.subquest_04._120_sendLetter)
			
			local v=find_npc_by_vnum(20015)
			if 0==v then
			else
				target.vid("__TARGET__",v, gameforge.subquest_04._130_targetVid)
			end
		end

		when __TARGET__.target.click or	20015.chat.gameforge.subquest_04._140_npcChat begin
			if pc.count_item(30131) >= 1 then
				target.delete("__TARGET__")

				say_title(gameforge.subquest_04._150_sayTitle)
				say(gameforge.subquest_04._160_say)
				wait()

				say_title(gameforge.subquest_04._150_sayTitle)
				say(gameforge.subquest_04._170_say)
				pc.remove_item("30131", 1)

				set_state(return_to)

			else
				say_title(gameforge.subquest_04._150_sayTitle)
				say(gameforge.subquest_04._180_say)
				local s= select(gameforge.subquest_04._190_select, gameforge.subquest_04._200_select)
				if 2==s then
					say(gameforge.subquest_04._210_say)

					local a= select(gameforge.locale.guild.yes, gameforge.locale.guild.no)
					if 2==a then
						say_title(gameforge.mining._10_sayTitle)
						say(gameforge.subquest_04._220_say)
						return
					end
					say_title(gameforge.mining._10_sayTitle)
					say(gameforge.subquest_04._230_say)
					clear_letter()
					set_state(__GIVEUP__)
					return
				end
				say_title(gameforge.mining._10_sayTitle)
				say(gameforge.subquest_04._240_say)
				set_state(information)

			end
		end
	end

	state return_to begin
		when info or button begin
			say_title(gameforge.blacksmith._40_sayTitle)
						say_reward(gameforge.subquest_04._250_sayReward)
					end

		when letter begin
			local v=find_npc_by_vnum(20016)
			if 0==v then
			else
				target.vid("__TARGET__", v, gameforge.subquest_04._260_targetVid)
			end
		
			send_letter(gameforge.subquest_04._260_targetVid)
		end

		when 20016.chat.gameforge.subquest_04._270_npcChat begin
			target.delete("__TARGET__")
			say_title(gameforge.blacksmith._20_sayTitle)
			say(gameforge.subquest_04._280_say)

			pc.give_exp2(4000)
			set_quest_state("levelup","run")
			pc.change_money(3000)

			say_title(gameforge.collect_herb_lv4._130_sayTitle)
						say_reward(gameforge.subquest_04._290_sayReward)
			
			clear_letter()
			set_state(__COMPLETE__)
		end
	end

	state __GIVEUP__ begin

	end

	state __COMPLETE__ begin
	end
end
