Scriptname _00E_MQ08aPrologue_Functions extends Quest  

Import Utility
Import Debug
Import _00E_QuestFunctions


;=====================================================================================
;              							EVENTS                    					 
;=====================================================================================

Event OnUpdateGameTime()
	
	If NQ_G_07Dijaam_SC03_EscapeThroughTomb == None
		NQ_G_07Dijaam_SC03_EscapeThroughTomb = Game.GetFormFromFile(0x00147063, "Skyrim.esm") as Scene
	EndIf
	
	If NQ_G_07Dijaam_SC03_EscapeThroughTomb.IsPlaying()
		RegisterForSingleUpdate(10)
	Else
		Self.SetStage(10)
	EndIf

EndEvent

Event OnUpdate()
	
	If NQ_G_07Dijaam_SC03_EscapeThroughTomb.IsPlaying()
		RegisterForSingleUpdate(10)
	Else
		Self.SetStage(10)
	EndIf
	
EndEvent

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

Function RegisterForWaitingTime()

	RegisterForSingleUpdateGameTime(24.0)

EndFunction

Function AddSilence()

	_00E_SilenceTransitionHighPriority.Add()

EndFunction

Function SetUpScene(bool bAutosave = true)
	
	If bAutosave == true
		Game.RequestAutoSave()
	EndIf

	_00E_MC_LeoraREF.Enable()
	_00E_MC_LishariREF.Enable()
	_00E_MC_YuslanRef.Enable()
	_00E_MC_NataraREF.Enable()
	_00E_MC_KonstantinREF.Enable()
	_00E_MC_TealorREF.Enable()
	_00E_MC_YuslanRef.MoveTo(_00E_MQ08aPrologue_YuslanChair)
	_00E_MC_KonstantinREF.MoveTo(_00E_MQ08aPrologue_KonstantinChair)
	_00E_MC_LishariREF.MoveTo(_00E_MQ08aPrologue_LishariMarker)
	_00E_MC_NataraREF.MoveTo(_00E_MQ08Prologue_NataraChair)
	_00E_MC_LeoraREF.MoveTo(MQ10b_SC02_LeoraStartMarker)
	_00E_MC_LishariREF.MoveTo(_00E_MQ08aPrologue_LishariMarker)
	_00E_MC_TealorREF.MoveTo(_00E_MQ08aPrologue_TeaorThrone)
	_00E_MC_TealorREF.MoveTo(MQ08Prologue_TealorMapMarker)
	
	MQ08Prologue_SC1_Discussion.ForceStart()

EndFunction

Function CheckForCompanionQuests()

	If !CQJ02.IsCompleted()
		CQJ02.SetStage(40)
	EndIf
	
EndFunction

Function StartMQ08()

	Levelsystem.RemoveSilence()
	Self.CompleteQuest()
	MQ08.SetStage(5)

EndFunction

Function PortKonstantin()

	Levelsystem.RemoveSilence()
	MQ08.SetStage(50)

EndFunction

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

_00E_QuestFunctions Property Levelsystem Auto

Actor Property _00E_MC_NataraREF Auto
Actor Property _00E_MC_YuslanRef Auto
Actor Property _00E_MC_TealorREF Auto
Actor Property _00E_MC_LeoraREF Auto
Actor Property _00E_MC_KonstantinREF Auto
Actor Property _00E_MC_LishariREF Auto

ObjectReference Property _00E_MQ08aPrologue_YuslanChair Auto
ObjectReference Property _00E_MQ08Prologue_NataraChair Auto
ObjectReference Property _00E_MQ08aPrologue_LishariMarker Auto
ObjectReference Property _00E_MQ08aPrologue_KonstantinChair Auto
ObjectReference Property _00E_MQ08aPrologue_TeaorThrone Auto
ObjectReference Property MQ08Prologue_TealorMapMarker Auto
ObjectReference Property MQ10b_SC02_LeoraStartMarker Auto

Scene Property MQ08Prologue_SC1_Discussion Auto
Scene Property NQ_G_07Dijaam_SC03_EscapeThroughTomb Auto

MusicType Property _00E_SilenceTransitionHighPriority Auto

Quest Property MQ08 Auto
Quest Property CQJ02 Auto