if(mg<7)
	lv=1
else
	lv=(mg/7)*7
endif

switch(mt)
case 1
	exp=random(1,20)
	money=random(1,15)
	addexp(60*mg*(100-exp)*mn*exptime/100)
	addJB(10*mg*(100-money)*mn*moneytime/100)
	if(getGrade()<=mg+20)
		if (probability(5*fmtime))
			addGoods(3,3,1)
		endif
		if (probability(4*fmtime))
			addGoods(2,3,1)
		endif
		if (probability(1*fmtime))
			addGoods(1,3,1)
		endif

		if(probability((30-lv*2/7)*fmtime))
			fmlv=0
			fm=-1
			if(probability(10+(fmtime-1)*80))
				fmlv=fmtime
				fm=random(0,4)
			endif
			if(probability(1*fmtime))
				fm=11
				fmlv=0
			endif
			addGoods(getEquiID(lv,random(0,4)),1,fm,fmlv) 
		endif
	endif
		

case 2
	addexp(600*mg*exptime)
		addJB(20*mg*moneytime)
		addGoods(getEquiID(lv,0),1,random(0,4),1)
		addGoods(getEquiID(lv,1),1,random(0,4),1)
		addGoods(getEquiID(lv,2),1,random(0,4),1)
		addGoods(getEquiID(lv,3),1,random(0,4),1)
		addGoods(getEquiID(lv,4),1,random(0,4),1)
	endif

case 3
	addexp(400*mg*exptime)
	if(getGrade()<=mg+10)
		if (probability(80))
			addGoods(random(5,6),3,1)
		else
			addGoods(4,3,1)
		endif
		addJB(80*mg*moneytime)
		addGoods(getEquiID(lv,random(0,4)),1,random(0,4),5)
	endif

case 4
	addexp(400*mg*exptime)
	if (probability(80))
			addGoods(random(8,9),3,1)
	else
		addGoods(7,3,1)
	endif
	addJB(1000*mg*moneytime)
	addGoods(getEquiID(lv,random(0,4)),1,random(0,4),1)

case 5
	addexp(400*mg*exptime)
	if(getGrade()<=mg+10)
		if(mg>25)
			addJB(40*mg*moneytime)
			addGoods(getEquiID(lv,random(0,4)),1,random(0,4),2)
		else
			addJB(30*mg*moneytime)
			addGoods(getEquiID(lv,random(0,4)),1,random(0,4),2)
		endif
	endif

case 6
	addexp(400*mg*exptime)
	if(getGrade()<=mg+10)
		if (probability(80))
			addGoods(random(2,3),3,1)
		else
			addGoods(1,3,1)
		endif
		addJB(60*mg*moneytime)
		addGoods(getEquiID(lv,random(0,4)),1,random(0,4),4)
	endif

case 7
	addexp(400*mg*exptime)
	if(getGrade()<=mg+10)
		if(mg>45)
			if (probability(80))
				addGoods(random(8,9),3,1)
			else
				addGoods(7,3,1)
			endif
			addJB(1000*mg*moneytime)
			addGoods(getEquiID(lv,random(0,4)),1,random(0,4),10)
		else
			addJB(50*mg*moneytime)
			addGoods(getEquiID(lv,random(0,4)),1,random(0,4),3)
		endif
	endif

case 8
	addexp(400*mg*exptime)
	if(getGrade()<=mg+10)
		addJB(70*mg*moneytime)
		addGoods(getEquiID(lv,random(0,4)),1,random(0,4),3)
	endif

case 9
	addexp(400*mg*exptime)
	if (probability(80))
		addGoods(random(5,6),3,1)
	else
		addGoods(4,3,1)
	endif
	addJB(200*mg*moneytime)
	addGoods(getEquiID(lv,random(0,4)),1,random(0,4),7)

case 10
	addexp(400*mg*exptime)
	if (probability(80))
		addGoods(random(5,6),3,1)
	else
		addGoods(4,3,1)
	endif
	addJB(100*mg*moneytime)
	addGoods(getEquiID(lv,random(0,4)),1,random(0,4),5)

case 11
	addGoods(12,0,3)
	addGoods(10,0,5)
	addGoods(11,0,5)
	addGoods(getEquiID(70,random(0,4)),1,random(6,10),10)
	addGoods(getEquiID(70,random(0,4)),1,random(0,4),10)
	addGoods(getEquiID(70,random(0,4)),1,11,0)

endswitch

ret
