comparison Main.lua @ 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
comparison
equal deleted inserted replaced
104:1bb078930f23 105:f9c81739cfe6
353 353
354 if current_line:GetText() == _G.ITEM_OPENABLE then 354 if current_line:GetText() == _G.ITEM_OPENABLE then
355 table.wipe(action_data) 355 table.wipe(action_data)
356 action_data.type = AF.ITEM 356 action_data.type = AF.ITEM
357 action_data.identifier = item_id 357 action_data.identifier = item_id
358 action_data.label = "contains" 358 action_data.loot_label = "contains"
359 break 359 break
360 end 360 end
361 end 361 end
362 end 362 end
363 363
419 entry[loot_type] = entry[loot_type] or {} 419 entry[loot_type] = entry[loot_type] or {}
420 return entry[loot_type] 420 return entry[loot_type]
421 end 421 end
422 422
423 function GenericLootUpdate(data_type, top_field) 423 function GenericLootUpdate(data_type, top_field)
424 local loot_type = action_data.label or "drops" 424 local loot_type = action_data.loot_label or "drops"
425 local loot_count = ("%s_count"):format(loot_type) 425 local loot_count = ("%s_count"):format(loot_type)
426 local source_list = {} 426 local source_list = {}
427 427
428 for source_guid, loot_data in pairs(action_data.loot_sources) do 428 for source_guid, loot_data in pairs(action_data.loot_sources) do
429 local entry, source_id 429 local entry, source_id
931 [AF.ITEM] = function() 931 [AF.ITEM] = function()
932 GenericLootUpdate("items") 932 GenericLootUpdate("items")
933 end, 933 end,
934 [AF.NPC] = function() 934 [AF.NPC] = function()
935 local difficulty_token = InstanceDifficultyToken() 935 local difficulty_token = InstanceDifficultyToken()
936 local loot_type = action_data.label or "drops" 936 local loot_type = action_data.loot_label or "drops"
937 local source_list = {} 937 local source_list = {}
938 938
939 for source_guid, loot_data in pairs(action_data.loot_sources) do 939 for source_guid, loot_data in pairs(action_data.loot_sources) do
940 local source_id = select(2, ParseGUID(source_guid)) 940 local source_id = select(2, ParseGUID(source_guid))
941 local npc = NPCEntry(source_id) 941 local npc = NPCEntry(source_id)
987 if _G.type(action_data.zone_data[location_token]) ~= "table" then 987 if _G.type(action_data.zone_data[location_token]) ~= "table" then
988 action_data.zone_data[location_token] = { 988 action_data.zone_data[location_token] = {
989 drops = {} 989 drops = {}
990 } 990 }
991 end 991 end
992 local loot_count = ("%s_count"):format(action_data.label or "drops") 992 local loot_count = ("%s_count"):format(action_data.loot_label or "drops")
993 action_data.zone_data[location_token][loot_count] = (action_data.zone_data[location_token][loot_count] or 0) + 1 993 action_data.zone_data[location_token][loot_count] = (action_data.zone_data[location_token][loot_count] or 0) + 1
994 994
995 for index = 1, #action_data.loot_list do 995 for index = 1, #action_data.loot_list do
996 table.insert(action_data.zone_data[location_token].drops, action_data.loot_list[index]) 996 table.insert(action_data.zone_data[location_token].drops, action_data.loot_list[index])
997 end 997 end
1208 end 1208 end
1209 end -- do-block 1209 end -- do-block
1210 1210
1211 1211
1212 function WDP:PET_BAR_UPDATE(event_name) 1212 function WDP:PET_BAR_UPDATE(event_name)
1213 if not action_data.label or not action_data.label == "mind_control" then 1213 if action_data.spell_label ~= "MIND_CONTROL" then
1214 return 1214 return
1215 end 1215 end
1216 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet")) 1216 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet"))
1217 1217
1218 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then 1218 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
1544 action_data.map_level = map_level 1544 action_data.map_level = map_level
1545 action_data.x = x 1545 action_data.x = x
1546 action_data.y = y 1546 action_data.y = y
1547 action_data.zone = ("%s:%d"):format(zone_name, area_id) 1547 action_data.zone = ("%s:%d"):format(zone_name, area_id)
1548 action_data.spell_label = spell_label 1548 action_data.spell_label = spell_label
1549 action_data.label = spell_label:lower() 1549
1550 if not private.NON_LOOT_SPELL_LABELS[spell_label] then
1551 action_data.loot_label = spell_label:lower()
1552 end
1550 1553
1551 if tt_unit_name and not tt_item_name then 1554 if tt_unit_name and not tt_item_name then
1552 if bit.band(spell_flags, AF.NPC) == AF.NPC then 1555 if bit.band(spell_flags, AF.NPC) == AF.NPC then
1553 if not tt_unit_id or tt_unit_name ~= target_name then 1556 if not tt_unit_id or tt_unit_name ~= target_name then
1554 return 1557 return