--日常环

--脚本号
x200010_g_scriptId = 200010
--环id
x200010_g_RoundId = 19

--环区间 1,2-3,4-9,10
x200010_g_MissionRoundRange={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} 

--任务权重[环区间][概率,任务id(类型)]
x200010_g_MissionWeight={}
x200010_g_MissionWeight[1]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[2]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[3]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[4]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[5]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[6]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[7]={{chanceSum=100,id=11907}}--副本
x200010_g_MissionWeight[8]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[9]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[10]={{chanceSum=100,id=11907}}--副本
x200010_g_MissionWeight[11]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[12]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[13]={{chanceSum=100,id=11907}}--副本
x200010_g_MissionWeight[14]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[15]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[16]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[17]={{chanceSum=100,id=11907}}
x200010_g_MissionWeight[18]={{chanceSum=100,id=11901}}
x200010_g_MissionWeight[19]={{chanceSum=100,id=11903}}
x200010_g_MissionWeight[20]={{chanceSum=100,id=11907}}

x200010_g_DoubleTimes=20

x200010_g_DropIds={7000,7000,7000,7000,7000,7000,7000,7000,7000,7000}
--是否可以接环，通用逻辑已判断
function x200010_CheckRoundAccept( scene,selfId )
	-- body
	return true
end

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

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

	local missionRange=1
	for i=1,#x200010_g_MissionRoundRange-1 do
		if roundInSection>x200010_g_MissionRoundRange[i] and roundInSection<=x200010_g_MissionRoundRange[i+1] then
			missionRange=i+1
		end
	end
	--print("----------",roundInSection,missionRange)
	local missionWeight=x200010_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 x200010_MissionRoundNext( scene,selfId,section,roundInSection,roundInCD )
	if roundInCD==x200010_g_DoubleTimes then
		ShowDoubleExpBox(scene,selfId,x200010_g_RoundId)
	else
		AcceptRoundMission(scene,selfId,x200010_g_RoundId)
	end
end



--环奖励 round 本轮的环数 roundInCD 时间段内的环数（本日（周）的完成次数）
function x200010_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*2.5*10*(0.056+0.008*round))	
	-- local exp = math.ceil((level*120+240)*2.5*10*(0.056+0.008*round))

	-- --双倍经验
	-- if doubleExp == 1 then
	-- 	 exp = exp * 2
	-- end

	-- if 	roundInCD<x200010_g_DoubleTimes then
	-- 	local dropId = x200010_GetDropId(round,level)
	-- 	if dropId >  0 then
	-- 		CreateItemToUserByDropBox(scene,selfId,dropId)
	-- 	end
	-- else
	-- 	money=math.ceil(money/10)
	-- 	exp=math.ceil(exp/10)
	-- end	
	-- 如果212神器已经激活，赏金任务金钱获取增加30%
	-- if IsArtifactActivated(scene,selfId,212) then 
	-- 	money = math.ceil(money * 1.3)
	-- end
	-- AddMoney(scene,selfId,money)
	-- GainExp(scene,selfId,exp)

end

function x200010_OnSectionBouns( scene,selfId  )
	-- body
	local money=math.random(490000,910000)
	AddMoney(scene,selfId,money)
	return money
end

function  x200010_GetDropId(round,level)
	-- body
	local  dropId = 0
	--print(round)
	if round%10==0 then
		local index = math.floor(level/(100/#x200010_g_DropIds))+1
		--print(index)
		if index > #x200010_g_DropIds then
		   index=#x200010_g_DropIds
		 end
		dropId=x200010_g_DropIds[index]
	end
	return dropId	

end

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