quest skill_group begin
	state start begin
		when login or levelup with pc.level>=5 and pc.skillgroup ==0 begin
			set_state(run)
		end
	end

	state run begin
		when login with pc.get_skill_group()!=0 begin
			restart_quest()
		end

		when letter with pc.get_skill_group()==0 begin

			send_letter(gameforge.skill_group._10_sendLetter)
			local job=pc.get_job()

			if job==0 then
				local v=pc_find_skill_teacher_vid(1)
				if 0!=v then target.vid("teacher1", v, gameforge.skill_group._20_targetVid) end
				local v=pc_find_skill_teacher_vid(2)
				if 0!=v then target.vid("teacher2", v, gameforge.skill_group._30_targetVid) end
			elseif job==1 then
				local v=pc_find_skill_teacher_vid(1)
				if 0!=v then target.vid("teacher3", v, gameforge.skill_group._40_targetVid) end
				local v=pc_find_skill_teacher_vid(2)
				if 0!=v then target.vid("teacher4", v, gameforge.skill_group._50_targetVid) end
			elseif job==2 then
				local v=pc_find_skill_teacher_vid(1)
				if 0!=v then target.vid("teacher5", v, gameforge.skill_group._60_targetVid) end
				local v=pc_find_skill_teacher_vid(2)
				if 0!=v then target.vid("teacher6", v, gameforge.skill_group._70_targetVid) end
			elseif job==3 then
				local v=pc_find_skill_teacher_vid(1)
				if 0!=v then target.vid("teacher7", v, gameforge.skill_group._80_targetVid) end
				local v=pc_find_skill_teacher_vid(2)
				if 0!=v then target.vid("teacher8", v, gameforge.skill_group._90_targetVid) end
			clear_letter()
			end
		end

		when leave begin
			target.delete("teacher1")
			target.delete("teacher2")
			target.delete("teacher3")
			target.delete("teacher4")
			target.delete("teacher5")
			target.delete("teacher6")
			target.delete("teacher7")
			target.delete("teacher8")
		end

		when button or info begin
			if pc.job == 0 then
				say_title(gameforge.skill_group._100_sayTitle)
				say(gameforge.skill_group._110_sayReward)
			elseif pc.job == 1 then
				say_title(gameforge.skill_group._120_sayTitle)
				say(gameforge.skill_group._130_sayReward)
			elseif pc.job == 2 then
				say_title(gameforge.skill_group._140_sayTitle)
				say(gameforge.skill_group._150_sayReward)
			elseif pc.job == 3 then
				say_title(gameforge.skill_group._160_sayTitle)
				say(gameforge.skill_group._170_sayReward)
			end

			 select(gameforge.locale.confirm)
			setskin(NOWINDOW)
		end

		when teacher1.target.click or skill_group1_1.chat.gameforge.skill_group._180_npcChat or	skill_group2_1.chat.gameforge.skill_group._180_npcChat or	skill_group3_1.chat.gameforge.skill_group._180_npcChat 	begin 
			target.delete("teacher1")

			local pc_job=pc.get_job()
			if pc_job != 0 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._200_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end

			say_title(gameforge.skill_group._250_sayTitle)
			say(gameforge.skill_group._260_say)
			say_reward(gameforge.skill_group._270_sayReward)


						local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)

			if 2 == s then
				return
			end

			if pc.get_job()!=0 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(1) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Lehrer löschen")

			say_title(gameforge.skill_group._310_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
				say_reward(gameforge.skill_group._340_sayReward)
			else
				say_reward(gameforge.skill_group._350_sayReward)
			end
			clear_letter()
		end

		when teacher2.target.click or skill_group1_2.chat.gameforge.skill_group._360_npcChat or	skill_group2_2.chat.gameforge.skill_group._360_npcChat or	skill_group3_2.chat.gameforge.skill_group._360_npcChat 	begin 
			target.delete("teacher2")

			local pc_job=pc.get_job()
			if pc_job != 0 then
				say_title(gameforge.skill_group._370_sayTitle)

				say(gameforge.skill_group._380_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._390_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end

			say_title(gameforge.skill_group._400_sayTitle)
			say(gameforge.skill_group._410_say)
			say_reward(gameforge.skill_group._270_sayReward)

						local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)

			if 2 == s then
				return
			end

			if pc.get_job()!=0 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(2)
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")


			say_title(gameforge.skill_group._420_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
				say_reward(gameforge.skill_group._340_sayReward)
			else
				say_reward(gameforge.skill_group._350_sayReward)
			end
			clear_letter()
		end


		when teacher3.target.click or skill_group1_3.chat.gameforge.skill_group._430_npcChat or	skill_group2_3.chat.gameforge.skill_group._430_npcChat or	skill_group3_3.chat.gameforge.skill_group._430_npcChat	begin 
			target.delete("teacher3")


			local pc_job=pc.get_job()
			if pc_job != 1 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._440_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end
			say_title(gameforge.skill_group._450_sayTitle)
			say(gameforge.skill_group._460_say)
			say_reward(gameforge.skill_group._470_sayReward)

						local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)

			if 2 == s then
				return
			end

			if pc.get_job()!=1 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(1) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")

			say_title(gameforge.skill_group._480_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				say(gameforge.skill_group._490_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
				say_reward(gameforge.skill_group._340_sayReward)
			else
				say_reward(gameforge.skill_group._350_sayReward)
			end
			clear_letter()
		end


		when teacher4.target.click or skill_group1_4.chat.gameforge.skill_group._500_npcChat or	skill_group2_4.chat.gameforge.skill_group._500_npcChat or	skill_group3_4.chat.gameforge.skill_group._500_npcChat	begin 
			target.delete("teacher4")

			local pc_job=pc.get_job()
			if pc_job != 1 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._510_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end

			say_title(gameforge.skill_group._520_sayTitle)
			say(gameforge.skill_group._530_say)
			say_reward(gameforge.skill_group._470_sayReward)
			local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)
			if 2 == s then
				return
			end

			if pc.get_job()!=1 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(2) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")

			say_title(gameforge.skill_group._540_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
				say_reward(gameforge.skill_group._340_sayReward)
			else
				say_reward(gameforge.skill_group._350_sayReward)
			end
			clear_letter()
		end


		when teacher5.target.click or skill_group1_5.chat.gameforge.skill_group._550_npcChat or	skill_group2_5.chat.gameforge.skill_group._550_npcChat or	skill_group3_5.chat.gameforge.skill_group._550_npcChat	begin 
			target.delete("teacher5")

			local pc_job=pc.get_job()
			if pc_job != 2 then -- !!!
				say_title(gameforge.skill_group._370_sayTitle)

				say(gameforge.skill_group._560_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
				return
			end

			say_title(gameforge.skill_group._570_sayTitle)
			say(gameforge.skill_group._580_say)
			say_reward(gameforge.skill_group._590_sayReward)
			local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)
			if 2 == s then
				return
			end

			if pc.get_job()!=2 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(1) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")


			say_title(gameforge.skill_group._600_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				           ---                                                   l
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
								say_reward(gameforge.skill_group._340_sayReward)
							else
				say_reward(gameforge.skill_group._350_sayReward)
							end
			clear_letter()
		end


		when teacher6.target.click or skill_group1_6.chat.gameforge.skill_group._610_npcChat or	skill_group2_6.chat.gameforge.skill_group._610_npcChat or	skill_group3_6.chat.gameforge.skill_group._610_npcChat	begin 
			target.delete("teacher6")

			local pc_job=pc.get_job()
			if pc_job != 2 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._620_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end

			say_title(gameforge.skill_group._630_sayTitle)
			say(gameforge.skill_group._640_say)
			say_reward(gameforge.skill_group._590_sayReward)

						local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)

			if 2 == s then
				return
			end

			if pc.get_job()!=2 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(2) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")

			say_title(gameforge.skill_group._650_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				           ---                                                   l
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
								say_reward(gameforge.skill_group._340_sayReward)
							else
				say_reward(gameforge.skill_group._350_sayReward)
							end
			clear_letter()
		end


		when teacher7.target.click or skill_group1_7.chat.gameforge.skill_group._660_npcChat or	skill_group2_7.chat.gameforge.skill_group._660_npcChat or	skill_group3_7.chat.gameforge.skill_group._660_npcChat	begin 
			target.delete("teacher7")

			local pc_job=pc.get_job()
			if pc_job != 3 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._670_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
								return
			end

			say_title(gameforge.skill_group._680_sayTitle)
			say(gameforge.skill_group._690_say)
			say_reward(gameforge.skill_group._700_sayReward)

						local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)

			if 2 == s then
				return
			end

			if pc.get_job()!=3 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).." pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(1) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")

			say_title(gameforge.skill_group._710_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				           ---                                                   l
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
								say_reward(gameforge.skill_group._340_sayReward)
							else
				say_reward(gameforge.skill_group._350_sayReward)
							end
			clear_letter()
		end


		when teacher8.target.click or skill_group1_8.chat.gameforge.skill_group._720_npcChat or	skill_group2_8.chat.gameforge.skill_group._720_npcChat or	skill_group3_8.chat.gameforge.skill_group._720_npcChat	begin 
			target.delete("teacher8")

			local pc_job=pc.get_job()
			if pc_job != 3 then -- !!!
				say_title(gameforge.skill_group._190_sayTitle)

				say(gameforge.skill_group._730_say)
				if pc_job==0 then
					say_reward(gameforge.skill_group._210_sayReward)
				elseif pc_job==1 then
					say_reward(gameforge.skill_group._220_sayReward)
				elseif pc_job==2 then
					say_reward(gameforge.skill_group._230_sayReward)
				elseif pc_job==3 then
					say_reward(gameforge.skill_group._240_sayReward)
				end
				return
			end


			say_title(gameforge.skill_group._740_sayTitle)
			say(gameforge.skill_group._750_say)
			say_reward(gameforge.skill_group._700_sayReward)
			local s= select(gameforge.skill_group._280_select, gameforge.skill_group._290_select)
			if 2 == s then
				return
			end

			if pc.get_job()!=3 or pc.get_skill_group()!=0 then
				test_chat(string.format(gameforge.skill_group._300_chat, bool_to_str(npc_is_same_job()).."pc.get_skill_group:"..pc.get_skill_group().."pc_job:"..pc.get_job()))
				return
			end

			set_state("start")
			pc.set_skill_group(2) -- !!!
			pc.clear_skill()
			char_log(0, "CLEAR_SKILL", "Fertigkeit nach Fertigkeitsmeister löschen")

			say_title(gameforge.skill_group._760_sayTitle)

			say(gameforge.skill_group._320_say)
			if not pc.is_clear_skill_group() then
				           ---                                                   l
				say(gameforge.skill_group._330_say)
				say_title(gameforge.buy_fishrod._210_sayTitle)
								say_reward(gameforge.skill_group._340_sayReward)
							else
				say_reward(gameforge.skill_group._350_sayReward)
							end
			clear_letter()
		end

	end -- end_of_state: run
end -- end_of_quest
