Mercurial > wow > wowdb-profiler
changeset 298:841eeb16dcf7
Update group pets on GROUP_ROSTER_UPDATE as well as on UNIT_PET since pets may exist before groups are formed.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 18 Jun 2013 14:18:44 -0500 |
parents | 57cb63fe5ba8 |
children | 0946f1091810 |
files | Main.lua |
diffstat | 1 files changed, 27 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Mon Jun 17 14:39:09 2013 -0500 +++ b/Main.lua Tue Jun 18 14:18:44 2013 -0500 @@ -1049,28 +1049,7 @@ end -function WDP:GROUP_ROSTER_UPDATE() - local is_raid = _G.IsInRaid() - local unit_type = is_raid and "raid" or "party" - local group_size = is_raid and _G.GetNumGroupMembers() or _G.GetNumSubgroupMembers() - - table.wipe(group_member_uids) - - Debug("GROUP_ROSTER_UPDATE: %s group - %d members.", unit_type, group_size) - - for index = 1, group_size do - local group_unit = unit_type .. index - local unit_guid = _G.UnitGUID(group_unit) - - Debug("%s (%s) added as GUID %s", group_unit, _G.UnitName(group_unit), unit_guid) - group_member_uids[unit_guid] = true - end - group_member_uids[_G.UnitGUID("player")] = true -end - - -function WDP:UNIT_PET(event_name, unit_id) - local unit_guid = _G.UnitGUID(unit_id) +local function UpdateUnitPet(unit_guid, unit_id) local current_pet_guid = group_owner_guids_to_pet_guids[unit_guid] if current_pet_guid then @@ -1088,6 +1067,32 @@ end +function WDP:GROUP_ROSTER_UPDATE(event_name) + local is_raid = _G.IsInRaid() + local unit_type = is_raid and "raid" or "party" + local group_size = is_raid and _G.GetNumGroupMembers() or _G.GetNumSubgroupMembers() + + table.wipe(group_member_uids) + + Debug("GROUP_ROSTER_UPDATE: %s group - %d members.", unit_type, group_size) + + for index = 1, group_size do + local unit_id = unit_type .. index + local unit_guid = _G.UnitGUID(unit_id) + + group_member_uids[unit_guid] = true + Debug("%s (%s) added as GUID %s", unit_id, _G.UnitName(unit_id), unit_guid) + UpdateUnitPet(unit_guid, unit_id) + end + group_member_uids[_G.UnitGUID("player")] = true +end + + +function WDP:UNIT_PET(event_name, unit_id) + UpdateUnitPet(_G.UnitGUID(unit_id), unit_id) +end + + function WDP:SHOW_LOOT_TOAST(event_name, loot_type, item_link, quantity) if loot_type ~= "item" then return