Notice before download
This addon is no longer needed in most cases in 4.0.3a, as Blizzard finally fix the inspect problem. It remains here only for my another addon RatingSummary. As described below, LibInspectLess guarantees that ALL iteminfos of inspected player being retrieved which is used by RatingSummary to calc the gear stats. Although this feature is provided as API lib for other addons, as far as I know, there is no one using it :(
In short, you no longer need to download this any more...
This lib itself is a standalone addon. By simply putting it into "Interface\Addons", the inspecting will keep working in most cases.
The blue post (link) says : "Inspecting other players can cease to function until the client is restarted."
And after testing for a few days, we have found at least 4 reasons for the problem:
- Inspected too frequently. The safe interval is at least 2 seconds, but many old tooltip addons inspect mouseover units with no restriction.
- Addons call NotifyInspect() while player himself is dead. They didn't use CanInspect(unit) before inspecting.
- Inspect players from other realms in battlegrounds or dungeons.
- The inspected target teleports to be invisible before the INSPECT_READY event is returned. The time between NotifyInspect() being requested and the return of the response is up to 1 second, If during that time, the inspected player logged out / finished using Hearthstone / transmited to BG / entered a teleport door etc, inspecting will cease to function.
LibInspectLess-1.0 will resolve the 1st and 2nd of above perfectly. And for the 3rd, LibInspectLess just prevents any inspecting request across realms before a fix from Blizzard is carried out.
And for the 4th, there is no solution as far as I can imagine. The only suggestion is to remove the mouseover-inspecting addons (tooltip mods in the most cases) and increase the interval of LibInspectLess (using /libinspectless command, '/lil 8' for example).
And if Blizzard repairs all the bugs, LibInspectLess is also useful to guarantee that ALL iteminfos of inspected player being retrieved. The stream downloading machanic is introduced in 4.0. You will find the tooltip on the inspected player's item dosen't show item information immediately. It's very annoy if your clients WDB cache is fresh.
I use this lib to rewrite the RatingSummary and the GearScore module in it. You can have a look at the API usages from GearScore.lua It implements mouseover gearscore and never cause problems.
CHECKs and returns the current inspecting unitid. This is used to avoid handling a inspected unit that is already gone. For example, an inspect is trigger by mouseover, and you register a InspectReady callback. But when the callback function is called, you are no longer pointing on that player. In that case, you can call lib:GetUnit(), and skip the following process if it returns nil.
returns the current inspecting unit's guid. Do not check. This is used when there is defininite an available unit to deal with.
Returns whether the iteminfos of current inspecting unit are all retrieved. This aims to reuse the last inspecting result, instead of triggering another NotifyInspect()
Provides 4 events:
- args = guid
Same as blizzard event INSPECT_READY
- args = locked
Fires when a new inspect can be requested. This is used for tooltip update.
- args = unit, guid
Fires when all iteminfos of your inspected player is got, and GetInventoryItemLink(unit) is safe to use This is because the GetItemInfo api is now streaming when necessary. It returns nil unless the client has downloaded the item info. As a result, the gametooltip often shows "Waiting/Recovering Item Information".
- args = unit, guid
Fires when the unit is changed while InspectLess is retrieving iteminfos, for example you are inspecting 'mouseover' unit, but you points another player before all iteminfos are retrieved. In that case, there it no way to call GetInventoryItemLink(unit) with the old unitid.