Mercurial > wow > wowdb-profiler
comparison Main.lua @ 349:146072e39150 WoD
Fixed Salvage crate loot recording.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Sat, 04 Oct 2014 07:09:24 -0400 |
parents | 9f352e20204c |
children | 37c27a7509c4 |
comparison
equal
deleted
inserted
replaced
348:9f352e20204c | 349:146072e39150 |
---|---|
51 -- Ignoring NPC casts of the following spells | 51 -- Ignoring NPC casts of the following spells |
52 local CHI_WAVE_SPELL_ID = 132464 | 52 local CHI_WAVE_SPELL_ID = 132464 |
53 local DISGUISE_SPELL_ID = 121308 | 53 local DISGUISE_SPELL_ID = 121308 |
54 | 54 |
55 -- For timer-based loot gathering of abnormal containers (that don't use SHOW_LOOT_TOAST, sadly) | 55 -- For timer-based loot gathering of abnormal containers (that don't use SHOW_LOOT_TOAST, sadly) |
56 local BAG_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168178] | |
56 local CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168179] | 57 local CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168179] |
57 local BIG_CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168180] | 58 local BIG_CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168180] |
58 | 59 |
59 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid | 60 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid |
60 local DUPLICATE_WORLD_BOSS_IDS = { | 61 local DUPLICATE_WORLD_BOSS_IDS = { |
863 end | 864 end |
864 end | 865 end |
865 | 866 |
866 | 867 |
867 local function ClearTimeBasedLootData() | 868 local function ClearTimeBasedLootData() |
869 Debug("ClearTimeBasedLootData: Ending salvage loot timer.") | |
868 if chat_loot_timer_handle then | 870 if chat_loot_timer_handle then |
869 WDP:CancelTimer(chat_loot_timer_handle) | 871 WDP:CancelTimer(chat_loot_timer_handle) |
870 chat_loot_timer_handle = nil | 872 chat_loot_timer_handle = nil |
871 end | 873 end |
872 | 874 |
873 if current_loot and current_loot.identifier and (current_loot.identifier == CRATE_OF_SALVAGE_ITEM_ID or current_loot.identifier == BIG_CRATE_OF_SALVAGE_ITEM_ID) then | 875 if current_loot and current_loot.identifier and (current_loot.identifier == BAG_OF_SALVAGE_ITEM_ID or current_loot.identifier == CRATE_OF_SALVAGE_ITEM_ID or current_loot.identifier == BIG_CRATE_OF_SALVAGE_ITEM_ID) then |
874 GenericLootUpdate("items") | 876 GenericLootUpdate("items") |
875 end | 877 end |
876 current_loot = nil | 878 current_loot = nil |
877 end | 879 end |
878 | 880 |
1376 | 1378 |
1377 | 1379 |
1378 do | 1380 do |
1379 local CHAT_MSG_LOOT_UPDATE_FUNCS = { | 1381 local CHAT_MSG_LOOT_UPDATE_FUNCS = { |
1380 [AF.ITEM] = function(item_id, quantity) | 1382 [AF.ITEM] = function(item_id, quantity) |
1381 local container_id = current_action.identifier -- For faster access, since this is going to be called 9 times in the next 3 lines | 1383 local container_id = current_loot.identifier -- For faster access, since this is going to be called 9 times in the next 3 lines |
1382 -- Verify that we're still assigning data to the right items | 1384 -- Verify that we're still assigning data to the right items |
1383 if container_id and container_id == CRATE_OF_SALVAGE_ITEM_ID or container_id == BIG_CRATE_OF_SALVAGE_ITEM_ID then | 1385 if container_id and (container_id == BAG_OF_SALVAGE_ITEM_ID or container_id == CRATE_OF_SALVAGE_ITEM_ID or container_id == BIG_CRATE_OF_SALVAGE_ITEM_ID) then |
1384 Debug("CHAT_MSG_LOOT: AF.ITEM %d (%d)", item_id, quantity) | 1386 Debug("CHAT_MSG_LOOT: AF.ITEM %d (%d)", item_id, quantity) |
1385 InitializeCurrentLoot() | |
1386 current_loot.sources[container_id] = current_loot.sources[container_id] or {} | 1387 current_loot.sources[container_id] = current_loot.sources[container_id] or {} |
1387 current_loot.sources[container_id][item_id] = current_loot.sources[container_id][item_id] or 0 + quantity | 1388 current_loot.sources[container_id][item_id] = current_loot.sources[container_id][item_id] or 0 + quantity |
1388 else -- If not, cancel the timer and wipe the loot table early | 1389 else -- If not, cancel the timer and wipe the loot table early |
1389 Debug("CHAT_MSG_LOOT: We would have assigned the wrong loot to salvage crates!") | 1390 Debug("CHAT_MSG_LOOT: We would have assigned the wrong loot to salvage crates!") |
1390 WDP:CancelTimer(chat_loot_timer_handle) | 1391 ClearTimeBasedLootData() |
1391 chat_loot_timer_handle = nil | |
1392 table.wipe(current_action) | |
1393 current_loot = nil | |
1394 end | 1392 end |
1395 end, | 1393 end, |
1396 [AF.NPC] = function(item_id, quantity) | 1394 [AF.NPC] = function(item_id, quantity) |
1397 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) | 1395 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) |
1398 end, | 1396 end, |
2655 end | 2653 end |
2656 | 2654 |
2657 -- For Crates of Salvage (and potentially other items based on spell casts in the future which need manual handling) | 2655 -- For Crates of Salvage (and potentially other items based on spell casts in the future which need manual handling) |
2658 if private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then | 2656 if private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then |
2659 -- Set up timer | 2657 -- Set up timer |
2660 chat_loot_timer_handle = WDP:ScheduleTimer(ClearTimeBasedLootData, 0.5) | 2658 Debug("%s: Beginning Salvage loot timer for spellID %d", event_name, spell_id) |
2659 chat_loot_timer_handle = WDP:ScheduleTimer(ClearTimeBasedLootData, 1) | |
2661 | 2660 |
2662 -- Standard item handling setup | 2661 -- Standard item handling setup |
2663 table.wipe(current_action) | 2662 table.wipe(current_action) |
2664 current_loot = nil | 2663 current_loot = nil |
2665 current_action.target_type = AF.ITEM | 2664 current_action.target_type = AF.ITEM |
2666 current_action.identifier = item_id | 2665 current_action.identifier = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[spell_id] |
2667 current_action.loot_label = "contains" | 2666 current_action.loot_label = "contains" |
2667 InitializeCurrentLoot() | |
2668 return | 2668 return |
2669 end | 2669 end |
2670 | 2670 |
2671 if anvil_spell_ids[spell_id] then | 2671 if anvil_spell_ids[spell_id] then |
2672 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) | 2672 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL) |