View Single Post
12-10-05, 03:04 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
There's a function UnitIsVisible() that returns true when the unit is nearby and information about them is visible. You could use that to determine if a player's pvp status is legitimate.

For updating when they do get in range/join group, does their PVP rank become available when their portrait changes? I'm not sure if that range is the same as the UnitIsVisible() range, but you could try registering for UNIT_PORTRAIT_UPDATE and if arg1 is party1-4 then grab their pvp information.

To minimize the amount of times the game runs through the checks you could see if UNIT_PORTRAIT_UPDATE fires after PARTY_MEMBERS_CHANGED (I suspect so). If so then:

PARTY_MEMBERS_CHANGED:
Register for UNIT_PORTRAIT_UPDATE

UNIT_PORTRAIT_UPDATE:
for i=1,4 do if UnitIsVisible("party"..i) then update PvP rank for "party"..i end
Unregister UNIT_PORTRAIT_UPDATE
  Reply With Quote