apurespirit.lua 951 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --[[
  2. Script Name : SpawnScripts/Darklight/apurespirit.lua
  3. Script Purpose : Add spawn access and update for queset Reaping (152)
  4. Script Author : Cynnar
  5. Script Date : 1/3/2016
  6. Script Notes : a pure spirit (341050)
  7. --]]
  8. local Reaping = 152
  9. function spawn(NPC)
  10. AddSpawnAccess(NPC, NPC)
  11. SetPlayerProximityFunction(NPC, 50, "SpawnAccess", "SpawnAccess")
  12. end
  13. function respawn(NPC)
  14. spawn(NPC)
  15. end
  16. function casted_on(NPC, Spawn, SpellName)
  17. if SpellName == "Reap" then
  18. if HasQuest(Spawn, Reaping) and HasItem(Spawn, 48173) then
  19. AddStepProgress(Spawn, Reaping, 1, 1)
  20. Despawn(NPC)
  21. else
  22. SetStepComplete(Spawn, Reaping, 2)
  23. end
  24. end
  25. end
  26. function SpawnAccess(NPC, Spawn)
  27. if HasQuest(Spawn, Reaping) then
  28. AddSpawnAccess(NPC, Spawn)
  29. elseif HasQuest(Spawn, Reaping) and GetQuestStep(Spawn, Reaping ) < 2 then
  30. AddSpawnAccess(NPC, Spawn)
  31. else
  32. RemoveSpawnAccess(NPC, Spawn)
  33. end
  34. end