changeset 132:05b77c08b211

Simplification for loot labels. Set target type for loot to NPC if none is listed on the current action, since the only reason it would be otherwise is via a spell.
author James D. Callahan III <jcallahan@curse.com>
date Fri, 21 Sep 2012 12:00:26 -0500
parents 35da36cc87f0
children a6e36b3f51d6
files Main.lua
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Fri Sep 21 11:19:36 2012 -0500
+++ b/Main.lua	Fri Sep 21 12:00:26 2012 -0500
@@ -441,7 +441,7 @@
     end
 
     function GenericLootUpdate(data_type, top_field)
-        local loot_type = current_loot.label or "drops"
+        local loot_type = current_loot.label
         local loot_count = ("%s_count"):format(loot_type)
         local source_list = {}
 
@@ -795,7 +795,7 @@
             ("%d:%d"):format(item_id, quantity)
         },
         identifier = current_action.identifier,
-        label = current_action.loot_label,
+        label = current_action.loot_label or "drops",
         map_level = current_action.map_level,
         object_name = current_action.object_name,
         spell_label = current_action.spell_label,
@@ -1094,7 +1094,7 @@
         end,
         [AF.NPC] = function()
             local difficulty_token = InstanceDifficultyToken()
-            local loot_type = current_loot.label or "drops"
+            local loot_type = current_loot.label
             local source_list = {}
 
             for source_guid, loot_data in pairs(current_loot.sources) do
@@ -1150,7 +1150,7 @@
                     drops = {}
                 }
             end
-            local loot_count = ("%s_count"):format(current_loot.label or "drops")
+            local loot_count = ("%s_count"):format(current_loot.label)
             current_loot.zone_data[location_token][loot_count] = (current_loot.zone_data[location_token][loot_count] or 0) + 1
 
             if current_loot.sources then
@@ -1182,9 +1182,11 @@
 
 
     function WDP:LOOT_OPENED(event_name)
-        if current_loot or not current_action.target_type then
+        if current_loot then
             return
         end
+        current_action.target_type = current_action.target_type or AF.NPC
+
         local verify_func = LOOT_VERIFY_FUNCS[current_action.target_type]
         local update_func = LOOT_UPDATE_FUNCS[current_action.target_type]
 
@@ -1196,11 +1198,12 @@
             return
         end
         local guids_used = {}
+
         current_loot = {
             list = {},
             sources = {},
             identifier = current_action.identifier,
-            label = current_action.loot_label,
+            label = current_action.loot_label or "drops",
             map_level = current_action.map_level,
             object_name = current_action.object_name,
             spell_label = current_action.spell_label,