quest christmas_santa begin
    state start begin
		when santa.click begin
			local intro_msg = locale.christmas_santa.intro_msg

			local skill_book_buy_cost = locale.christmas_santa.skill_book_buy_cost
			local skill_book_msg = locale.christmas_santa.skill_book_msg
			local skill_book_sold_out_msg = locale.christmas_santa.skill_book_sold_out_msg

			local hairdye_buy_cost = locale.christmas_santa.hairdye_buy_cost
			local hairdye_msg = locale.christmas_santa.hairdye_msg
			local hairdye_sold_out_msg = locale.christmas_santa.hairdye_sold_out_msg

			local not_enough_money = locale.christmas_santa.not_enough_money

			local SKILL_BOOK_GROUP = 50300
			local HAIRDYE_GROUP = 70201

			say(intro_msg)
			local s =  select(locale.christmas_santa.want_skillbook, gameforge.locale.christmas_santa.want_hairdye)
			if s==1 then
				local r = npc.get_remain_skill_book_count();
				if r>0 then
					say(skill_book_msg)
					local s =  select(locale.christmas_santa.select_buy, gameforge.locale.christmas_santa.select_stop)
					if s==1 then
						if npc.get_remain_skill_book_count()>0 then
							if pc.gold >= skill_book_buy_cost then
								npc.dec_remain_skill_book_count()
								pc.changegold(-skill_book_buy_cost)
								pc.give_item_from_special_item_group(SKILL_BOOK_GROUP)
							else
								say(gameforge.locale.christmas_santa.not_enough_money)
							end
						else
							say(skill_book_sold_out_msg)
						end
					end
				else
					say(skill_book_sold_out_msg)
				end
			elseif s==2 then
				local r = npc.get_remain_hairdye_count();
				if r>0 then
					say(hairdye_msg)
					local s =  select(locale.christmas_santa.select_buy, gameforge.locale.christmas_santa.select_stop)
					if s==1 then
						if npc.get_remain_hairdye_count()>0 then
							if pc.gold >= hairdye_buy_cost then
								npc.dec_remain_hairdye_count()
								pc.changegold(-hairdye_buy_cost)
								pc.give_item_from_special_item_group(HAIRDYE_GROUP)
							else
								say(gameforge.locale.christmas_santa.not_enough_money)
							end
						else
							say(hairdye_sold_out_msg)
						end
					end
				else
					say(hairdye_sold_out_msg)
				end
			elseif s==3 then
				say(locale.christmas_santa.bye_msg)
			end
		end
    end
end

