changeset 105:f9c81739cfe6

Changed labeling on action_data fields to be more explicit. Don't set loot_label on non-loot spells.
author James D. Callahan III <jcallahan@curse.com>
date Wed, 05 Sep 2012 09:05:04 -0500
parents 1bb078930f23
children 64d1e76e69e5
files Constants.lua Main.lua
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Tue Sep 04 11:54:47 2012 -0500
+++ b/Constants.lua	Wed Sep 05 09:05:04 2012 -0500
@@ -63,6 +63,10 @@
     [_G.GetSpellInfo(8613)] = "SKINNING",
 }
 
+private.NON_LOOT_SPELL_LABELS = {
+    MIND_CONTROL = true,
+}
+
 local AF = private.ACTION_TYPE_FLAGS
 
 private.SPELL_FLAGS_BY_LABEL = {
--- a/Main.lua	Tue Sep 04 11:54:47 2012 -0500
+++ b/Main.lua	Wed Sep 05 09:05:04 2012 -0500
@@ -355,7 +355,7 @@
             table.wipe(action_data)
             action_data.type = AF.ITEM
             action_data.identifier = item_id
-            action_data.label = "contains"
+            action_data.loot_label = "contains"
             break
         end
     end
@@ -421,7 +421,7 @@
     end
 
     function GenericLootUpdate(data_type, top_field)
-        local loot_type = action_data.label or "drops"
+        local loot_type = action_data.loot_label or "drops"
         local loot_count = ("%s_count"):format(loot_type)
         local source_list = {}
 
@@ -933,7 +933,7 @@
         end,
         [AF.NPC] = function()
             local difficulty_token = InstanceDifficultyToken()
-            local loot_type = action_data.label or "drops"
+            local loot_type = action_data.loot_label or "drops"
             local source_list = {}
 
             for source_guid, loot_data in pairs(action_data.loot_sources) do
@@ -989,7 +989,7 @@
                     drops = {}
                 }
             end
-            local loot_count = ("%s_count"):format(action_data.label or "drops")
+            local loot_count = ("%s_count"):format(action_data.loot_label or "drops")
             action_data.zone_data[location_token][loot_count] = (action_data.zone_data[location_token][loot_count] or 0) + 1
 
             for index = 1, #action_data.loot_list do
@@ -1210,7 +1210,7 @@
 
 
 function WDP:PET_BAR_UPDATE(event_name)
-    if not action_data.label or not action_data.label == "mind_control" then
+    if action_data.spell_label ~= "MIND_CONTROL" then
         return
     end
     local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet"))
@@ -1546,7 +1546,10 @@
     action_data.y = y
     action_data.zone = ("%s:%d"):format(zone_name, area_id)
     action_data.spell_label = spell_label
-    action_data.label = spell_label:lower()
+
+    if not private.NON_LOOT_SPELL_LABELS[spell_label] then
+        action_data.loot_label = spell_label:lower()
+    end
 
     if tt_unit_name and not tt_item_name then
         if bit.band(spell_flags, AF.NPC) == AF.NPC then