Scriptname _00E_NQ24_LeveledListCheck extends ObjectReference
{Ensures that the housing documents as well as the blueprint storage book are only sold once}

Event OnTriggerEnter (ObjectReference akActionRef)

	If akActionRef == PlayerREF
		If _00E_NQ24_PlayerHouseMarketOwned.GetValueInt() == 0
			_00E_NQ24_LeveledListHouseMarket.AddForm(_00E_Game_Playerhouse_ArkMarket_Document, 1, 1)
			VendorItemsBanker.AddForm(VendorItemPropertyArkMarket)
		ElseIf _00E_NQ24_PlayerHouseMarketOwned.GetValueInt() == 1
			_00E_NQ24_LeveledListHouseMarket.Revert()
			VendorItemsBanker.RemoveAddedForm(VendorItemPropertyArkMarket)
		EndIf
		
		If _00E_NQ24_PlayerHouseNobleOwned.GetValueInt() == 0
			_00E_NQ24_LeveledListHouseNoble.AddForm(_00E_Game_Playerhouse_UpperCity_Document, 1, 1)
			VendorItemsBanker.AddForm(VendorItemPropertyArkUpperCity)
		ElseIf _00E_NQ24_PlayerHouseNobleOwned.GetValueInt() == 1
			_00E_NQ24_LeveledListHouseNoble.Revert()
			VendorItemsBanker.RemoveAddedForm(VendorItemPropertyArkUpperCity)
		EndIf
		
		;not NQ24 related but still needs to be handled the same way, did not want to create a new script
		If _00E_FS_BlueprintContainerBookOwned.GetValueInt() == 0
			_00E_FS_LeveledListBlueprintContainer.AddForm(_00E_FS_BlueprintContainerBook, 1, 1)
			VendorItemsBanker.AddForm(VendorItemFSBlueprintContainer)
		ElseIf _00E_FS_BlueprintContainerBookOwned.GetValueInt() == 1
			_00E_FS_LeveledListBlueprintContainer.Revert()
			VendorItemsBanker.RemoveAddedForm(VendorItemFSBlueprintContainer)
		EndIf

		;just for FS_NQ07
		If _00E_FS_NQ07_DoorOwned.GetValueInt() == 0 && FS_NQ07.GetCurrentStageID() >= 115
			_00E_FS_NQ07_LeveledListDoor.AddForm(_00E_FS_NQ07_MiscDoor, 1, 1)
			VendorItemsBanker.AddForm(_00E_FS_NQ07_VendorNoSale)
		ElseIf _00E_FS_NQ07_DoorOwned.GetValueInt() == 1
			_00E_FS_NQ07_LeveledListDoor.Revert()
			VendorItemsBanker.RemoveAddedForm(_00E_FS_NQ07_VendorNoSale)
		EndIf
	EndIf

EndEvent

Actor Property PlayerREF Auto

Quest Property FS_NQ07 Auto

GlobalVariable Property _00E_NQ24_PlayerHouseMarketOwned Auto
GlobalVariable Property _00E_NQ24_PlayerHouseNobleOwned Auto
GlobalVariable Property _00E_FS_BlueprintContainerBookOwned Auto
GlobalVariable Property _00E_FS_NQ07_DoorOwned Auto

FormList Property VendorItemsBanker Auto

LeveledItem Property _00E_NQ24_LeveledListHouseMarket Auto
LeveledItem Property _00E_NQ24_LeveledListHouseNoble Auto
LeveledItem Property _00E_FS_LeveledListBlueprintContainer Auto
LeveledItem Property _00E_FS_NQ07_LeveledListDoor Auto

MiscObject Property _00E_Game_Playerhouse_ArkMarket_Document Auto
MiscObject Property _00E_Game_Playerhouse_UpperCity_Document Auto
Book Property _00E_FS_BlueprintContainerBook Auto
MiscObject Property _00E_FS_NQ07_MiscDoor Auto

Keyword Property VendorItemPropertyArkMarket Auto
Keyword Property VendorItemPropertyArkUpperCity Auto
Keyword Property VendorItemFSBlueprintContainer Auto
Keyword Property _00E_FS_NQ07_VendorNoSale Auto