quest subquest_21 begin
	state start begin
		when login or levelup with pc.level >= 48 and pc.level <= 50 begin
			set_state(information)
		end
	end

	state information begin
		when letter begin
			local v=find_npc_by_vnum(20020)
			if 0==v then
			else
				target.vid("__TARGET__", v, gameforge.subquest_21._10_targetVid)
			end
		end

		when __TARGET__.target.click or	20020.chat.gameforge.subquest_21._20_npcChat  begin
			target.delete("__TARGET__")
			say_title(gameforge.subquest_21._30_sayTitle)
			say(gameforge.subquest_21._40_say)
			wait()
			say_title(gameforge.subquest_21._30_sayTitle)
			say(gameforge.subquest_21._50_say)
			local s= select(gameforge.subquest_21._60_select, gameforge.locale.years_greetings.select_2)
			if 2==s then
				say_title(gameforge.subquest_21._30_sayTitle)
				say(gameforge.subquest_21._70_say)
				local a= select(gameforge.locale.guild.yes, gameforge.locale.guild.no)
				if 2==a then
					say_title(gameforge.subquest_21._30_sayTitle)
					say(gameforge.subquest_21._80_say)
					return
				end
				say_title(gameforge.subquest_21._30_sayTitle)
				say(gameforge.subquest_21._90_say)
				set_state(__GIVEUP__)
				return
			end
			say_title(gameforge.subquest_21._30_sayTitle)
			say(gameforge.subquest_21._100_say)
			set_state(accept_request)


			end

		end


	state accept_request begin

		when letter begin
			send_letter(gameforge.subquest_21._110_sendLetter)

			if pc.count_item("30152")>0 then
				local v=find_npc_by_vnum(20020)
				if 0!= v then
					target.vid("__TARGET__",v, gameforge.subquest_21._120_targetVid)
				end
			end

		end


		when info or  button begin
			if pc.count_item("30152") >=1 then
				say_title(gameforge.subquest_21._120_targetVid)
				say(gameforge.subquest_21._130_sayReward)
				return
			end

			say_title(gameforge.subquest_21._140_sayTitle)
			say(gameforge.subquest_21._150_say)

		end



		when 903.kill with pc.getqf("kill_count")==0 begin

			local s = number(1, 100)
			if s <= 5 and  pc.count_item("30152") ==0  then
				pc.give_item2(30152, 1)
				pc.setqf("medicine_done",0)

			end
		end



		when  __TARGET__.target.click or	20020.chat.gameforge.subquest_21._160_npcChat with pc.count_item("30152") >=1  begin
			target.delete("__TARGET__")
			say_title(gameforge.subquest_21._30_sayTitle)
			say(gameforge.subquest_21._170_say)
			pc.remove_item("30152",1)

		    say_title(gameforge.subquest_21._180_sayTitle)
						say_reward(gameforge.subquest_21._190_sayReward)
						pc.change_money(30000)
			pc.give_exp2(1900000)


			clear_letter()
			set_state(COMPLETE)

		end

end

	state __GIVEUP__ begin
	end

	state COMPLETE begin
		when enter begin
			q.done()
		end
	end


end

