comparison Main.lua @ 123:9b5dcdc5a1e8

current_action.type --> current_action.target_type
author James D. Callahan III <jcallahan@curse.com>
date Mon, 17 Sep 2012 15:44:12 -0500
parents 3c47401c3407
children 8669b4c43278
comparison
equal deleted inserted replaced
122:3c47401c3407 123:9b5dcdc5a1e8
132 loot_label = nil, 132 loot_label = nil,
133 loot_list = nil, 133 loot_list = nil,
134 loot_sources = nil, 134 loot_sources = nil,
135 map_level = nil, 135 map_level = nil,
136 spell_label = nil, 136 spell_label = nil,
137 type = nil, 137 target_type = nil,
138 x = nil, 138 x = nil,
139 y = nil, 139 y = nil,
140 zone_data = nil, 140 zone_data = nil,
141 } 141 }
142 142
346 break 346 break
347 end 347 end
348 348
349 if current_line:GetText() == _G.ITEM_OPENABLE then 349 if current_line:GetText() == _G.ITEM_OPENABLE then
350 table.wipe(current_action) 350 table.wipe(current_action)
351 current_action.type = AF.ITEM 351 current_action.target_type = AF.ITEM
352 current_action.identifier = item_id 352 current_action.identifier = item_id
353 current_action.loot_label = "contains" 353 current_action.loot_label = "contains"
354 break 354 break
355 end 355 end
356 end 356 end
422 422
423 if current_action.loot_sources then 423 if current_action.loot_sources then
424 for source_guid, loot_data in pairs(current_action.loot_sources) do 424 for source_guid, loot_data in pairs(current_action.loot_sources) do
425 local entry, source_id 425 local entry, source_id
426 426
427 if current_action.type == AF.ITEM then 427 if current_action.target_type == AF.ITEM then
428 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc) 428 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc)
429 source_id = current_action.identifier 429 source_id = current_action.identifier
430 entry = DBEntry(data_type, source_id) 430 entry = DBEntry(data_type, source_id)
431 elseif current_action.type == AF.OBJECT then 431 elseif current_action.target_type == AF.OBJECT then
432 source_id = ("%s:%s"):format(current_action.spell_label, select(2, ParseGUID(source_guid))) 432 source_id = ("%s:%s"):format(current_action.spell_label, select(2, ParseGUID(source_guid)))
433 entry = DBEntry(data_type, source_id) 433 entry = DBEntry(data_type, source_id)
434 else 434 else
435 source_id = select(2, ParseGUID(source_guid)) 435 source_id = select(2, ParseGUID(source_guid))
436 entry = DBEntry(data_type, source_id) 436 entry = DBEntry(data_type, source_id)
461 return 461 return
462 end 462 end
463 local entry 463 local entry
464 464
465 -- At this point we only have a name if it's an object. 465 -- At this point we only have a name if it's an object.
466 if current_action.type == AF.OBJECT then 466 if current_action.target_type == AF.OBJECT then
467 entry = DBEntry(data_type, ("%s:%s"):format(current_action.spell_label, current_action.object_name)) 467 entry = DBEntry(data_type, ("%s:%s"):format(current_action.spell_label, current_action.object_name))
468 else 468 else
469 entry = DBEntry(data_type, current_action.identifier) 469 entry = DBEntry(data_type, current_action.identifier)
470 end 470 end
471 471
663 end 663 end
664 end 664 end
665 name_to_id_map[_G.UnitName("target")] = unit_idnum 665 name_to_id_map[_G.UnitName("target")] = unit_idnum
666 666
667 table.wipe(current_action) 667 table.wipe(current_action)
668 current_action.type = AF.NPC 668 current_action.target_type = AF.NPC
669 current_action.identifier = unit_idnum 669 current_action.identifier = unit_idnum
670 return npc, unit_idnum 670 return npc, unit_idnum
671 end 671 end
672 end -- do-block 672 end -- do-block
673 673
1109 1109
1110 -- Prevent opening the same loot window multiple times from recording data multiple times. 1110 -- Prevent opening the same loot window multiple times from recording data multiple times.
1111 local loot_guid_registry = {} 1111 local loot_guid_registry = {}
1112 1112
1113 function WDP:LOOT_OPENED(event_name) 1113 function WDP:LOOT_OPENED(event_name)
1114 if current_action.looting or not current_action.type then 1114 if current_action.looting or not current_action.target_type then
1115 return 1115 return
1116 end 1116 end
1117 local verify_func = LOOT_VERIFY_FUNCS[current_action.type] 1117 local verify_func = LOOT_VERIFY_FUNCS[current_action.target_type]
1118 local update_func = LOOT_UPDATE_FUNCS[current_action.type] 1118 local update_func = LOOT_UPDATE_FUNCS[current_action.target_type]
1119 1119
1120 if not verify_func or not update_func then 1120 if not verify_func or not update_func then
1121 return 1121 return
1122 end 1122 end
1123 1123
1621 if tt_unit_name and not tt_item_name then 1621 if tt_unit_name and not tt_item_name then
1622 if bit.band(spell_flags, AF.NPC) == AF.NPC then 1622 if bit.band(spell_flags, AF.NPC) == AF.NPC then
1623 if not tt_unit_id or tt_unit_name ~= target_name then 1623 if not tt_unit_id or tt_unit_name ~= target_name then
1624 return 1624 return
1625 end 1625 end
1626 current_action.type = AF.NPC 1626 current_action.target_type = AF.NPC
1627 end 1627 end
1628 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then 1628 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then
1629 current_action.type = AF.ITEM 1629 current_action.target_type = AF.ITEM
1630 1630
1631 if tt_item_name and tt_item_name == target_name then 1631 if tt_item_name and tt_item_name == target_name then
1632 current_action.identifier = ItemLinkToID(tt_item_link) 1632 current_action.identifier = ItemLinkToID(tt_item_link)
1633 elseif target_name and target_name ~= "" then 1633 elseif target_name and target_name ~= "" then
1634 local _, target_item_link = _G.GetItemInfo(target_name) 1634 local _, target_item_link = _G.GetItemInfo(target_name)
1638 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then 1638 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then
1639 if target_name == "" then 1639 if target_name == "" then
1640 return 1640 return
1641 end 1641 end
1642 current_action.object_name = target_name 1642 current_action.object_name = target_name
1643 current_action.type = AF.OBJECT 1643 current_action.target_type = AF.OBJECT
1644 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then 1644 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
1645 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. 1645 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name.
1646 current_action.zone_data = UpdateDBEntryLocation("zones", identifier) 1646 current_action.zone_data = UpdateDBEntryLocation("zones", identifier)
1647 current_action.type = AF.ZONE 1647 current_action.target_type = AF.ZONE
1648 current_action.identifier = identifier 1648 current_action.identifier = identifier
1649 end 1649 end
1650 end 1650 end
1651 private.tracked_line = spell_line 1651 private.tracked_line = spell_line
1652 end 1652 end