Mercurial > wow > wowdb-profiler
comparison Main.lua @ 41:7db268f39c50
Record fishing drops and drop count on a per-coordinate-pair basis. Record disenchanting/milling/prospecting/etc counts.
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Wed, 13 Jun 2012 12:29:43 -0500 |
| parents | 4ae5cde37458 |
| children | a2f1fcc1a813 |
comparison
equal
deleted
inserted
replaced
| 40:4ae5cde37458 | 41:7db268f39c50 |
|---|---|
| 253 local function UpdateDBEntryLocation(entry_type, identifier) | 253 local function UpdateDBEntryLocation(entry_type, identifier) |
| 254 if not identifier then | 254 if not identifier then |
| 255 return | 255 return |
| 256 end | 256 end |
| 257 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() | 257 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() |
| 258 local object = DBEntry(entry_type, identifier) | 258 local entry = DBEntry(entry_type, identifier) |
| 259 object[difficulty_token] = object[difficulty_token] or {} | 259 entry[difficulty_token] = entry[difficulty_token] or {} |
| 260 object[difficulty_token].locations = object[difficulty_token].locations or {} | 260 entry[difficulty_token].locations = entry[difficulty_token].locations or {} |
| 261 | 261 |
| 262 local zone_token = ("%s:%d"):format(zone_name, area_id) | 262 local zone_token = ("%s:%d"):format(zone_name, area_id) |
| 263 local zone_data = object[difficulty_token].locations[zone_token] | 263 local zone_data = entry[difficulty_token].locations[zone_token] |
| 264 | 264 |
| 265 if not zone_data then | 265 if not zone_data then |
| 266 zone_data = {} | 266 zone_data = {} |
| 267 object[difficulty_token].locations[zone_token] = zone_data | 267 entry[difficulty_token].locations[zone_token] = zone_data |
| 268 end | 268 end |
| 269 zone_data[("%s:%s:%s"):format(map_level, x, y)] = true | 269 local location_token = ("%s:%s:%s"):format(map_level, x, y) |
| 270 zone_data[location_token] = zone_data[location_token] or true | |
| 271 return zone_data | |
| 270 end | 272 end |
| 271 | 273 |
| 272 | 274 |
| 273 local function HandleItemUse(item_link, bag_index, slot_index) | 275 local function HandleItemUse(item_link, bag_index, slot_index) |
| 274 if not item_link then | 276 if not item_link then |
| 625 return _G.IsFishingLoot() | 627 return _G.IsFishingLoot() |
| 626 end, | 628 end, |
| 627 } | 629 } |
| 628 | 630 |
| 629 | 631 |
| 630 local function GenericLootUpdate(data_type, top_field) | 632 local function GenericLootUpdate(data_type, top_field, inline_drops) |
| 631 local entry = DBEntry(data_type, action_data.identifier) | 633 local entry = DBEntry(data_type, action_data.identifier) |
| 632 | 634 |
| 633 if not entry then | 635 if not entry then |
| 634 return | 636 return |
| 635 end | 637 end |
| 651 end | 653 end |
| 652 | 654 |
| 653 | 655 |
| 654 local LOOT_UPDATE_FUNCS = { | 656 local LOOT_UPDATE_FUNCS = { |
| 655 [AF.ITEM] = function() | 657 [AF.ITEM] = function() |
| 658 local item = DBEntry("items", action_data.identifier) | |
| 659 local loot_count = ("%s_count"):format(action_data.label or "drops") | |
| 660 item[loot_count] = (item[loot_count] or 0) + 1 | |
| 656 GenericLootUpdate("items") | 661 GenericLootUpdate("items") |
| 657 end, | 662 end, |
| 658 [AF.NPC] = function() | 663 [AF.NPC] = function() |
| 659 local npc = NPCEntry(action_data.identifier) | 664 local npc = NPCEntry(action_data.identifier) |
| 660 | 665 |
| 673 end, | 678 end, |
| 674 [AF.OBJECT] = function() | 679 [AF.OBJECT] = function() |
| 675 GenericLootUpdate("objects", InstanceDifficultyToken()) | 680 GenericLootUpdate("objects", InstanceDifficultyToken()) |
| 676 end, | 681 end, |
| 677 [AF.ZONE] = function() | 682 [AF.ZONE] = function() |
| 678 GenericLootUpdate("zones", InstanceDifficultyToken()) | 683 local location_token = ("%s:%s:%s"):format(action_data.map_level, action_data.x, action_data.y) |
| 684 | |
| 685 -- This will start life as a boolean true. | |
| 686 if _G.type(action_data.zone_data[location_token]) ~= "table" then | |
| 687 action_data.zone_data[location_token] = { | |
| 688 drops = {} | |
| 689 } | |
| 690 end | |
| 691 local loot_count = ("%s_count"):format(action_data.label or "drops") | |
| 692 action_data.zone_data[location_token][loot_count] = (action_data.zone_data[location_token][loot_count] or 0) + 1 | |
| 693 | |
| 694 for index = 1, #action_data.loot_list do | |
| 695 table.insert(action_data.zone_data[location_token].drops, action_data.loot_list[index]) | |
| 696 end | |
| 679 end, | 697 end, |
| 680 } | 698 } |
| 681 | 699 |
| 682 | 700 |
| 683 function WDP:LOOT_OPENED() | 701 function WDP:LOOT_OPENED() |
| 1092 | 1110 |
| 1093 action_data.type = AF.OBJECT | 1111 action_data.type = AF.OBJECT |
| 1094 action_data.identifier = identifier | 1112 action_data.identifier = identifier |
| 1095 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then | 1113 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then |
| 1096 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. | 1114 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. |
| 1097 UpdateDBEntryLocation("zones", identifier) | 1115 action_data.zone_data = UpdateDBEntryLocation("zones", identifier) |
| 1098 | |
| 1099 action_data.type = AF.ZONE | 1116 action_data.type = AF.ZONE |
| 1100 action_data.identifier = identifier | 1117 action_data.identifier = identifier |
| 1101 end | 1118 end |
| 1102 end | 1119 end |
| 1103 private.tracked_line = spell_line | 1120 private.tracked_line = spell_line |
