Scriptname _00E_FS_NQ06_Functions extends Quest  

Import _00E_QuestFunctions
Import Utility
Import Game

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

Function UpdateClues()

	if _00E_FS_NQ06_CluesFound.GetValue() < 1
		_00E_FS_NQ06_CluesFound.SetValue(_00E_FS_NQ06_CluesFound.GetValue()+1)
		UpdateCurrentInstanceGlobal(_00E_FS_NQ06_CluesFound)
		SetObjectiveDisplayed(10, true, true)
	elseif _00E_FS_NQ06_CluesFound.GetValue() == 1
		_00E_FS_NQ06_CluesFound.SetValue(_00E_FS_NQ06_CluesFound.GetValue()+1)
		UpdateCurrentInstanceGlobal(_00E_FS_NQ06_CluesFound)
		SetObjectiveCompleted(10)
		SetObjectiveDisplayed(15)
	endif

EndFunction

Function SetupSC01()

	_00E_FS_NQ06_OldManREF.MoveTo(_00E_FS_NQ06_OldManStandMarker)
	_00E_FS_NQ06_OldWomanREF.MoveTo(_00E_FS_NQ06_OldWomanStandMarker)
	_00E_FS_NQ06_GuardREF.MoveTo(_00E_FS_NQ06_GuardStandMarker)
	wait(1)
	SetStage(10)
 
EndFunction

Function StartSC01()

	FS_NQ06_SC01_DialogueInFrontOfHouse.ForceStart()

EndFunction

Function OpenHouseDoor()

	_00E_FS_NQ06_HouseDoor.Lock(false)
	_00E_FS_NQ06_OldManREF.Disable()
	_00E_FS_NQ06_OldWomanREF.Disable()

EndFunction

Function RemoveLetter()

	PlayerREF.RemoveItem(_00E_FS_NQ06_Letter, 1, false, _00E_FS_NQ06_GuardREF)
	;_00E_FS_NQ06_GuardREF.Additem(_00E_FS_NQ06_Letter, 1)
	
EndFunction

Function RemoveSchuldschein()

	PlayerREF.RemoveItem(_00E_FS_NQ06_DebtNote, PlayerREF.GetItemCount(_00E_FS_NQ06_DebtNote), false, _00E_FS_NQ06_GuardREF)
	;_00E_FS_NQ06_GuardREF.Additem(_00E_FS_NQ06_DebtNote,1)
	
EndFunction

Function OpenLighthouseDoor()

	_00E_FS_NQ06_LighthouseDoor.Lock(false)
	_00E_FS_NQ06_HouseDoor.Lock(255)

EndFunction

Function Bolzerei()

	_00E_FS_NQ06_DariusKupferhammerREF.SetGhost(false)
	Levelsystem.Brawl(_00E_FS_NQ06_DariusKupferhammerREF)
	; _00E_FS_NQ06_DariusKupferhammerREF.StartCombat(PlayerREF)

EndFunction

Function MoveDariusToJail()

	Levelsystem.FadeToBlack()
	wait(1)
	PlayerREF.MoveTo(_00E_FS_NQ06_PlayerJailMarker)
	_00E_FS_NQ06_DariusKupferhammerREF.MoveTo(_00E_FS_NQ06_DariusJailMarker)
	_00E_FS_NQ06_DariusKupferhammerREF.EvaluatePackage()
	_00E_FS_NQ06_GuardREF.MoveTo(_00E_FS_NQ06_GuardPresentEvidenceMarker)
	_00E_FS_NQ06_GuardREF.EvaluatePackage()
	Levelsystem.FadeToBlackBack()
	
EndFunction

Function StartSC02()

	FS_NQ06_SC02_ForcegreetGuard.ForceStart()
	_00E_FS_NQ06_DariusKupferhammerREF.SetGhost(true)
	_00E_FS_NQ06_DariusDolch.Enable()

EndFunction

Function EndDariusInJail()

	PlayerREF.AddItem(Gold001, 500)
	PlayerREF.RemoveItem(_00E_FS_NQ06_LetterLighthouse, 1)
	Levelsystem.GiveEP(1500)
	wait(1)
	Levelsystem.FadeToBlack()
	wait(1)
	PlayerREF.MoveTo(_00E_FS_NQ06_PlayerJailMarker)
	_00E_FS_NQ06_GuardREF.MoveTo(_00E_FS_NQ06_GuardStandMarker)
	_00E_FS_NQ06_GuardREF.EvaluatePackage()
	Levelsystem.FadeToBlackBack()
	SetStage(130)

EndFunction

Function EndKarymeaInJail()

	PlayerREF.AddItem(Gold001, 500)
	PlayerREF.RemoveItem(_00E_FS_NQ06_LetterLighthouse, 1)
	Levelsystem.GiveEP(1500)
	wait(1)
	Levelsystem.FadeToBlack()
	wait(1)
	PlayerREF.MoveTo(_00E_FS_NQ06_PlayerJailMarker)
	_00E_FS_NQ06_GuardREF.MoveTo(_00E_FS_NQ06_GuardStandMarker)
	_00E_FS_NQ06_GuardREF.EvaluatePackage()
	_00E_FS_NQ06_DariusKupferhammerREF.MoveTo(_00E_FS_NQ06_DariusShipMarker)
	_00E_FS_NQ06_DariusKupferhammerREF.EvaluatePackage()
	_00E_FS_NQ06_KarymeaREF.MoveTo(_00E_FS_NQ06_DariusJailMarker)
	_00E_FS_NQ06_KarymeaREF.EvaluatePackage()
	_00E_FS_NQ06_KarymeaREF.BlockActivation(true)
	Levelsystem.FadeToBlackBack()
	SetStage(160)

EndFunction

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================
MiscObject Property Gold001 Auto
_00E_QuestFunctions Property Levelsystem Auto

Actor Property PlayerREF Auto
Actor Property _00E_FS_NQ06_OldManREF Auto
Actor Property _00E_FS_NQ06_OldWomanREF Auto
Actor Property _00E_FS_NQ06_GuardREF Auto
Actor Property _00E_FS_NQ06_KraigKupferhammerREF Auto
Actor Property _00E_FS_NQ06_SiraKupferhammerREF Auto
Actor Property _00E_FS_NQ06_DariusKupferhammerREF Auto
Actor Property _00E_FS_NQ06_KarymeaREF Auto

GlobalVariable Property _00E_FS_NQ06_CluesFound Auto

ObjectReference Property _00E_FS_NQ06_GuardStandMarker Auto
ObjectReference Property _00E_FS_NQ06_OldManStandMarker Auto
ObjectReference Property _00E_FS_NQ06_OldWomanStandMarker Auto
ObjectReference Property _00E_FS_NQ06_HouseDoor Auto
ObjectReference Property _00E_FS_NQ06_LighthouseDoor Auto
ObjectReference Property _00E_FS_NQ06_PlayerJailMarker Auto
ObjectReference Property _00E_FS_NQ06_DariusJailMarker Auto
ObjectReference Property _00E_FS_NQ06_GuardPresentEvidenceMarker Auto
ObjectReference Property _00E_FS_NQ06_DariusDolch Auto
ObjectReference Property _00E_FS_NQ06_DariusShipMarker Auto

Book Property _00E_FS_NQ06_DebtNote Auto
Book Property _00E_FS_NQ06_Letter Auto
Book Property _00E_FS_NQ06_LetterLighthouse Auto

Scene Property FS_NQ06_SC01_DialogueInFrontOfHouse Auto
Scene Property FS_NQ06_SC02_ForcegreetGuard Auto