Mercurial > wow > wowdb-profiler
comparison Main.lua @ 299:0946f1091810
Tighten up group detection, and disregard the check when in an instance.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 01 Jul 2013 13:04:27 -0500 |
parents | 841eeb16dcf7 |
children | e5c2dc3c7f6f |
comparison
equal
deleted
inserted
replaced
298:841eeb16dcf7 | 299:0946f1091810 |
---|---|
110 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", | 110 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", |
111 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", | 111 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", |
112 UNIT_SPELLCAST_SENT = true, | 112 UNIT_SPELLCAST_SENT = true, |
113 UNIT_SPELLCAST_SUCCEEDED = true, | 113 UNIT_SPELLCAST_SUCCEEDED = true, |
114 VOID_STORAGE_OPEN = true, | 114 VOID_STORAGE_OPEN = true, |
115 ZONE_CHANGED = "SetCurrentAreaID", | 115 ZONE_CHANGED = "HandleZoneChange", |
116 ZONE_CHANGED_INDOORS = "SetCurrentAreaID", | 116 ZONE_CHANGED_INDOORS = "HandleZoneChange", |
117 ZONE_CHANGED_NEW_AREA = "SetCurrentAreaID", | 117 ZONE_CHANGED_NEW_AREA = "HandleZoneChange", |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 -- VARIABLES ---------------------------------------------------------- | 121 -- VARIABLES ---------------------------------------------------------- |
122 | 122 |
123 local anvil_spell_ids = {} | 123 local anvil_spell_ids = {} |
124 local currently_drunk | 124 local currently_drunk |
125 local char_db | 125 local char_db |
126 local global_db | 126 local global_db |
127 local group_member_uids = {} | 127 local group_member_guids = {} |
128 local group_owner_guids_to_pet_guids = {} | 128 local group_owner_guids_to_pet_guids = {} |
129 local group_pet_guids = {} | 129 local group_pet_guids = {} |
130 local in_instance | |
130 local item_process_timer_handle | 131 local item_process_timer_handle |
131 local faction_standings = {} | 132 local faction_standings = {} |
132 local forge_spell_ids = {} | 133 local forge_spell_ids = {} |
133 local languages_known = {} | 134 local languages_known = {} |
134 local name_to_id_map = {} | 135 local name_to_id_map = {} |
690 local MICRO_DUNGEON_IDS = { | 691 local MICRO_DUNGEON_IDS = { |
691 ShrineofTwoMoons = 903, | 692 ShrineofTwoMoons = 903, |
692 ShrineofSevenStars = 905, | 693 ShrineofSevenStars = 905, |
693 } | 694 } |
694 | 695 |
695 function WDP:SetCurrentAreaID(event_name) | 696 local function SetCurrentAreaID() |
696 if private.in_combat then | 697 if private.in_combat then |
697 private.set_area_id = true | 698 private.set_area_id = true |
698 return | 699 return |
699 end | 700 end |
700 local map_area_id = _G.GetCurrentMapAreaID() | 701 local map_area_id = _G.GetCurrentMapAreaID() |
724 _G.SetMapByID(map_area_id) | 725 _G.SetMapByID(map_area_id) |
725 else | 726 else |
726 world_map:Hide() | 727 world_map:Hide() |
727 _G.SetCVar("Sound_EnableSFX", sfx_value) | 728 _G.SetCVar("Sound_EnableSFX", sfx_value) |
728 end | 729 end |
730 end | |
731 | |
732 function WDP:HandleZoneChange(event_name) | |
733 in_instance = _G.IsInInstance() | |
734 SetCurrentAreaID() | |
729 end | 735 end |
730 end | 736 end |
731 | 737 |
732 | 738 |
733 -- METHODS ------------------------------------------------------------ | 739 -- METHODS ------------------------------------------------------------ |
804 end | 810 end |
805 local _, item_link = _G.GetItemInfo(identifier) | 811 local _, item_link = _G.GetItemInfo(identifier) |
806 HandleItemUse(item_link) | 812 HandleItemUse(item_link) |
807 end) | 813 end) |
808 | 814 |
809 self:SetCurrentAreaID("OnEnable") | 815 self:HandleZoneChange("OnEnable") |
810 self:GROUP_ROSTER_UPDATE() | 816 self:GROUP_ROSTER_UPDATE() |
811 end | 817 end |
812 | 818 |
813 | 819 |
814 local ScrapeItemUpgradeStats | 820 local ScrapeItemUpgradeStats |
1070 function WDP:GROUP_ROSTER_UPDATE(event_name) | 1076 function WDP:GROUP_ROSTER_UPDATE(event_name) |
1071 local is_raid = _G.IsInRaid() | 1077 local is_raid = _G.IsInRaid() |
1072 local unit_type = is_raid and "raid" or "party" | 1078 local unit_type = is_raid and "raid" or "party" |
1073 local group_size = is_raid and _G.GetNumGroupMembers() or _G.GetNumSubgroupMembers() | 1079 local group_size = is_raid and _G.GetNumGroupMembers() or _G.GetNumSubgroupMembers() |
1074 | 1080 |
1075 table.wipe(group_member_uids) | 1081 table.wipe(group_member_guids) |
1076 | 1082 |
1077 Debug("GROUP_ROSTER_UPDATE: %s group - %d members.", unit_type, group_size) | 1083 Debug("GROUP_ROSTER_UPDATE: %s group - %d members.", unit_type, group_size) |
1078 | 1084 |
1079 for index = 1, group_size do | 1085 for index = 1, group_size do |
1080 local unit_id = unit_type .. index | 1086 local unit_id = unit_type .. index |
1081 local unit_guid = _G.UnitGUID(unit_id) | 1087 local unit_guid = _G.UnitGUID(unit_id) |
1082 | 1088 |
1083 group_member_uids[unit_guid] = true | 1089 group_member_guids[unit_guid] = true |
1084 Debug("%s (%s) added as GUID %s", unit_id, _G.UnitName(unit_id), unit_guid) | 1090 Debug("%s (%s) added as GUID %s", unit_id, _G.UnitName(unit_id), unit_guid) |
1085 UpdateUnitPet(unit_guid, unit_id) | 1091 UpdateUnitPet(unit_guid, unit_id) |
1086 end | 1092 end |
1087 group_member_uids[_G.UnitGUID("player")] = true | 1093 group_member_guids[PLAYER_GUID] = true |
1088 end | 1094 end |
1089 | 1095 |
1090 | 1096 |
1091 function WDP:UNIT_PET(event_name, unit_id) | 1097 function WDP:UNIT_PET(event_name, unit_id) |
1092 UpdateUnitPet(_G.UnitGUID(unit_id), unit_id) | 1098 UpdateUnitPet(_G.UnitGUID(unit_id), unit_id) |
1309 source_guid = nil | 1315 source_guid = nil |
1310 end | 1316 end |
1311 local killer_guid = source_guid or previous_combat_event.source_guid | 1317 local killer_guid = source_guid or previous_combat_event.source_guid |
1312 local killer_name = source_name or previous_combat_event.source_name | 1318 local killer_name = source_name or previous_combat_event.source_name |
1313 | 1319 |
1314 table.wipe(previous_combat_event) | 1320 if not previous_combat_event.party_damage then |
1315 | |
1316 if not group_member_uids[killer_guid] and not group_pet_guids[killer_guid] then | |
1317 Debug("%s: %s was killed by %s (not group member or pet).", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) | 1321 Debug("%s: %s was killed by %s (not group member or pet).", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) |
1322 table.wipe(previous_combat_event) | |
1318 ClearKilledNPC() | 1323 ClearKilledNPC() |
1319 ClearKilledBossID() | 1324 ClearKilledBossID() |
1320 return | 1325 return |
1321 end | 1326 end |
1322 Debug("%s: %s was killed by %s.", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) | 1327 Debug("%s: %s was killed by %s.", sub_event, dest_name or _G.UNKNOWN, killer_name or _G.UNKNOWN) |
1327 private.raid_finder_boss_id = unit_idnum | 1332 private.raid_finder_boss_id = unit_idnum |
1328 elseif private.WORLD_BOSS_IDS[unit_idnum] then | 1333 elseif private.WORLD_BOSS_IDS[unit_idnum] then |
1329 Debug("%s: Matching world boss %s.", sub_event, dest_name) | 1334 Debug("%s: Matching world boss %s.", sub_event, dest_name) |
1330 ClearKilledBossID() | 1335 ClearKilledBossID() |
1331 private.world_boss_id = unit_idnum | 1336 private.world_boss_id = unit_idnum |
1332 else | 1337 end |
1333 Debug("%s: Killed NPC %s (ID: %d) is not in LFG or World boss list.", sub_event, dest_name, unit_idnum) | |
1334 end | |
1335 | |
1336 killed_npc_id = unit_idnum | 1338 killed_npc_id = unit_idnum |
1337 WDP:ScheduleTimer(ClearKilledNPC, 0.1) | 1339 WDP:ScheduleTimer(ClearKilledNPC, 0.1) |
1338 WDP:ScheduleTimer(ClearKilledBossID, 1) | 1340 WDP:ScheduleTimer(ClearKilledBossID, 1) |
1339 end, | 1341 end, |
1340 } | 1342 } |
1346 SPELL_AURA_REMOVED_DOSE = true, | 1348 SPELL_AURA_REMOVED_DOSE = true, |
1347 SPELL_CAST_FAILED = true, | 1349 SPELL_CAST_FAILED = true, |
1348 SWING_MISSED = true, | 1350 SWING_MISSED = true, |
1349 } | 1351 } |
1350 | 1352 |
1353 local DAMAGE_EVENTS = { | |
1354 RANGE_DAMAGE = true, | |
1355 SPELL_BUILDING_DAMAGE = true, | |
1356 SPELL_DAMAGE = true, | |
1357 SPELL_PERIODIC_DAMAGE = true, | |
1358 SWING_DAMAGE = true, | |
1359 } | |
1360 | |
1351 | 1361 |
1352 function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, ...) | 1362 function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, ...) |
1353 local combat_log_func = COMBAT_LOG_FUNCS[sub_event] | 1363 local combat_log_func = COMBAT_LOG_FUNCS[sub_event] |
1354 | 1364 |
1355 if not combat_log_func then | 1365 if not combat_log_func then |
1356 if not NON_DAMAGE_EVENTS[sub_event] then | 1366 if DAMAGE_EVENTS[sub_event] then |
1357 -- Uncomment to look for other sub-events to blacklist. | 1367 table.wipe(previous_combat_event) |
1358 -- Debug("Recording for %s", sub_event) | |
1359 previous_combat_event.source_guid = source_guid | |
1360 previous_combat_event.source_name = source_name | 1368 previous_combat_event.source_name = source_name |
1369 | |
1370 if source_guid ~= dest_guid and (in_instance or group_member_guids[source_guid] or group_pet_guids[source_guid]) then | |
1371 previous_combat_event.party_damage = true | |
1372 end | |
1361 end | 1373 end |
1362 return | 1374 return |
1363 end | 1375 end |
1364 combat_log_func(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, ...) | 1376 combat_log_func(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, ...) |
1365 | 1377 |
1937 | 1949 |
1938 function WDP:PLAYER_REGEN_ENABLED(event_name) | 1950 function WDP:PLAYER_REGEN_ENABLED(event_name) |
1939 private.in_combat = nil | 1951 private.in_combat = nil |
1940 | 1952 |
1941 if private.set_area_id then | 1953 if private.set_area_id then |
1942 self:SetCurrentAreaID(event_name) | 1954 self:HandleZoneChange(event_name) |
1943 private.set_area_id = nil | 1955 private.set_area_id = nil |
1944 end | 1956 end |
1945 end | 1957 end |
1946 | 1958 |
1947 | 1959 |