ShowMessage("领取帮会战功 $Rev: 214 $")

--[[
[author]
class=3
descript="每周可以领取一次"
]]--
perday_max=1
script_name="领取帮会战功"


function OnMission()

	while true do
		-- 移动到 帮会城市

		if CityToGuild() == false then
			ShowMessage("没有帮派城市！")
			break 
		end

		MoveToNPC( 93, 54,-1, "赵子勋" )
		--选择 领取帮会战功		
			
		QuestFrameOptionClicked("领取大区赛每周奖励", CMP_PART_MATCH)
		
		System:Sleep( 1000 )

		if UI:IsWindowShow("Bhls_Prize") then
			DoLuaString("Bhls_Prize_Env" , "Bhls_Prize_Ok_Clicked()")
			System:UpdateRecord( script_name )
			return
		end

		System:Sleep( 1000 )	
					
		local isNext,szMsg = GetDebugMessage()

		while isNext == 1 do
			if string.find(szMsg, "奖励领取成功") then
				ShowMessage("领取帮会战功完成，脚本结束！")
				System:UpdateRecord( script_name )
				return
			elseif string.find(szMsg, "已经领取过") then
				ShowMessage("领取帮会战功完成，脚本结束！")
				System:UpdateRecord( script_name )
				return
			end
			isNext,szMsg = GetDebugMessage()

		end
	end
end

function _SMain(...)

	OnMission()

	GuildToCity(0)
end

_SMain()