--势力任务环

--脚本号
x200011_g_scriptId = 200011
--环id
x200011_g_RoundId = 11

--环区间 1,2-3,4-9,10
x200011_g_MissionRoundRange={1,2,3,4,5,6,7,8,9,70} 

--任务权重[环区间][概率,任务id(类型)]
x200011_g_MissionWeight={}
x200011_g_MissionWeight[1]={{chanceSum=100,id=11101}}
x200011_g_MissionWeight[2]={{chanceSum=100,id=11103}}
x200011_g_MissionWeight[3]={{chanceSum=100,id=11108}}
x200011_g_MissionWeight[4]={{chanceSum=100,id=11101}}
x200011_g_MissionWeight[5]={{chanceSum=100,id=11103}}
x200011_g_MissionWeight[6]={{chanceSum=100,id=11101}}
x200011_g_MissionWeight[7]={{chanceSum=100,id=11103}}
x200011_g_MissionWeight[8]={{chanceSum=100,id=11108}}
x200011_g_MissionWeight[9]={{chanceSum=100,id=11103}}
x200011_g_MissionWeight[10]={{chanceSum=100,id=11107}}

--是否可以接环，通用逻辑已判断
function x200011_CheckRoundAccept( scene,selfId )
	-- body
	return true
end

--当前环的任务id
function x200011_GetRoundMissionId( scene,selfId )
	-- body

	local roundInSection=GetMissionRoundInSection(scene,selfId,x200011_g_RoundId)+1

	local missionRange=1
	for i=1,#x200011_g_MissionRoundRange-1 do
		if roundInSection>x200011_g_MissionRoundRange[i] and roundInSection<=x200011_g_MissionRoundRange[i+1] then
			missionRange=i+1
		end
	end
	--print("----------",roundInSection,missionRange)
	local missionWeight=x200011_g_MissionWeight[missionRange];
	local random = math.random(100)
	local  missionId = missionWeight[1].id
	for i=1,#missionWeight do
		if missionWeight[i].chanceSum>=random then
			missionId= missionWeight[i].id
			break
		end	
	end
		--print(missionId)
	return missionId 
end


function x200011_MissionRoundNext( scene,selfId,section,roundInSection,roundInCD )
			AcceptRoundMission(scene,selfId,x200011_g_RoundId)
end



--环奖励 round 本轮的环数 roundInCD 时间段内的环数（本日（周）的完成次数）
function x200011_OnRoundBouns( scene,selfId,section,round,roundInCD,doubleExp)
	-- body
	-- print("OnRoundBouns",round,roundInCD)
	-- round =round+1
	-- local  level = GetLevel(scene,selfId)	
	
	-- local money = math.ceil(level*12*4*10*(0.056+0.008*round))	
	-- local exp = math.ceil((level*120+240)*4*10*(0.056+0.008*round))
	-- if doubleExp == 1 then
	-- 	 exp = exp * 2
	-- end
	-- -- --势力资金
	-- -- local guildCapital=2
	-- -- --帮贡
	-- -- local guildContribution=1
	-- local  bossItemCount = 1 --镇灵石

	--  -- AddMoney(scene,selfId,money)
	-- -- AddGuildContribution(scene,selfId,guildContribution)
	-- GainExp(scene,selfId,exp)
	-- AddGuildBossItem(scene,selfId,bossItemCount)
	-- -- AddGuildCapital(scene,selfId,guildCapital)
	
end


function x200011_OnSectionBouns( scene,selfId  )
	-- body
	local contribution=math.random(2000,4000)
	AddGuildContribution(scene,selfId,contribution)
	return contribution
end

--轮数做完了
function x200011_OnRoundFinish( scene,selfId )
	-- body
	--print("OnRound finish")
end