comparison Main.lua @ 182:5d166590440e

Added debug prints along the LFR codepath.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 08 Nov 2012 09:26:25 -0600
parents 466187ddb947
children 1078a6d1c4c9
comparison
equal deleted inserted replaced
181:28f625161b23 182:5d166590440e
590 if current_loot.sources then 590 if current_loot.sources then
591 for source_guid, loot_data in pairs(current_loot.sources) do 591 for source_guid, loot_data in pairs(current_loot.sources) do
592 local entry, source_id 592 local entry, source_id
593 593
594 if current_loot.target_type == AF.ITEM then 594 if current_loot.target_type == AF.ITEM then
595 Debug(("GenericLootUpdate: current_loot.identifier: '%s'"):format(tostring(current_loot.identifier))) 595 -- Debug(("GenericLootUpdate: current_loot.identifier: '%s'"):format(tostring(current_loot.identifier)))
596 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc) 596 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc)
597 source_id = current_loot.identifier 597 source_id = current_loot.identifier
598 entry = DBEntry(data_type, source_id) 598 entry = DBEntry(data_type, source_id)
599 elseif current_loot.target_type == AF.OBJECT then 599 elseif current_loot.target_type == AF.OBJECT then
600 source_id = ("%s:%s"):format(current_loot.spell_label, select(2, ParseGUID(source_guid))) 600 source_id = ("%s:%s"):format(current_loot.spell_label, select(2, ParseGUID(source_guid)))
972 end 972 end
973 973
974 974
975 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) 975 function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity)
976 if loot_type ~= "item" then 976 if loot_type ~= "item" then
977 Debug(("%s: loot_type is '%s'"):format(event_name, loot_type))
977 return 978 return
978 end 979 end
979 local npc = NPCEntry(private.raid_finder_boss_id) 980 local npc = NPCEntry(private.raid_finder_boss_id)
980 private.raid_finder_boss_id = nil 981 private.raid_finder_boss_id = nil
981 982
982 if not npc then 983 if not npc then
984 Debug(("%s: NPC is nil."):format(event_name))
983 return 985 return
984 end 986 end
985 local item_id = ItemLinkToID(item_link) 987 local item_id = ItemLinkToID(item_link)
986 988
987 if not item_id then 989 if not item_id then
990 Debug(("%s: ItemID is nil, from item link %s"):format(event_name, item_link))
988 return 991 return
989 end 992 end
990 local loot_type = "drops" 993 local loot_type = "drops"
991 local encounter_data = npc.encounter_data[InstanceDifficultyToken()] 994 local encounter_data = npc.encounter_data[InstanceDifficultyToken()]
992 encounter_data[loot_type] = encounter_data[loot_type] or {} 995 encounter_data[loot_type] = encounter_data[loot_type] or {}
993 encounter_data.loot_counts = encounter_data.loot_counts or {} 996 encounter_data.loot_counts = encounter_data.loot_counts or {}
994 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1 997 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1
995 998
996 table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity)) 999 table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity))
997 Debug(("%s: %s - %d (%d)"):format(event_name, item_link, item_id, quantity)) 1000 Debug(("%s: %sX%d (%d)"):format(event_name, item_link, quantity, item_id))
998 end 1001 end
999 1002
1000 1003
1001 do 1004 do
1002 local CHAT_MSG_LOOT_UPDATE_FUNCS = { 1005 local CHAT_MSG_LOOT_UPDATE_FUNCS = {
1169 end 1172 end
1170 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1173 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
1171 end, 1174 end,
1172 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1175 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
1173 if dest_guid ~= _G.UnitGUID("target") then 1176 if dest_guid ~= _G.UnitGUID("target") then
1177 Debug("Killed unit was not player target.")
1174 return 1178 return
1175 end 1179 end
1176 local unit_type, unit_idnum = ParseGUID(dest_guid) 1180 local unit_type, unit_idnum = ParseGUID(dest_guid)
1177 1181
1178 if not unit_idnum or not UnitTypeIsNPC(unit_type) then 1182 if not unit_idnum or not UnitTypeIsNPC(unit_type) then
1183 Debug(("%s: %s is not an NPC, or has no ID."):format(sub_event, dest_name))
1179 ClearKilledNPC() 1184 ClearKilledNPC()
1180 private.harvesting = nil 1185 private.harvesting = nil
1181 return 1186 return
1182 end 1187 end
1183 1188
1184 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then 1189 if private.RAID_FINDER_BOSS_IDS[unit_idnum] then
1185 local _, instance_type, instance_difficulty = _G.GetInstanceInfo() 1190 local _, instance_type, instance_difficulty = _G.GetInstanceInfo()
1186 1191
1187 if IsRaidFinderInstance(instance_type, instance_difficulty) then 1192 if IsRaidFinderInstance(instance_type, instance_difficulty) then
1193 Debug(("%s: Matching boss %s; in raid finder instance."):format(sub_event, dest_name))
1188 private.raid_finder_boss_id = unit_idnum 1194 private.raid_finder_boss_id = unit_idnum
1195 else
1196 Debug(("%s: Matching boss %s; NOT in raid finder instance."):format(sub_event, dest_name))
1189 end 1197 end
1198 else
1199 Debug(("%s: Killed NPC %s (ID: %d) is not in boss list."):format(sub_event, dest_name, unit_idnum))
1190 end 1200 end
1191 killed_npc_id = unit_idnum 1201 killed_npc_id = unit_idnum
1192 WDP:ScheduleTimer(ClearKilledNPC, 0.1) 1202 WDP:ScheduleTimer(ClearKilledNPC, 0.1)
1193 end, 1203 end,
1194 } 1204 }