9
3

Sableveinrubblenode.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. --[[
  2. Script Name : SpawnScripts/Darklight/Sableveinrubble.lua
  3. Script Purpose : Sablevein Rubble
  4. Script Author : Cynnar
  5. Script Date : 10/13/2015
  6. Script Notes :
  7. --]]
  8. local SableveinRubble = 137
  9. function spawn(NPC)
  10. AddSpawnAccess(NPC, NPC)
  11. SetPlayerProximityFunction(NPC, 20, "SpawnAccess", "SpawnAccess")
  12. SetRequiredQuest(NPC, SableveinRubble, 1)
  13. end
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function SpawnAccess(NPC, Spawn)
  18. if HasQuest(Spawn, SableveinRubble) and tonumber(GetTempVariable(Spawn, "SableOre")) <= 6 then
  19. AddSpawnAccess(NPC, Spawn)
  20. end
  21. end
  22. function casted_on(Target, Caster, SpellName)
  23. local SableOreCount = tonumber(GetTempVariable(Player, "SableOre"))
  24. if SpellName == "harvest " then
  25. if HasQuest(Spawn, SableveinRubble) and tonumber(GetTempVariable(Spawn, "SableOre")) <= 6 then
  26. Despawn(NPC)
  27. SummonItem(Spawn, 11836)
  28. SetTempVariable(Spawn, "SableOre", SableOreCount + 1)
  29. elseif HasQuest(Spawn, SableveinRubble) and tonumber(GetTempVariable(Spawn, "SableOre")) == 6 then
  30. RemoveSpawnAccess(NPC, Player)
  31. end
  32. end
  33. end