Scriptname _00E_NQ27_Functions extends Quest  

Import _00E_QuestFunctions

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================
Function DespawnOldManOldWoman()

	_00E_NQ27_OldManREF.Disable()
	_00E_NQ27_OldWomanREF.Disable()

EndFunction

Function EnableLevers()

	_00E_NQ27_Lever01REF.Enable()
	_00E_NQ27_Lever02REF.Enable()
	_00E_NQ27_Lever03REF.Enable()

EndFunction

Function ActivateWallMechanism()

	if _00E_NQ27_Lever01REF.IsInPullPosition == false && _00E_NQ27_Lever02REF.IsInPullPosition == false && _00E_NQ27_Lever03REF.IsInPullPosition == false
		_00E_NQ27_MoveableWallREF.TranslateTo(_00E_NQ27_MoveableWallREF.GetPositionX(), (_00E_NQ27_MoveableWallREF.GetPositionY() - fTranslateValue), _00E_NQ27_MoveableWallREF.GetPositionZ(), _00E_NQ27_MoveableWallREF.GetAngleX(), _00E_NQ27_MoveableWallREF.GetAngleY(), _00E_NQ27_MoveableWallREF.GetAngleZ(), 100.0)
		_00E_NQ27_MoveablePostREF.TranslateTo(_00E_NQ27_MoveablePostREF.GetPositionX(), (_00E_NQ27_MoveablePostREF.GetPositionY() - fTranslateValue), _00E_NQ27_MoveablePostREF.GetPositionZ(), _00E_NQ27_MoveablePostREF.GetAngleX(), _00E_NQ27_MoveablePostREF.GetAngleY(), _00E_NQ27_MoveablePostREF.GetAngleZ(), 100.0)
		int iMechanismSound = DRSStoneRotatingDiscLPM.Play(_00E_NQ27_MoveableWallREF)
		Utility.Wait(3)
		Sound.StopInstance(iMechanismSound)
	EndIf

EndFunction

Function AddVouchers()

	;_00E_NQ_G_07_GunamREF.RemoveItem(Gueterscheine.GetReference().GetBaseObject(), 1, false, PlayerREF)
	
EndFunction

Function RemoveLetter()

	PlayerREF.RemoveItem(Letter.GetReference().GetBaseObject(), 1, false, _00E_NQ27_GuardREF)
	
EndFunction

Function RemoveSchuldschein()

	PlayerREF.RemoveItem(Schuldschein.GetReference().GetBaseObject(), 1, false, _00E_NQ27_GuardREF)
	
EndFunction

Function SetupSC01()

	_00E_NQ27_OldManREF.MoveTo(_00E_NQ27_OldManStandMarker)
	_00E_NQ27_OldWomanREF.MoveTo(_00E_NQ27_OldWomanStandMarker)
	_00E_NQ27_GuardREF.MoveTo(_00E_NQ27_GuardStandMarker)
 

EndFunction

Function StartSC01()

	NQ27_SC01_DialogueInFrontOfHouse.ForceStart()
	
	If NQ27_SC01_DialogueInFrontOfHouse.IsPlaying()
		PrintDebugMessage("NQ27_SC01_DialogueInFrontOfHouse is playing!")
	Endif

EndFunction

Function RewardMoney()

	PlayerREF.AddItem(Gold001, __Config_RewardMoney)

EndFunction

Function FinishQuest()
	
	RewardMoney()
	Levelsystem.GiveEP(__Config_RewardEXP)
	
	Self.CompleteQuest()

EndFunction
;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================
float fTranslateValue = 250.0

;rewards
int Property __Config_RewardEXP Auto
int Property __Config_RewardMoney Auto
MiscObject Property Gold001 Auto
_00E_QuestFunctions Property Levelsystem Auto

;sound for secret door
Sound Property DRSStoneRotatingDiscLPM Auto

;actors
Actor Property PlayerREF Auto
Actor Property _00E_NQ27_OldManREF Auto
Actor Property _00E_NQ27_OldWomanREF Auto
Actor Property _00E_NQ27_GuardREF Auto
Actor Property _00E_NQ27_KraigKupferhammerREF Auto
Actor Property _00E_NQ27_SiraKupferhammerREF Auto

;marker
ObjectReference Property _00E_NQ27_GuardStandMarker Auto
ObjectReference Property _00E_NQ27_OldManStandMarker Auto
ObjectReference Property _00E_NQ27_OldWomanStandMarker Auto
ObjectReference Property _00E_NQ27_MoveableWallREF Auto
ObjectReference Property _00E_NQ27_MoveablePostREF Auto

;questitems
ReferenceAlias Property Schuldschein Auto
ReferenceAlias Property Letter Auto

;lever for secret door
NorLever01SCRIPT Property _00E_NQ27_Lever01REF Auto
NorLever01SCRIPT Property _00E_NQ27_Lever02REF Auto
NorLever01SCRIPT Property _00E_NQ27_Lever03REF Auto

;scenes
Scene Property NQ27_SC01_DialogueInFrontOfHouse Auto