Mercurial > wow > wowdb-profiler
comparison Main.lua @ 381:cc4a579b26d1
Assorted code cleanup and reorganization.
author | MMOSimca <MMOSimca@gmail.com> |
---|---|
date | Wed, 10 Dec 2014 12:47:35 -0500 |
parents | 8ca629ec7f57 |
children | 8d63f8348496 |
comparison
equal
deleted
inserted
replaced
380:97824a39ddd3 | 381:cc4a579b26d1 |
---|---|
57 -- Ignoring NPC casts of the following spells | 57 -- Ignoring NPC casts of the following spells |
58 local CHI_WAVE_SPELL_ID = 132464 | 58 local CHI_WAVE_SPELL_ID = 132464 |
59 local DISGUISE_SPELL_ID = 121308 | 59 local DISGUISE_SPELL_ID = 121308 |
60 | 60 |
61 -- For timer-based loot gathering of abnormal containers (that don't use SHOW_LOOT_TOAST, sadly) | 61 -- For timer-based loot gathering of abnormal containers (that don't use SHOW_LOOT_TOAST, sadly) |
62 local BAG_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168178] | 62 local BAG_OF_SALVAGE_ITEM_ID = private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[168178] |
63 local CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168179] | 63 local CRATE_OF_SALVAGE_ITEM_ID = private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[168179] |
64 local BIG_CRATE_OF_SALVAGE_ITEM_ID = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[168180] | 64 local BIG_CRATE_OF_SALVAGE_ITEM_ID = private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[168180] |
65 | 65 |
66 -- 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 | 66 -- 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 |
67 local DUPLICATE_WORLD_BOSS_IDS = { | 67 local DUPLICATE_WORLD_BOSS_IDS = { |
68 [71952] = { 71953, 71954, 71955, }, | 68 [71952] = { 71953, 71954, 71955, }, |
69 } | 69 } |
1446 [AF.NPC] = function(item_id, quantity) | 1446 [AF.NPC] = function(item_id, quantity) |
1447 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) | 1447 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) |
1448 end, | 1448 end, |
1449 [AF.OBJECT] = function(item_id, quantity) | 1449 [AF.OBJECT] = function(item_id, quantity) |
1450 Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity) | 1450 Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity) |
1451 --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do | 1451 -- Check for top level object data |
1452 -- Check for top level object data | 1452 local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id])) |
1453 local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id])) | 1453 local difficulty_token = InstanceDifficultyToken() |
1454 local difficulty_token = InstanceDifficultyToken() | 1454 if object_entry[difficulty_token] then |
1455 if object_entry[difficulty_token] then | 1455 -- Increment loot count |
1456 -- Increment loot count | 1456 object_entry[difficulty_token]["opening_count"] = (object_entry[difficulty_token]["opening_count"] or 0) + 1 |
1457 object_entry[difficulty_token]["opening_count"] = (object_entry[difficulty_token]["opening_count"] or 0) + 1 | 1457 |
1458 | 1458 -- Add drop data |
1459 -- Add drop data | 1459 object_entry[difficulty_token]["opening"] = object_entry[difficulty_token]["opening"] or {} |
1460 object_entry[difficulty_token]["opening"] = object_entry[difficulty_token]["opening"] or {} | 1460 table.insert(object_entry[difficulty_token]["opening"], ("%d:%d"):format(item_id, quantity)) |
1461 table.insert(object_entry[difficulty_token]["opening"], ("%d:%d"):format(item_id, quantity)) | 1461 else |
1462 else | 1462 Debug("CHAT_MSG_LOOT: When handling timber, the top level data was missing for objectID %s.", private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id]) |
1463 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]) | 1463 end |
1464 end | |
1465 --end | |
1466 end, | 1464 end, |
1467 [AF.ZONE] = function(item_id, quantity) | 1465 [AF.ZONE] = function(item_id, quantity) |
1468 Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity) | 1466 Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity) |
1469 InitializeCurrentLoot() | 1467 InitializeCurrentLoot() |
1470 current_loot.list[1] = ("%d:%d"):format(item_id, quantity) | 1468 current_loot.list[1] = ("%d:%d"):format(item_id, quantity) |
2672 Debug("%s: Assigned stored money loot data - money:%d", event_name, quantity) | 2670 Debug("%s: Assigned stored money loot data - money:%d", event_name, quantity) |
2673 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) | 2671 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) |
2674 elseif loot_type == "currency" then | 2672 elseif loot_type == "currency" then |
2675 local currency_texture = CurrencyLinkToTexture(hyperlink) | 2673 local currency_texture = CurrencyLinkToTexture(hyperlink) |
2676 Debug("%s: Assigned stored currency loot data - %s - currency:%d:%s", event_name, hyperlink, currency_texture, quantity) | 2674 Debug("%s: Assigned stored currency loot data - %s - currency:%d:%s", event_name, hyperlink, currency_texture, quantity) |
2677 -- Workaround for Patch 5.4.0 bug with Flexible raid Siege of Orgrimmar bosses and Valor Points | |
2678 if quantity > 1000 and currency_texture == "pvecurrency-valor" then | |
2679 quantity = math.floor(quantity / 100) | |
2680 end | |
2681 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) | 2675 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) |
2682 end | 2676 end |
2683 end | 2677 end |
2684 | 2678 |
2685 if not boss_loot_toasting[temp_npc_id] then | 2679 if not boss_loot_toasting[temp_npc_id] then |
2706 private.previous_spell_id = spell_id | 2700 private.previous_spell_id = spell_id |
2707 | 2701 |
2708 -- Handle Logging spell casts | 2702 -- Handle Logging spell casts |
2709 if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then | 2703 if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then |
2710 last_timber_spell_id = spell_id | 2704 last_timber_spell_id = spell_id |
2711 --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do | |
2712 UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id])) | 2705 UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id])) |
2713 --end | |
2714 return | 2706 return |
2715 end | 2707 end |
2716 | 2708 |
2717 -- Handle Loot Toast spell casts | 2709 -- Handle Loot Toast spell casts |
2718 if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then | 2710 if private.LOOT_TOAST_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then |
2719 ClearKilledBossID() | 2711 ClearKilledBossID() |
2720 ClearLootToastContainerID() | 2712 ClearLootToastContainerID() |
2721 ClearLootToastData() | 2713 ClearLootToastData() |
2722 | 2714 |
2723 private.loot_toast_container_id = private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] | 2715 private.loot_toast_container_id = private.LOOT_TOAST_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[spell_id] |
2724 loot_toast_container_timer_handle = WDP:ScheduleTimer(ClearLootToastContainerID, 1) -- we need to assign a handle here to cancel it later | 2716 loot_toast_container_timer_handle = WDP:ScheduleTimer(ClearLootToastContainerID, 1) -- we need to assign a handle here to cancel it later |
2725 return | 2717 return |
2726 end | 2718 end |
2727 | 2719 |
2728 -- For Crates of Salvage (and potentially other items based on spell casts in the future which need manual handling) | 2720 -- For Crates of Salvage (and potentially other items based on spell casts in the future which need manual handling) |
2729 if private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then | 2721 if private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then |
2730 -- Set up timer | 2722 -- Set up timer |
2731 Debug("%s: Beginning Salvage loot timer for spellID %d", event_name, spell_id) | 2723 Debug("%s: Beginning Salvage loot timer for spellID %d", event_name, spell_id) |
2732 chat_loot_timer_handle = WDP:ScheduleTimer(ClearTimeBasedLootData, 1) | 2724 chat_loot_timer_handle = WDP:ScheduleTimer(ClearTimeBasedLootData, 1) |
2733 | 2725 |
2734 -- Standard item handling setup | 2726 -- Standard item handling setup |
2735 table.wipe(current_action) | 2727 table.wipe(current_action) |
2736 current_loot = nil | 2728 current_loot = nil |
2737 current_action.target_type = AF.ITEM | 2729 current_action.target_type = AF.ITEM |
2738 current_action.identifier = private.SALVAGE_SPELL_ID_TO_ITEM_ID_MAP[spell_id] | 2730 current_action.identifier = private.DELAYED_CONTAINER_SPELL_ID_TO_ITEM_ID_MAP[spell_id] |
2739 current_action.loot_label = "contains" | 2731 current_action.loot_label = "contains" |
2740 InitializeCurrentLoot() | 2732 InitializeCurrentLoot() |
2741 return | 2733 return |
2742 end | 2734 end |
2743 | 2735 |