Mercurial > wow > wowdb-profiler
comparison Main.lua @ 427:181c7f8cd087 6.0.3-8
Removed hacky workaround for duplicate world bosses, since the only use was in MoP and nobody will care about that boss now.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Tue, 13 Jan 2015 03:48:22 -0500 |
parents | de0795cfbe56 |
children | 95af8e72aa19 |
comparison
equal
deleted
inserted
replaced
426:de0795cfbe56 | 427:181c7f8cd087 |
---|---|
56 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) | 56 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) |
57 | 57 |
58 local LOOT_SLOT_CURRENCY = _G.LOOT_SLOT_CURRENCY | 58 local LOOT_SLOT_CURRENCY = _G.LOOT_SLOT_CURRENCY |
59 local LOOT_SLOT_ITEM = _G.LOOT_SLOT_ITEM | 59 local LOOT_SLOT_ITEM = _G.LOOT_SLOT_ITEM |
60 local LOOT_SLOT_MONEY = _G.LOOT_SLOT_MONEY | 60 local LOOT_SLOT_MONEY = _G.LOOT_SLOT_MONEY |
61 | |
62 -- 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 | |
63 local DUPLICATE_WORLD_BOSS_IDS = { | |
64 [71952] = { 71953, 71954, 71955, }, | |
65 } | |
66 | 61 |
67 local ALLOWED_LOCALES = { | 62 local ALLOWED_LOCALES = { |
68 enUS = true, | 63 enUS = true, |
69 enGB = true, | 64 enGB = true, |
70 enTW = true, | 65 enTW = true, |
1385 end | 1380 end |
1386 else | 1381 else |
1387 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link) | 1382 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link) |
1388 end | 1383 end |
1389 elseif raid_boss_id then | 1384 elseif raid_boss_id then |
1390 -- Slightly messy hack to workaround duplicate world bosses | 1385 local npc = NPCEntry(raid_boss_id) |
1391 local upper_limit = 0 | 1386 if npc then |
1392 if DUPLICATE_WORLD_BOSS_IDS[raid_boss_id] then | 1387 local loot_label = "drops" |
1393 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[raid_boss_id] | 1388 local encounter_data = npc:EncounterData(InstanceDifficultyToken()) |
1394 end | 1389 encounter_data[loot_label] = encounter_data[loot_label] or {} |
1395 for i = 0, upper_limit do | 1390 encounter_data.loot_counts = encounter_data.loot_counts or {} |
1396 local temp_npc_id = raid_boss_id | 1391 |
1397 | 1392 if loot_type == "item" then |
1398 if i > 0 then | 1393 local item_id = ItemLinkToID(item_link) |
1399 temp_npc_id = DUPLICATE_WORLD_BOSS_IDS[raid_boss_id][i] | 1394 if item_id then |
1400 end | 1395 Debug("%s: %s X %d (%d)", event_name, item_link, quantity, item_id) |
1401 | 1396 RecordItemData(item_id, item_link, true) |
1402 local npc = NPCEntry(temp_npc_id) | 1397 table.insert(encounter_data[loot_label], ("%d:%d"):format(item_id, quantity)) |
1403 if npc then | 1398 else |
1404 local loot_label = "drops" | 1399 Debug("%s: ItemID is nil, from item link %s", event_name, item_link) |
1405 local encounter_data = npc:EncounterData(InstanceDifficultyToken()) | 1400 return |
1406 encounter_data[loot_label] = encounter_data[loot_label] or {} | 1401 end |
1407 encounter_data.loot_counts = encounter_data.loot_counts or {} | 1402 elseif loot_type == "money" then |
1408 | 1403 Debug("%s: money X %d", event_name, quantity) |
1409 if loot_type == "item" then | 1404 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) |
1410 local item_id = ItemLinkToID(item_link) | 1405 elseif loot_type == "currency" then |
1411 if item_id then | 1406 local currency_texture = CurrencyLinkToTexture(item_link) |
1412 Debug("%s: %s X %d (%d)", event_name, item_link, quantity, item_id) | 1407 if currency_texture and currency_texture ~= "" then |
1413 RecordItemData(item_id, item_link, true) | 1408 Debug("%s: %s X %d", event_name, currency_texture, quantity) |
1414 table.insert(encounter_data[loot_label], ("%d:%d"):format(item_id, quantity)) | 1409 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) |
1415 else | 1410 else |
1416 Debug("%s: ItemID is nil, from item link %s", event_name, item_link) | 1411 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link) |
1417 return | 1412 return |
1418 end | 1413 end |
1419 elseif loot_type == "money" then | 1414 end |
1420 Debug("%s: money X %d", event_name, quantity) | 1415 |
1421 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) | 1416 if not boss_loot_toasting[raid_boss_id] then |
1422 elseif loot_type == "currency" then | 1417 encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1 |
1423 local currency_texture = CurrencyLinkToTexture(item_link) | 1418 boss_loot_toasting[raid_boss_id] = true -- Do not count further loots until timer expires or another boss is killed |
1424 if currency_texture and currency_texture ~= "" then | |
1425 Debug("%s: %s X %d", event_name, currency_texture, quantity) | |
1426 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) | |
1427 else | |
1428 Debug("%s: Currency texture is nil, from currency link %s", event_name, item_link) | |
1429 return | |
1430 end | |
1431 end | |
1432 | |
1433 if not boss_loot_toasting[temp_npc_id] then | |
1434 encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1 | |
1435 boss_loot_toasting[temp_npc_id] = true -- Do not count further loots until timer expires or another boss is killed | |
1436 end | |
1437 end | 1419 end |
1438 end | 1420 end |
1439 elseif loot_toast_container_id then | 1421 elseif loot_toast_container_id then |
1440 InitializeCurrentLoot() | 1422 InitializeCurrentLoot() |
1441 | 1423 |
2803 return | 2785 return |
2804 end | 2786 end |
2805 | 2787 |
2806 -- Assign existing loot data to boss if it exists | 2788 -- Assign existing loot data to boss if it exists |
2807 if loot_toast_data then | 2789 if loot_toast_data then |
2808 local npc_id = raid_boss_id | 2790 local npc = NPCEntry(raid_boss_id) |
2809 | 2791 if npc then |
2810 -- Slightly messy hack to workaround duplicate world bosses | 2792 -- Create needed npc fields if required |
2811 local upper_limit = 0 | 2793 local loot_label = "drops" |
2812 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then | 2794 local encounter_data = npc:EncounterData(InstanceDifficultyToken()) |
2813 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id] | 2795 encounter_data[loot_label] = encounter_data[loot_label] or {} |
2814 end | 2796 encounter_data.loot_counts = encounter_data.loot_counts or {} |
2815 | 2797 |
2816 for i = 0, upper_limit do | 2798 for index = 1, #loot_toast_data do |
2817 local temp_npc_id = npc_id | 2799 local data = loot_toast_data[index] |
2818 | 2800 local loot_type = data[1] |
2819 if i > 0 then | 2801 local hyperlink = data[2] |
2820 temp_npc_id = DUPLICATE_WORLD_BOSS_IDS[npc_id][i] | 2802 local quantity = data[3] |
2821 end | 2803 |
2822 | 2804 if loot_type == "item" then |
2823 local npc = NPCEntry(temp_npc_id) | 2805 local item_id = ItemLinkToID(hyperlink) |
2824 if npc then | 2806 Debug("%s: Assigned stored item loot data - %s - %d:%d", event_name, hyperlink, item_id, quantity) |
2825 -- Create needed npc fields if required | 2807 table.insert(encounter_data[loot_label], ("%d:%d"):format(item_id, quantity)) |
2826 local loot_label = "drops" | 2808 elseif loot_type == "money" then |
2827 local encounter_data = npc:EncounterData(InstanceDifficultyToken()) | 2809 Debug("%s: Assigned stored money loot data - money:%d", event_name, quantity) |
2828 encounter_data[loot_label] = encounter_data[loot_label] or {} | 2810 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) |
2829 encounter_data.loot_counts = encounter_data.loot_counts or {} | 2811 elseif loot_type == "currency" then |
2830 | 2812 local currency_texture = CurrencyLinkToTexture(hyperlink) |
2831 for index = 1, #loot_toast_data do | 2813 Debug("%s: Assigned stored currency loot data - %s - currency:%d:%s", event_name, hyperlink, currency_texture, quantity) |
2832 local data = loot_toast_data[index] | 2814 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) |
2833 local loot_type = data[1] | 2815 end |
2834 local hyperlink = data[2] | 2816 end |
2835 local quantity = data[3] | 2817 |
2836 | 2818 if not boss_loot_toasting[raid_boss_id] then |
2837 if loot_type == "item" then | 2819 encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1 |
2838 local item_id = ItemLinkToID(hyperlink) | 2820 boss_loot_toasting[raid_boss_id] = true -- Do not count further loots until timer expires or another boss is killed |
2839 Debug("%s: Assigned stored item loot data - %s - %d:%d", event_name, hyperlink, item_id, quantity) | 2821 end |
2840 table.insert(encounter_data[loot_label], ("%d:%d"):format(item_id, quantity)) | 2822 else |
2841 elseif loot_type == "money" then | 2823 Debug("%s: NPC is nil, but we have stored loot data...", event_name) |
2842 Debug("%s: Assigned stored money loot data - money:%d", event_name, quantity) | |
2843 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) | |
2844 elseif loot_type == "currency" then | |
2845 local currency_texture = CurrencyLinkToTexture(hyperlink) | |
2846 Debug("%s: Assigned stored currency loot data - %s - currency:%d:%s", event_name, hyperlink, currency_texture, quantity) | |
2847 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) | |
2848 end | |
2849 end | |
2850 | |
2851 if not boss_loot_toasting[temp_npc_id] then | |
2852 encounter_data.loot_counts[loot_label] = (encounter_data.loot_counts[loot_label] or 0) + 1 | |
2853 boss_loot_toasting[temp_npc_id] = true -- Do not count further loots until timer expires or another boss is killed | |
2854 end | |
2855 else | |
2856 Debug("%s: NPC is nil, but we have stored loot data...", event_name) | |
2857 end | |
2858 end | 2824 end |
2859 end | 2825 end |
2860 | 2826 |
2861 ClearLootToastData() | 2827 ClearLootToastData() |
2862 | 2828 killed_boss_id_timer_handle = C_Timer.NewTimer(5, ClearKilledBossID) |
2863 killed_boss_id_timer_handle = C_Timer.NewTimer(5, ClearKilledBossID) -- we need to assign a handle here to cancel it later | |
2864 end | 2829 end |
2865 | 2830 |
2866 | 2831 |
2867 function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) | 2832 function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) |
2868 if unit_id ~= "player" then | 2833 if unit_id ~= "player" then |