Mercurial > wow > wowdb-profiler
comparison Main.lua @ 345:61a9520b5337 WoD
Added support for collecting Timber locations and drop contents. Fixed occassional mining/herb data being classified as zone data.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Fri, 03 Oct 2014 15:18:01 -0400 |
parents | 7bca9a0f9382 |
children | 04343b25c612 |
comparison
equal
deleted
inserted
replaced
344:7bca9a0f9382 | 345:61a9520b5337 |
---|---|
156 local loot_toast_data_timer_handle | 156 local loot_toast_data_timer_handle |
157 local name_to_id_map = {} | 157 local name_to_id_map = {} |
158 local killed_boss_id_timer_handle | 158 local killed_boss_id_timer_handle |
159 local killed_npc_id | 159 local killed_npc_id |
160 local target_location_timer_handle | 160 local target_location_timer_handle |
161 local last_timber_spell_id | |
161 local current_target_id | 162 local current_target_id |
162 local current_area_id | 163 local current_area_id |
163 local current_loot | 164 local current_loot |
164 | 165 |
165 | 166 |
1355 | 1356 |
1356 | 1357 |
1357 do | 1358 do |
1358 local CHAT_MSG_LOOT_UPDATE_FUNCS = { | 1359 local CHAT_MSG_LOOT_UPDATE_FUNCS = { |
1359 [AF.NPC] = function(item_id, quantity) | 1360 [AF.NPC] = function(item_id, quantity) |
1360 Debug("CHAT_MSG_LOOT: %d (%d)", item_id, quantity) | 1361 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) |
1362 end, | |
1363 [AF.OBJECT] = function(item_id, quantity) | |
1364 Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity) | |
1365 for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do | |
1366 -- Check for top level object data | |
1367 local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant])) | |
1368 local difficulty_token = InstanceDifficultyToken() | |
1369 if object_entry[difficulty_token] then | |
1370 -- Increment loot count | |
1371 object_entry[difficulty_token]["opening_count"] = object_entry[difficulty_token]["opening_count"] or 0 + 1 | |
1372 | |
1373 -- Add drop data | |
1374 local loot_table = LootTable(object_entry, "opening", difficulty_token) | |
1375 table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) | |
1376 else | |
1377 Debug("CHAT_MSG_LOOT: When handling timber, the top level loot data was missing for objectID %s.", private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant]) | |
1378 end | |
1379 end | |
1361 end, | 1380 end, |
1362 [AF.ZONE] = function(item_id, quantity) | 1381 [AF.ZONE] = function(item_id, quantity) |
1382 Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity) | |
1363 InitializeCurrentLoot() | 1383 InitializeCurrentLoot() |
1364 current_loot.list[1] = ("%d:%d"):format(item_id, quantity) | 1384 current_loot.list[1] = ("%d:%d"):format(item_id, quantity) |
1365 GenericLootUpdate("zones") | 1385 GenericLootUpdate("zones") |
1366 current_loot = nil | 1386 current_loot = nil |
1367 end, | 1387 end, |
1369 | 1389 |
1370 | 1390 |
1371 function WDP:CHAT_MSG_LOOT(event_name, message) | 1391 function WDP:CHAT_MSG_LOOT(event_name, message) |
1372 local category | 1392 local category |
1373 | 1393 |
1374 if current_action.spell_label ~= "EXTRACT_GAS" then | 1394 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) |
1395 if not item_link then | |
1396 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) | |
1397 end | |
1398 local item_id = ItemLinkToID(item_link) | |
1399 | |
1400 if not item_id then | |
1401 return | |
1402 end | |
1403 | |
1404 -- Set update category | |
1405 if last_timber_spell_id and item_id == TIMBER_ITEM_ID then | |
1406 category = AF.OBJECT | |
1407 -- Recently changed from ~= "EXTRACT_GAS" because of some occassional bad data, and, as far as I know, no benefit. | |
1408 elseif current_action.spell_label == "FISHING" then | |
1375 category = AF.ZONE | 1409 category = AF.ZONE |
1376 elseif private.raid_boss_id then | 1410 elseif private.raid_boss_id then |
1377 category = AF.NPC | 1411 category = AF.NPC |
1378 end | 1412 end |
1413 | |
1414 -- Take action based on update category | |
1379 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] | 1415 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] |
1380 | |
1381 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) | |
1382 | |
1383 if not item_link then | |
1384 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) | |
1385 end | |
1386 local item_id = ItemLinkToID(item_link) | |
1387 | |
1388 if not item_id then | |
1389 return | |
1390 end | |
1391 | |
1392 if not category or not update_func then | 1416 if not category or not update_func then |
1393 -- We still want to record the item's data, even if it doesn't need its drop location recorded | 1417 -- We still want to record the item's data, even if it doesn't need its drop location recorded |
1394 RecordItemData(item_id, item_link, true) | 1418 RecordItemData(item_id, item_link, true) |
1395 return | 1419 return |
1396 end | 1420 end |
2570 return | 2594 return |
2571 end | 2595 end |
2572 private.tracked_line = nil | 2596 private.tracked_line = nil |
2573 private.previous_spell_id = spell_id | 2597 private.previous_spell_id = spell_id |
2574 | 2598 |
2599 -- Handle Logging spell casts | |
2600 if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then | |
2601 last_timber_spell_id = spell_id | |
2602 for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do | |
2603 UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id][timber_variant])) | |
2604 end | |
2605 return | |
2606 end | |
2607 | |
2608 -- Handle Loot Toast spell casts | |
2575 if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then | 2609 if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then |
2576 ClearKilledBossID() | 2610 ClearKilledBossID() |
2577 ClearLootToastContainerID() | 2611 ClearLootToastContainerID() |
2578 ClearLootToastData() | 2612 ClearLootToastData() |
2579 | 2613 |
2580 private.loot_toast_container_id = private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] | 2614 private.loot_toast_container_id = private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] |
2581 loot_toast_container_timer_handle = WDP:ScheduleTimer(ClearLootToastContainerID, 1) -- we need to assign a handle here to cancel it later | 2615 loot_toast_container_timer_handle = WDP:ScheduleTimer(ClearLootToastContainerID, 1) -- we need to assign a handle here to cancel it later |
2616 return | |
2582 end | 2617 end |
2583 | 2618 |
2584 if anvil_spell_ids[spell_id] then | 2619 if anvil_spell_ids[spell_id] then |
2585 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) | 2620 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) |
2586 elseif forge_spell_ids[spell_id] then | 2621 elseif forge_spell_ids[spell_id] then |