Mercurial > wow > wowdb-profiler
comparison Main.lua @ 122:3c47401c3407
action_data --> current_action
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 17 Sep 2012 15:02:44 -0500 |
parents | ea4e4d3cc673 |
children | 9b5dcdc5a1e8 |
comparison
equal
deleted
inserted
replaced
121:ea4e4d3cc673 | 122:3c47401c3407 |
---|---|
125 local current_target_id | 125 local current_target_id |
126 | 126 |
127 ----------------------------------------------------------------------- | 127 ----------------------------------------------------------------------- |
128 -- Data for our current action. Including possible values as a reference. | 128 -- Data for our current action. Including possible values as a reference. |
129 ----------------------------------------------------------------------- | 129 ----------------------------------------------------------------------- |
130 local action_data = { | 130 local current_action = { |
131 identifier = nil, | 131 identifier = nil, |
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 type = nil, |
138 x = nil, | 138 x = nil, |
139 y = nil, | 139 y = nil, |
140 zone_data = nil, | 140 zone_data = nil, |
141 | |
142 } | 141 } |
143 | 142 |
144 ----------------------------------------------------------------------- | 143 ----------------------------------------------------------------------- |
145 -- Helper Functions. | 144 -- Helper Functions. |
146 ----------------------------------------------------------------------- | 145 ----------------------------------------------------------------------- |
346 if not current_line then | 345 if not current_line then |
347 break | 346 break |
348 end | 347 end |
349 | 348 |
350 if current_line:GetText() == _G.ITEM_OPENABLE then | 349 if current_line:GetText() == _G.ITEM_OPENABLE then |
351 table.wipe(action_data) | 350 table.wipe(current_action) |
352 action_data.type = AF.ITEM | 351 current_action.type = AF.ITEM |
353 action_data.identifier = item_id | 352 current_action.identifier = item_id |
354 action_data.loot_label = "contains" | 353 current_action.loot_label = "contains" |
355 break | 354 break |
356 end | 355 end |
357 end | 356 end |
358 end | 357 end |
359 | 358 |
415 entry[loot_type] = entry[loot_type] or {} | 414 entry[loot_type] = entry[loot_type] or {} |
416 return entry[loot_type] | 415 return entry[loot_type] |
417 end | 416 end |
418 | 417 |
419 function GenericLootUpdate(data_type, top_field) | 418 function GenericLootUpdate(data_type, top_field) |
420 local loot_type = action_data.loot_label or "drops" | 419 local loot_type = current_action.loot_label or "drops" |
421 local loot_count = ("%s_count"):format(loot_type) | 420 local loot_count = ("%s_count"):format(loot_type) |
422 local source_list = {} | 421 local source_list = {} |
423 | 422 |
424 if action_data.loot_sources then | 423 if current_action.loot_sources then |
425 for source_guid, loot_data in pairs(action_data.loot_sources) do | 424 for source_guid, loot_data in pairs(current_action.loot_sources) do |
426 local entry, source_id | 425 local entry, source_id |
427 | 426 |
428 if action_data.type == AF.ITEM then | 427 if current_action.type == AF.ITEM then |
429 -- 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) |
430 source_id = action_data.identifier | 429 source_id = current_action.identifier |
431 entry = DBEntry(data_type, source_id) | 430 entry = DBEntry(data_type, source_id) |
432 elseif action_data.type == AF.OBJECT then | 431 elseif current_action.type == AF.OBJECT then |
433 source_id = ("%s:%s"):format(action_data.spell_label, select(2, ParseGUID(source_guid))) | 432 source_id = ("%s:%s"):format(current_action.spell_label, select(2, ParseGUID(source_guid))) |
434 entry = DBEntry(data_type, source_id) | 433 entry = DBEntry(data_type, source_id) |
435 else | 434 else |
436 source_id = select(2, ParseGUID(source_guid)) | 435 source_id = select(2, ParseGUID(source_guid)) |
437 entry = DBEntry(data_type, source_id) | 436 entry = DBEntry(data_type, source_id) |
438 end | 437 end |
456 end | 455 end |
457 end | 456 end |
458 end | 457 end |
459 | 458 |
460 -- This is used for Gas Extractions. | 459 -- This is used for Gas Extractions. |
461 if #action_data.loot_list <= 0 then | 460 if #current_action.loot_list <= 0 then |
462 return | 461 return |
463 end | 462 end |
464 local entry | 463 local entry |
465 | 464 |
466 -- 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. |
467 if action_data.type == AF.OBJECT then | 466 if current_action.type == AF.OBJECT then |
468 entry = DBEntry(data_type, ("%s:%s"):format(action_data.spell_label, action_data.object_name)) | 467 entry = DBEntry(data_type, ("%s:%s"):format(current_action.spell_label, current_action.object_name)) |
469 else | 468 else |
470 entry = DBEntry(data_type, action_data.identifier) | 469 entry = DBEntry(data_type, current_action.identifier) |
471 end | 470 end |
472 | 471 |
473 if not entry then | 472 if not entry then |
474 return | 473 return |
475 end | 474 end |
476 local loot_table = LootTable(entry, loot_type, top_field) | 475 local loot_table = LootTable(entry, loot_type, top_field) |
477 | 476 |
478 if not source_list[action_data.identifier] then | 477 if not source_list[current_action.identifier] then |
479 if top_field then | 478 if top_field then |
480 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 | 479 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1 |
481 else | 480 else |
482 entry[loot_count] = (entry[loot_count] or 0) + 1 | 481 entry[loot_count] = (entry[loot_count] or 0) + 1 |
483 end | 482 end |
484 end | 483 end |
485 | 484 |
486 for index = 1, #action_data.loot_list do | 485 for index = 1, #current_action.loot_list do |
487 table.insert(loot_table, action_data.loot_list[index]) | 486 table.insert(loot_table, current_action.loot_list[index]) |
488 end | 487 end |
489 end | 488 end |
490 end -- do-block | 489 end -- do-block |
491 | 490 |
492 | 491 |
663 encounter_data[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) | 662 encounter_data[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) |
664 end | 663 end |
665 end | 664 end |
666 name_to_id_map[_G.UnitName("target")] = unit_idnum | 665 name_to_id_map[_G.UnitName("target")] = unit_idnum |
667 | 666 |
668 table.wipe(action_data) | 667 table.wipe(current_action) |
669 action_data.type = AF.NPC | 668 current_action.type = AF.NPC |
670 action_data.identifier = unit_idnum | 669 current_action.identifier = unit_idnum |
671 return npc, unit_idnum | 670 return npc, unit_idnum |
672 end | 671 end |
673 end -- do-block | 672 end -- do-block |
674 | 673 |
675 | 674 |
731 end | 730 end |
732 end | 731 end |
733 | 732 |
734 | 733 |
735 function WDP:CHAT_MSG_LOOT(event_name, message) | 734 function WDP:CHAT_MSG_LOOT(event_name, message) |
736 if action_data.spell_label ~= "EXTRACT_GAS" then | 735 if current_action.spell_label ~= "EXTRACT_GAS" then |
737 return | 736 return |
738 end | 737 end |
739 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) | 738 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) |
740 | 739 |
741 if not item_link then | 740 if not item_link then |
748 local item_id = ItemLinkToID(item_link) | 747 local item_id = ItemLinkToID(item_link) |
749 | 748 |
750 if not item_id then | 749 if not item_id then |
751 return | 750 return |
752 end | 751 end |
753 action_data.loot_list = { | 752 current_action.loot_list = { |
754 ("%d:%d"):format(item_id, quantity) | 753 ("%d:%d"):format(item_id, quantity) |
755 } | 754 } |
756 GenericLootUpdate("zones") | 755 GenericLootUpdate("zones") |
757 table.wipe(action_data) | 756 table.wipe(current_action) |
758 end | 757 end |
759 | 758 |
760 | 759 |
761 function WDP:RecordQuote(event_name, message, source_name, language_name) | 760 function WDP:RecordQuote(event_name, message, source_name, language_name) |
762 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then | 761 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then |
1014 locked_item_id = ItemLinkToID(_G.GetContainerItemLink(bag_index, slot_index)) | 1013 locked_item_id = ItemLinkToID(_G.GetContainerItemLink(bag_index, slot_index)) |
1015 end | 1014 end |
1016 end | 1015 end |
1017 end | 1016 end |
1018 | 1017 |
1019 if not locked_item_id or (action_data.identifier and action_data.identifier ~= locked_item_id) then | 1018 if not locked_item_id or (current_action.identifier and current_action.identifier ~= locked_item_id) then |
1020 return false | 1019 return false |
1021 end | 1020 end |
1022 action_data.identifier = locked_item_id | 1021 current_action.identifier = locked_item_id |
1023 return true | 1022 return true |
1024 end, | 1023 end, |
1025 [AF.NPC] = function() | 1024 [AF.NPC] = function() |
1026 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then | 1025 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then |
1027 return false | 1026 return false |
1028 end | 1027 end |
1029 local unit_type, id_num = ParseGUID(_G.UnitGUID("target")) | 1028 local unit_type, id_num = ParseGUID(_G.UnitGUID("target")) |
1030 action_data.identifier = id_num | 1029 current_action.identifier = id_num |
1031 return true | 1030 return true |
1032 end, | 1031 end, |
1033 [AF.OBJECT] = true, | 1032 [AF.OBJECT] = true, |
1034 [AF.ZONE] = function() | 1033 [AF.ZONE] = function() |
1035 return _G.IsFishingLoot() | 1034 return _G.IsFishingLoot() |
1041 [AF.ITEM] = function() | 1040 [AF.ITEM] = function() |
1042 GenericLootUpdate("items") | 1041 GenericLootUpdate("items") |
1043 end, | 1042 end, |
1044 [AF.NPC] = function() | 1043 [AF.NPC] = function() |
1045 local difficulty_token = InstanceDifficultyToken() | 1044 local difficulty_token = InstanceDifficultyToken() |
1046 local loot_type = action_data.loot_label or "drops" | 1045 local loot_type = current_action.loot_label or "drops" |
1047 local source_list = {} | 1046 local source_list = {} |
1048 | 1047 |
1049 for source_guid, loot_data in pairs(action_data.loot_sources) do | 1048 for source_guid, loot_data in pairs(current_action.loot_sources) do |
1050 local source_id = select(2, ParseGUID(source_guid)) | 1049 local source_id = select(2, ParseGUID(source_guid)) |
1051 local npc = NPCEntry(source_id) | 1050 local npc = NPCEntry(source_id) |
1052 | 1051 |
1053 if npc then | 1052 if npc then |
1054 local encounter_data = npc.encounter_data[difficulty_token] | 1053 local encounter_data = npc.encounter_data[difficulty_token] |
1065 end | 1064 end |
1066 end | 1065 end |
1067 end | 1066 end |
1068 | 1067 |
1069 -- TODO: Remove this when GetLootSourceInfo() has values for money | 1068 -- TODO: Remove this when GetLootSourceInfo() has values for money |
1070 if #action_data.loot_list <= 0 then | 1069 if #current_action.loot_list <= 0 then |
1071 return | 1070 return |
1072 end | 1071 end |
1073 local npc = NPCEntry(action_data.identifier) | 1072 local npc = NPCEntry(current_action.identifier) |
1074 | 1073 |
1075 if not npc then | 1074 if not npc then |
1076 return | 1075 return |
1077 end | 1076 end |
1078 local encounter_data = npc.encounter_data[difficulty_token] | 1077 local encounter_data = npc.encounter_data[difficulty_token] |
1079 encounter_data[loot_type] = encounter_data[loot_type] or {} | 1078 encounter_data[loot_type] = encounter_data[loot_type] or {} |
1080 | 1079 |
1081 if not source_list[action_data.identifier] then | 1080 if not source_list[current_action.identifier] then |
1082 encounter_data.loot_counts = encounter_data.loot_counts or {} | 1081 encounter_data.loot_counts = encounter_data.loot_counts or {} |
1083 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 | 1082 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 |
1084 end | 1083 end |
1085 | 1084 |
1086 for index = 1, #action_data.loot_list do | 1085 for index = 1, #current_action.loot_list do |
1087 table.insert(encounter_data[loot_type], action_data.loot_list[index]) | 1086 table.insert(encounter_data[loot_type], current_action.loot_list[index]) |
1088 end | 1087 end |
1089 end, | 1088 end, |
1090 [AF.OBJECT] = function() | 1089 [AF.OBJECT] = function() |
1091 GenericLootUpdate("objects", InstanceDifficultyToken()) | 1090 GenericLootUpdate("objects", InstanceDifficultyToken()) |
1092 end, | 1091 end, |
1093 [AF.ZONE] = function() | 1092 [AF.ZONE] = function() |
1094 local location_token = ("%s:%s:%s"):format(action_data.map_level, action_data.x, action_data.y) | 1093 local location_token = ("%s:%s:%s"):format(current_action.map_level, current_action.x, current_action.y) |
1095 | 1094 |
1096 -- This will start life as a boolean true. | 1095 -- This will start life as a boolean true. |
1097 if _G.type(action_data.zone_data[location_token]) ~= "table" then | 1096 if _G.type(current_action.zone_data[location_token]) ~= "table" then |
1098 action_data.zone_data[location_token] = { | 1097 current_action.zone_data[location_token] = { |
1099 drops = {} | 1098 drops = {} |
1100 } | 1099 } |
1101 end | 1100 end |
1102 local loot_count = ("%s_count"):format(action_data.loot_label or "drops") | 1101 local loot_count = ("%s_count"):format(current_action.loot_label or "drops") |
1103 action_data.zone_data[location_token][loot_count] = (action_data.zone_data[location_token][loot_count] or 0) + 1 | 1102 current_action.zone_data[location_token][loot_count] = (current_action.zone_data[location_token][loot_count] or 0) + 1 |
1104 | 1103 |
1105 for index = 1, #action_data.loot_list do | 1104 for index = 1, #current_action.loot_list do |
1106 table.insert(action_data.zone_data[location_token].drops, action_data.loot_list[index]) | 1105 table.insert(current_action.zone_data[location_token].drops, current_action.loot_list[index]) |
1107 end | 1106 end |
1108 end, | 1107 end, |
1109 } | 1108 } |
1110 | 1109 |
1111 -- 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. |
1112 local loot_guid_registry = {} | 1111 local loot_guid_registry = {} |
1113 | 1112 |
1114 function WDP:LOOT_OPENED(event_name) | 1113 function WDP:LOOT_OPENED(event_name) |
1115 if action_data.looting or not action_data.type then | 1114 if current_action.looting or not current_action.type then |
1116 return | 1115 return |
1117 end | 1116 end |
1118 local verify_func = LOOT_VERIFY_FUNCS[action_data.type] | 1117 local verify_func = LOOT_VERIFY_FUNCS[current_action.type] |
1119 local update_func = LOOT_UPDATE_FUNCS[action_data.type] | 1118 local update_func = LOOT_UPDATE_FUNCS[current_action.type] |
1120 | 1119 |
1121 if not verify_func or not update_func then | 1120 if not verify_func or not update_func then |
1122 return | 1121 return |
1123 end | 1122 end |
1124 | 1123 |
1125 if _G.type(verify_func) == "function" and not verify_func() then | 1124 if _G.type(verify_func) == "function" and not verify_func() then |
1126 return | 1125 return |
1127 end | 1126 end |
1128 local guids_used = {} | 1127 local guids_used = {} |
1129 action_data.loot_list = {} | 1128 current_action.loot_list = {} |
1130 action_data.loot_sources = {} | 1129 current_action.loot_sources = {} |
1131 action_data.looting = true | 1130 current_action.looting = true |
1132 | 1131 |
1133 for loot_slot = 1, _G.GetNumLootItems() do | 1132 for loot_slot = 1, _G.GetNumLootItems() do |
1134 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) | 1133 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) |
1135 local slot_type = _G.GetLootSlotType(loot_slot) | 1134 local slot_type = _G.GetLootSlotType(loot_slot) |
1136 | 1135 |
1153 -- TODO: Remove debugging | 1152 -- TODO: Remove debugging |
1154 -- local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) | 1153 -- local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id) |
1155 -- print(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) | 1154 -- print(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity)) |
1156 | 1155 |
1157 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) | 1156 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) |
1158 action_data.loot_sources[source_guid] = action_data.loot_sources[source_guid] or {} | 1157 current_action.loot_sources[source_guid] = current_action.loot_sources[source_guid] or {} |
1159 action_data.loot_sources[source_guid][item_id] = action_data.loot_sources[source_guid][item_id] or 0 + loot_quantity | 1158 current_action.loot_sources[source_guid][item_id] = current_action.loot_sources[source_guid][item_id] or 0 + loot_quantity |
1160 guids_used[source_guid] = true | 1159 guids_used[source_guid] = true |
1161 end | 1160 end |
1162 end | 1161 end |
1163 -- elseif slot_type == _G.LOOT_SLOT_MONEY then | 1162 -- elseif slot_type == _G.LOOT_SLOT_MONEY then |
1164 -- table.insert(action_data.loot_list, ("money:%d"):format(_toCopper(item_text))) | 1163 -- table.insert(current_action.loot_list, ("money:%d"):format(_toCopper(item_text))) |
1165 elseif slot_type == _G.LOOT_SLOT_CURRENCY then | 1164 elseif slot_type == _G.LOOT_SLOT_CURRENCY then |
1166 table.insert(action_data.loot_list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) | 1165 table.insert(current_action.loot_list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower())) |
1167 end | 1166 end |
1168 end | 1167 end |
1169 | 1168 |
1170 for guid in pairs(guids_used) do | 1169 for guid in pairs(guids_used) do |
1171 loot_guid_registry[guid] = true | 1170 loot_guid_registry[guid] = true |
1172 end | 1171 end |
1173 update_func() | 1172 update_func() |
1174 table.wipe(action_data) | 1173 table.wipe(current_action) |
1175 end | 1174 end |
1176 end -- do-block | 1175 end -- do-block |
1177 | 1176 |
1178 | 1177 |
1179 function WDP:MAIL_SHOW(event_name) | 1178 function WDP:MAIL_SHOW(event_name) |
1315 end | 1314 end |
1316 end -- do-block | 1315 end -- do-block |
1317 | 1316 |
1318 | 1317 |
1319 function WDP:PET_BAR_UPDATE(event_name) | 1318 function WDP:PET_BAR_UPDATE(event_name) |
1320 if action_data.spell_label ~= "MIND_CONTROL" then | 1319 if current_action.spell_label ~= "MIND_CONTROL" then |
1321 return | 1320 return |
1322 end | 1321 end |
1323 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet")) | 1322 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet")) |
1324 | 1323 |
1325 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 1324 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
1326 return | 1325 return |
1327 end | 1326 end |
1328 NPCEntry(unit_idnum).mind_control = true | 1327 NPCEntry(unit_idnum).mind_control = true |
1329 table.wipe(action_data) | 1328 table.wipe(current_action) |
1330 end | 1329 end |
1331 | 1330 |
1332 | 1331 |
1333 function WDP:PET_JOURNAL_LIST_UPDATE(event_name) | 1332 function WDP:PET_JOURNAL_LIST_UPDATE(event_name) |
1334 local num_pets = LPJ:NumPets() | 1333 local num_pets = LPJ:NumPets() |
1594 local spell_label = private.SPELL_LABELS_BY_NAME[spell_name] | 1593 local spell_label = private.SPELL_LABELS_BY_NAME[spell_name] |
1595 | 1594 |
1596 if not spell_label then | 1595 if not spell_label then |
1597 return | 1596 return |
1598 end | 1597 end |
1599 table.wipe(action_data) | 1598 table.wipe(current_action) |
1600 | 1599 |
1601 local tt_item_name, tt_item_link = _G.GameTooltip:GetItem() | 1600 local tt_item_name, tt_item_link = _G.GameTooltip:GetItem() |
1602 local tt_unit_name, tt_unit_id = _G.GameTooltip:GetUnit() | 1601 local tt_unit_name, tt_unit_id = _G.GameTooltip:GetUnit() |
1603 | 1602 |
1604 if not tt_unit_name and _G.UnitName("target") == target_name then | 1603 if not tt_unit_name and _G.UnitName("target") == target_name then |
1606 tt_unit_id = "target" | 1605 tt_unit_id = "target" |
1607 end | 1606 end |
1608 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] | 1607 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] |
1609 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() | 1608 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() |
1610 | 1609 |
1611 action_data.instance_token = instance_token | 1610 current_action.instance_token = instance_token |
1612 action_data.map_level = map_level | 1611 current_action.map_level = map_level |
1613 action_data.x = x | 1612 current_action.x = x |
1614 action_data.y = y | 1613 current_action.y = y |
1615 action_data.zone_data = ("%s:%d"):format(zone_name, area_id) | 1614 current_action.zone_data = ("%s:%d"):format(zone_name, area_id) |
1616 action_data.spell_label = spell_label | 1615 current_action.spell_label = spell_label |
1617 | 1616 |
1618 if not private.NON_LOOT_SPELL_LABELS[spell_label] then | 1617 if not private.NON_LOOT_SPELL_LABELS[spell_label] then |
1619 action_data.loot_label = spell_label:lower() | 1618 current_action.loot_label = spell_label:lower() |
1620 end | 1619 end |
1621 | 1620 |
1622 if tt_unit_name and not tt_item_name then | 1621 if tt_unit_name and not tt_item_name then |
1623 if bit.band(spell_flags, AF.NPC) == AF.NPC then | 1622 if bit.band(spell_flags, AF.NPC) == AF.NPC then |
1624 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 |
1625 return | 1624 return |
1626 end | 1625 end |
1627 action_data.type = AF.NPC | 1626 current_action.type = AF.NPC |
1628 end | 1627 end |
1629 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then | 1628 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then |
1630 action_data.type = AF.ITEM | 1629 current_action.type = AF.ITEM |
1631 | 1630 |
1632 if tt_item_name and tt_item_name == target_name then | 1631 if tt_item_name and tt_item_name == target_name then |
1633 action_data.identifier = ItemLinkToID(tt_item_link) | 1632 current_action.identifier = ItemLinkToID(tt_item_link) |
1634 elseif target_name and target_name ~= "" then | 1633 elseif target_name and target_name ~= "" then |
1635 local _, target_item_link = _G.GetItemInfo(target_name) | 1634 local _, target_item_link = _G.GetItemInfo(target_name) |
1636 action_data.identifier = ItemLinkToID(target_item_link) | 1635 current_action.identifier = ItemLinkToID(target_item_link) |
1637 end | 1636 end |
1638 elseif not tt_item_name and not tt_unit_name then | 1637 elseif not tt_item_name and not tt_unit_name then |
1639 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then | 1638 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then |
1640 if target_name == "" then | 1639 if target_name == "" then |
1641 return | 1640 return |
1642 end | 1641 end |
1643 action_data.object_name = target_name | 1642 current_action.object_name = target_name |
1644 action_data.type = AF.OBJECT | 1643 current_action.type = AF.OBJECT |
1645 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then | 1644 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then |
1646 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. |
1647 action_data.zone_data = UpdateDBEntryLocation("zones", identifier) | 1646 current_action.zone_data = UpdateDBEntryLocation("zones", identifier) |
1648 action_data.type = AF.ZONE | 1647 current_action.type = AF.ZONE |
1649 action_data.identifier = identifier | 1648 current_action.identifier = identifier |
1650 end | 1649 end |
1651 end | 1650 end |
1652 private.tracked_line = spell_line | 1651 private.tracked_line = spell_line |
1653 end | 1652 end |
1654 | 1653 |
1677 return | 1676 return |
1678 end | 1677 end |
1679 | 1678 |
1680 if private.tracked_line == spell_line then | 1679 if private.tracked_line == spell_line then |
1681 private.tracked_line = nil | 1680 private.tracked_line = nil |
1682 table.wipe(action_data) | 1681 table.wipe(current_action) |
1683 end | 1682 end |
1684 end | 1683 end |
1685 | 1684 |
1686 | 1685 |
1687 do | 1686 do |