Scriptname _00E_NQ07_Functions extends Quest  

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================

Function SetUpScene()

	_00E_NQ07_FemaleKeeperREF.Enable()
	_00E_NQ07_MirellaREF.Enable()
	_00E_NQ07_MirellaREF.MoveTo(NQ07_SC01_MirellaMarker)
	_00E_NQ07_FemaleKeeperREF.MoveTo(NQ07_SC01_KeeperMarker)

EndFunction

Function DespawnKeeper()

	_00E_NQ07_FemaleKeeperREF.Delete()

EndFunction

Function MovePlayerToKor()

    PlayerREF.MoveTo(LandingMarkerKor)

EndFunction

Function AddLetter(ObjectReference objSelfRef)
	
	ITMGenericBookUp.Play(PlayerREF)
	objSelfRef.Disable()
	PlayerREF.AddItem(arrayNQ07_Letters[iLetterCount])
	iLetterCount += 1
	
	_00E_Ark_NQ_Kor_NotesFound.SetValue(_00E_Ark_NQ_Kor_NotesFound.GetValueInt() + 1)
	Self.UpdateCurrentInstanceGlobal(_00E_Ark_NQ_Kor_NotesFound)
	
	int CurrentCount = _00E_Ark_NQ_Kor_NotesFound.GetValueInt()

	if CurrentCount >= 7
		Self.SetObjectiveCompleted(10, 1)
		_00E_EPHandler.GiveEP(250)
	Else
		Self.SetObjectiveCompleted(10,0)
		Self.SetObjectiveDisplayed(10, True, True)
	EndIf
	
	int Stage = GetCurrentStageID()
	
	If Stage <= 50
		SetCurrentStageID(Stage + 5)
	EndIf
	
EndFunction

Function UpdateMedallionCount()
	
	NQ07_MedaillionsFound.SetValue(NQ07_MedaillionsFound.GetValueInt() + 1)
	Self.UpdateCurrentInstanceGlobal(NQ07_MedaillionsFound)
	
	int CurrentCount = NQ07_MedaillionsFound.GetValueInt()
	
	if CurrentCount >= 7
		Self.SetObjectiveCompleted(22, 1)
		Self.SetObjectiveDisplayed(20, True, True)
	Else
		Self.SetObjectiveCompleted(22,0)
		Self.SetObjectiveDisplayed(22, True, True)
	EndIf

EndFunction

Function FinishUp()

	_00E_EPHandler.GiveEP(500)
	Self.CompleteAllObjectives()
	Self.Stop()

EndFunction

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

int Property iLetterCount Auto Hidden

Actor Property _00E_NQ07_MirellaREF Auto
Actor Property _00E_NQ07_FemaleKeeperREF Auto

Actor Property PlayerREF Auto

Sound Property ITMGenericBookUp Auto

GlobalVariable Property _00E_Ark_NQ_Kor_NotesFound Auto
GlobalVariable Property NQ07_MedaillionsFound Auto

ObjectReference Property NQ07_SC01_MirellaMarker Auto
ObjectReference Property NQ07_SC01_KeeperMarker Auto
ObjectReference Property LandingMarkerKor Auto

Book[] Property arrayNQ07_Letters Auto