Mercurial > wow > wowdb-profiler
comparison Main.lua @ 38:934022ee6e52
Record fishing pools; changed non-pool data format to align with this, but have "NONE" instead of the pool's name.
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Mon, 11 Jun 2012 14:42:13 -0500 |
| parents | d9333f3e0c7a |
| children | 938abe259516 |
comparison
equal
deleted
inserted
replaced
| 37:d9333f3e0c7a | 38:934022ee6e52 |
|---|---|
| 208 zone_data[("%s:%s:%s"):format(map_level, x, y)] = true | 208 zone_data[("%s:%s:%s"):format(map_level, x, y)] = true |
| 209 end | 209 end |
| 210 end -- do-block | 210 end -- do-block |
| 211 | 211 |
| 212 | 212 |
| 213 local function UpdateObjectLocation(identifier) | 213 local function UpdateDBEntryLocation(entry_type, identifier) |
| 214 if not identifier then | 214 if not identifier then |
| 215 return | 215 return |
| 216 end | 216 end |
| 217 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() | 217 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() |
| 218 local object = DBEntry("objects", identifier) | 218 local object = DBEntry(entry_type, identifier) |
| 219 object[difficulty_token] = object[difficulty_token] or {} | 219 object[difficulty_token] = object[difficulty_token] or {} |
| 220 object[difficulty_token].locations = object[difficulty_token].locations or {} | 220 object[difficulty_token].locations = object[difficulty_token].locations or {} |
| 221 | 221 |
| 222 local zone_token = ("%s:%d"):format(zone_name, area_id) | 222 local zone_token = ("%s:%d"):format(zone_name, area_id) |
| 223 local zone_data = object[difficulty_token].locations[zone_token] | 223 local zone_data = object[difficulty_token].locations[zone_token] |
| 531 action_data.identifier = id_num | 531 action_data.identifier = id_num |
| 532 return true | 532 return true |
| 533 end, | 533 end, |
| 534 [AF.OBJECT] = true, | 534 [AF.OBJECT] = true, |
| 535 [AF.ZONE] = function() | 535 [AF.ZONE] = function() |
| 536 return action_data.label and _G.IsFishingLoot() | 536 return _G.IsFishingLoot() |
| 537 end, | 537 end, |
| 538 } | 538 } |
| 539 | 539 |
| 540 | 540 |
| 541 local function GenericLootUpdate(data_type, top_field) | 541 local function GenericLootUpdate(data_type, top_field) |
| 584 end, | 584 end, |
| 585 [AF.OBJECT] = function() | 585 [AF.OBJECT] = function() |
| 586 GenericLootUpdate("objects", InstanceDifficultyToken()) | 586 GenericLootUpdate("objects", InstanceDifficultyToken()) |
| 587 end, | 587 end, |
| 588 [AF.ZONE] = function() | 588 [AF.ZONE] = function() |
| 589 local loot_type = action_data.label or "drops" | 589 GenericLootUpdate("zones", InstanceDifficultyToken()) |
| 590 local zone = DBEntry("zones", action_data.zone) | |
| 591 zone[action_data.instance_token] = zone[action_data.instance_token] or {} | |
| 592 zone[action_data.instance_token][loot_type] = zone[action_data.instance_token][loot_type] or {} | |
| 593 | |
| 594 local location_data = ("%s:%s:%s"):format(action_data.map_level, action_data.x, action_data.y) | |
| 595 local loot_data = zone[action_data.instance_token][loot_type][location_data] | |
| 596 | |
| 597 if not loot_data then | |
| 598 zone[action_data.instance_token][loot_type][location_data] = {} | |
| 599 loot_data = zone[action_data.instance_token][loot_type][location_data] | |
| 600 end | |
| 601 | |
| 602 for index = 1, #action_data.loot_list do | |
| 603 table.insert(loot_data, action_data.loot_list[index]) | |
| 604 end | |
| 605 end, | 590 end, |
| 606 } | 591 } |
| 607 | 592 |
| 608 | 593 |
| 609 function WDP:LOOT_OPENED() | 594 function WDP:LOOT_OPENED() |
| 864 return | 849 return |
| 865 end | 850 end |
| 866 local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc")) | 851 local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc")) |
| 867 | 852 |
| 868 if unit_type == private.UNIT_TYPES.OBJECT then | 853 if unit_type == private.UNIT_TYPES.OBJECT then |
| 869 UpdateObjectLocation(unit_id) | 854 UpdateDBEntryLocation("objects", unit_id) |
| 870 end | 855 end |
| 871 local quest = DBEntry("quests", _G.GetQuestID()) | 856 local quest = DBEntry("quests", _G.GetQuestID()) |
| 872 quest[point] = quest[point] or {} | 857 quest[point] = quest[point] or {} |
| 873 quest[point][("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type + 1], unit_id)] = true | 858 quest[point][("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type + 1], unit_id)] = true |
| 874 | 859 |
| 893 end | 878 end |
| 894 end -- do-block | 879 end -- do-block |
| 895 | 880 |
| 896 | 881 |
| 897 function WDP:QUEST_LOG_UPDATE() | 882 function WDP:QUEST_LOG_UPDATE() |
| 898 local selected_quest = _G.GetQuestLogSelection() -- Save current selection to be restored when we're done. | 883 local selected_quest = _G.GetQuestLogSelection() -- Save current selection to be restored when we're done. |
| 899 local entry_index, processed_quests = 1, 0 | 884 local entry_index, processed_quests = 1, 0 |
| 900 local _, num_quests = _G.GetNumQuestLogEntries() | 885 local _, num_quests = _G.GetNumQuestLogEntries() |
| 901 | 886 |
| 902 while processed_quests <= num_quests do | 887 while processed_quests <= num_quests do |
| 903 local _, _, _, _, is_header, _, _, _, quest_id = _G.GetQuestLogTitle(entry_index) | 888 local _, _, _, _, is_header, _, _, _, quest_id = _G.GetQuestLogTitle(entry_index) |
| 1028 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then | 1013 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then |
| 1029 if target_name == "" then | 1014 if target_name == "" then |
| 1030 return | 1015 return |
| 1031 end | 1016 end |
| 1032 local identifier = ("%s:%s"):format(spell_label, target_name) | 1017 local identifier = ("%s:%s"):format(spell_label, target_name) |
| 1033 UpdateObjectLocation(identifier) | 1018 UpdateDBEntryLocation("objects", identifier) |
| 1034 | 1019 |
| 1035 action_data.type = AF.OBJECT | 1020 action_data.type = AF.OBJECT |
| 1036 action_data.identifier = identifier | 1021 action_data.identifier = identifier |
| 1037 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then | 1022 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then |
| 1023 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. | |
| 1024 UpdateDBEntryLocation("zones", identifier) | |
| 1025 | |
| 1038 action_data.type = AF.ZONE | 1026 action_data.type = AF.ZONE |
| 1039 action_data.label = spell_label:lower() | 1027 action_data.identifier = identifier |
| 1040 end | 1028 end |
| 1041 end | 1029 end |
| 1042 private.tracked_line = spell_line | 1030 private.tracked_line = spell_line |
| 1043 end | 1031 end |
| 1044 | 1032 |
