changeset 98:6b118dd1baf4

Mark NPCs which generate reputation from being harvested as such (MoP crops). Remove reputation_npc_id as soon as it is no longer needed to prevent false-positives.
author James D. Callahan III <jcallahan@curse.com>
date Fri, 31 Aug 2012 10:18:03 -0500
parents f6369b88454f
children 2b8471a4e84c
files Main.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Thu Aug 30 15:45:43 2012 -0500
+++ b/Main.lua	Fri Aug 31 10:18:03 2012 -0500
@@ -508,8 +508,6 @@
         end
         return text
     end
-
-
 end -- do-block
 
 
@@ -733,6 +731,7 @@
 
             if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
                 reputation_npc_id = nil
+                private.harvesting = nil
                 return
             end
             reputation_npc_id = unit_idnum
@@ -825,10 +824,15 @@
             return
         end
         local npc = NPCEntry(reputation_npc_id)
+        reputation_npc_id = nil
 
         if not npc then
+            private.harvesting = nil
             return
         end
+        npc.harvested = private.harvesting
+        private.harvesting = nil
+
         local modifier = 1
 
         if _G.IsSpellKnown(DIPLOMACY_SPELL_ID) then
@@ -852,7 +856,6 @@
         end
         npc.reputations = npc.reputations or {}
         npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier)
-        reputation_npc_id = nil
     end
 end -- do-block
 
@@ -1588,6 +1591,7 @@
 
     if spell_name:match("^Harvest.+") then
         reputation_npc_id = current_target_id
+        private.harvesting = true
     end
 
     if anvil_spell_ids[spell_id] then