ScriptName aaaKimachuuDungeonsSetRewards Extends ObjectReference

MiscObject Property Gold001 Auto
Potion Property FoodBread01A Auto
Potion Property RestoreHealth03 Auto
GlobalVariable Property aaaKimachuuDungeonsRewards Auto
GlobalVariable Property aaaKimachuuDungeonsCurrentHierarchy Auto

Event OnActivate(ObjectReference akActionRef)
	If akActionRef != Game.GetPlayer() || aaaKimachuuDungeonsRewards.GetValue() == 0
		Return
	EndIf

	aaaKimachuuDungeonsRewards.SetValue(0)
	If aaaKimachuuDungeonsCurrentHierarchy.GetValue() >= 30
		Int iGold = 5000
		Int iPotion = 10
		Int iBread = 15
		rewardsFunction(iGold, iPotion, iBread)
	ElseIf aaaKimachuuDungeonsCurrentHierarchy.GetValue() >= 20
		Int iGold = 2500
		Int iPotion = 10
		Int iBread = 10
		rewardsFunction(iGold, iPotion, iBread)
	ElseIf aaaKimachuuDungeonsCurrentHierarchy.GetValue() >= 10
		Int iGold = 750
		Int iPotion = 10
		Int iBread = 5
		rewardsFunction(iGold, iPotion, iBread)
	EndIf
EndEvent

Function rewardsFunction(Int i01, Int i02, Int i03)
	Game.GetPlayer().AddItem(Gold001, i01)
	Game.GetPlayer().AddItem(RestoreHealth03, i02)
	Game.GetPlayer().AddItem(FoodBread01A, i03)
EndFunction