Mercurial > wow > wowdb-profiler
comparison Main.lua @ 179:f5e3662ed5f9
Changed "raid_finder_loot" to "drops" and changed to nilling the boss ID when it's used, rather than on a timer (since it'll be overwritten anyway).
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Tue, 06 Nov 2012 09:47:34 -0600 |
| parents | ac673d315d61 |
| children | 466187ddb947 |
comparison
equal
deleted
inserted
replaced
| 178:ac673d315d61 | 179:f5e3662ed5f9 |
|---|---|
| 979 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) | 979 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) |
| 980 if loot_type ~= "item" then | 980 if loot_type ~= "item" then |
| 981 return | 981 return |
| 982 end | 982 end |
| 983 local npc = NPCEntry(private.raid_finder_boss_id) | 983 local npc = NPCEntry(private.raid_finder_boss_id) |
| 984 private.raid_finder_boss_id = nil | |
| 984 | 985 |
| 985 if not npc then | 986 if not npc then |
| 986 return | 987 return |
| 987 end | 988 end |
| 988 local item_id = ItemLinkToID(item_link) | 989 local item_id = ItemLinkToID(item_link) |
| 989 | 990 |
| 990 if not item_id then | 991 if not item_id then |
| 991 return | 992 return |
| 992 end | 993 end |
| 993 local loot_type = "raid_finder_loot" | 994 local loot_type = "drops" |
| 994 local encounter_data = npc.encounter_data[InstanceDifficultyToken()] | 995 local encounter_data = npc.encounter_data[InstanceDifficultyToken()] |
| 995 encounter_data[loot_type] = encounter_data[loot_type] or {} | 996 encounter_data[loot_type] = encounter_data[loot_type] or {} |
| 996 encounter_data.loot_counts = encounter_data.loot_counts or {} | 997 encounter_data.loot_counts = encounter_data.loot_counts or {} |
| 997 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 | 998 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 |
| 998 | 999 |
| 999 table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity)) | 1000 table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity)) |
| 1000 end | 1001 Debug(("%s: %s - %d (%d)"):format(event_name, item_link, item_id, quantity)) |
| 1001 | 1002 end |
| 1002 | 1003 |
| 1003 local CHAT_MSG_LOOT_UPDATE_FUNCS = { | 1004 |
| 1004 [AF.NPC] = function(item_id, quantity) | 1005 do |
| 1005 end, | 1006 local CHAT_MSG_LOOT_UPDATE_FUNCS = { |
| 1006 [AF.ZONE] = function(item_id, quantity) | 1007 [AF.NPC] = function(item_id, quantity) |
| 1007 current_loot = { | 1008 Debug(("CHAT_MSG_LOOT: %d (%d)"):format(item_id, quantity)) |
| 1008 list = { | 1009 end, |
| 1009 ("%d:%d"):format(item_id, quantity) | 1010 [AF.ZONE] = function(item_id, quantity) |
| 1010 }, | 1011 current_loot = { |
| 1011 identifier = current_action.identifier, | 1012 list = { |
| 1012 label = current_action.loot_label or "drops", | 1013 ("%d:%d"):format(item_id, quantity) |
| 1013 map_level = current_action.map_level, | 1014 }, |
| 1014 object_name = current_action.object_name, | 1015 identifier = current_action.identifier, |
| 1015 spell_label = current_action.spell_label, | 1016 label = current_action.loot_label or "drops", |
| 1016 target_type = current_action.target_type, | 1017 map_level = current_action.map_level, |
| 1017 x = current_action.x, | 1018 object_name = current_action.object_name, |
| 1018 y = current_action.y, | 1019 spell_label = current_action.spell_label, |
| 1019 zone_data = current_action.zone_data, | 1020 target_type = current_action.target_type, |
| 1020 } | 1021 x = current_action.x, |
| 1021 table.wipe(current_action) | 1022 y = current_action.y, |
| 1022 GenericLootUpdate("zones") | 1023 zone_data = current_action.zone_data, |
| 1023 end, | 1024 } |
| 1024 } | 1025 table.wipe(current_action) |
| 1025 | 1026 GenericLootUpdate("zones") |
| 1026 | 1027 end, |
| 1027 function WDP:CHAT_MSG_LOOT(event_name, message) | 1028 } |
| 1028 local category | 1029 |
| 1029 | 1030 |
| 1030 Debug(event_name) | 1031 function WDP:CHAT_MSG_LOOT(event_name, message) |
| 1031 | 1032 local category |
| 1032 if current_action.spell_label ~= "EXTRACT_GAS" then | 1033 |
| 1033 category = AF.ZONE | 1034 if current_action.spell_label ~= "EXTRACT_GAS" then |
| 1034 elseif private.raid_finder_boss_id then | 1035 category = AF.ZONE |
| 1035 category = AF.NPC | 1036 elseif private.raid_finder_boss_id then |
| 1036 end | 1037 category = AF.NPC |
| 1037 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] | 1038 end |
| 1038 | 1039 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] |
| 1039 if not category or not update_func then | 1040 |
| 1040 return | 1041 if not category or not update_func then |
| 1041 end | 1042 Debug("No update func found") |
| 1042 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) | 1043 return |
| 1043 | 1044 end |
| 1044 if not item_link then | 1045 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) |
| 1045 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) | 1046 |
| 1046 end | 1047 if not item_link then |
| 1047 local item_id = ItemLinkToID(item_link) | 1048 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) |
| 1048 | 1049 end |
| 1049 if not item_id then | 1050 local item_id = ItemLinkToID(item_link) |
| 1050 return | 1051 |
| 1051 end | 1052 if not item_id then |
| 1052 update_func(item_id, quantity) | 1053 Debug(("%s: No item_id found."):format(event_name)) |
| 1053 end | 1054 return |
| 1054 | 1055 end |
| 1056 update_func(item_id, quantity) | |
| 1057 end | |
| 1058 end | |
| 1055 | 1059 |
| 1056 function WDP:RecordQuote(event_name, message, source_name, language_name) | 1060 function WDP:RecordQuote(event_name, message, source_name, language_name) |
| 1057 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then | 1061 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then |
| 1058 return | 1062 return |
| 1059 end | 1063 end |
| 1152 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then | 1156 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then |
| 1153 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()] | 1157 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()] |
| 1154 encounter_data.spells = encounter_data.spells or {} | 1158 encounter_data.spells = encounter_data.spells or {} |
| 1155 encounter_data.spells[spell_id] = (encounter_data.spells[spell_id] or 0) + 1 | 1159 encounter_data.spells[spell_id] = (encounter_data.spells[spell_id] or 0) + 1 |
| 1156 end | 1160 end |
| 1157 end | |
| 1158 | |
| 1159 local function ClearKilledBossID() | |
| 1160 private.raid_finder_boss_id = nil | |
| 1161 end | 1161 end |
| 1162 | 1162 |
| 1163 local HEAL_BATTLE_PETS_SPELL_ID = 125801 | 1163 local HEAL_BATTLE_PETS_SPELL_ID = 125801 |
| 1164 | 1164 |
| 1165 local COMBAT_LOG_FUNCS = { | 1165 local COMBAT_LOG_FUNCS = { |
| 1192 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then | 1192 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then |
| 1193 local _, instance_type, instance_difficulty = _G.GetInstanceInfo() | 1193 local _, instance_type, instance_difficulty = _G.GetInstanceInfo() |
| 1194 | 1194 |
| 1195 if IsRaidFinderInstance(instance_type, instance_difficulty) then | 1195 if IsRaidFinderInstance(instance_type, instance_difficulty) then |
| 1196 private.raid_finder_boss_id = unit_idnum | 1196 private.raid_finder_boss_id = unit_idnum |
| 1197 WDP:ScheduleTimer(ClearKilledBossID, 0.5) | |
| 1198 end | 1197 end |
| 1199 end | 1198 end |
| 1200 killed_npc_id = unit_idnum | 1199 killed_npc_id = unit_idnum |
| 1201 WDP:ScheduleTimer(ClearKilledNPC, 0.1) | 1200 WDP:ScheduleTimer(ClearKilledNPC, 0.1) |
| 1202 end, | 1201 end, |
