--[[
    Script Name    : SpawnScripts/QueensColony/PaulaMarx.lua
    Script Author  : Zcoretri
    Script Date    : 2015.07.30
    Script Purpose : Paula Marx dialog
	Modified Date  : 2017.04.13
	Modified by    : EmemJr
	Notes		   : Added dialog and code for Turning in collections
--]]


function spawn(NPC)

    MovementLoopAddLocation(NPC, 5.65, -6.50, 208.26, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 0.71, -5.83, 198.18, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 10.66, -6.90, 200.55, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 18.65, -6.87, 194.36, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 26.80, -6.86, 187.05, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 31.08, -6.24, 197.45, 2, 10, "Gather")

    MovementLoopAddLocation(NPC, 9.11, -6.80, 206.29, 2, 10, "Gather")

    -- return to spawn point and hang out.
    MovementLoopAddLocation(NPC, -6.18, -4.96, 218.46, 2, 0)
    MovementLoopAddLocation(NPC, -5.91, -4.96, 218.24, 2, 30)
end

function respawn(NPC)
    spawn(NPC)
end

function hailed(NPC, Spawn)
    FaceTarget(NPC, Spawn)
    conversation = CreateConversation()

    --if (player has a collection then add a convesation option to hand in a collection
    --end
    PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_2_1003.mp3", "", "", 0, 0, Spawn)
    AddConversationOption(conversation, "What Collections?","WhatCollections")
    if HasCollectionsToHandIn(Spawn) then
        AddConversationOption(conversation, "I have a collection for you", "TurnIn")

    end
		AddConversationOption(conversation, "Goodbye!")
		StartConversation(conversation, NPC, Spawn, "Hello, traveler!  How I envy you. What I wouldn't give to journey the world as I did in my youth.  Alas, my days of adventuring are long past, but at least I can occupy myself with my various trinkets and collections that I picked up in my travels.")
end

function Gather(NPC)
    GatherSpawn = GetSpawn(NPC, 2530009)		-- Get Paula Marx
    SpawnSet(NPC, "visual_state", "2809")	-- Start gathering
    AddTimer(NPC, 5000, "stop_gathering")		-- for 5 seconds, then stop
end

function stop_gathering(NPC)
    GatherSpawn = GetSpawn(NPC, 2530009)		-- get Paula Marx
    SpawnSet(NPC, "visual_state", "0") 	-- Stop her from gathering
end
function WhatCollections(NPC, Spawn)
	FaceTarget(NPC, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "I'll keep that in mind.")
	StartConversation(conversation, NPC, Spawn, "Why, any sort of collection. There's so much out there to find! Just open your eyes and peek under the rocks.  If you find anything interesting, let me have a look. Collecting is the only way I seem to relive my youth!")
end

function TurnIn(NPC, Spawn)
	FaceTarget(NPC, Spawn)
	HandInCollections(Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "Okay,bye!")
	StartConversation(conversation, NPC, Spawn, "This is a magnificent find!  Here, take this for all your hard work.")
end
