12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 27 ■ API <strong>Reference</strong> 971Returns:base—The unit’s base defense skill (number)modifier—Temporary modifiers to defense skill (number)UnitDetailedThreatSituationReturns detailed in<strong>for</strong>mation about the threat status <strong>of</strong> one unit againstanother.isTanking, status, scaledPercent, rawPercent, threatValue = iUnitDetailedThreatSituation(unit, mobUnit) or iUnitDetailedThreatSituation(“name“, mobUnit)The different values returned by this function reflect the complexity <strong>of</strong> NPCthreat management.Raw threat roughly equates to the amount <strong>of</strong> damage a unit has caused to theNPC plus the amount <strong>of</strong> healing the unit has per<strong>for</strong>med in the NPC’s presence.(Each quantity that goes into this sum may be modified, however; such as by apaladin’s Righteous Fury self-buff, a priest’s Silent Resolve talent, or a playerwhose cloak is enchanted with Subtlety.)Generally, whichever unit has the highest raw threat against an NPC becomesits primary target, <strong>and</strong> raw threat percentage simplifies this comparison.However, most NPCs are designed to maintain some degree <strong>of</strong> target focus sothat they don’t rapidly switch targets if, <strong>for</strong> example, a unit other than theprimary target suddenly reaches 101% raw threat. The amount by which a unitmust surpass the primary target’s threat to become the new primary targetvaries by distance from the NPC.Thus, a scaled percentage value is given to provide clarity. The rawPercentvalue returned from this function can be greater than 100 (indicating that unithas greater threat against mobUnit than mobUnit’s primary target, <strong>and</strong> is thusin danger <strong>of</strong> becoming the primary target), but the scaledPercent value willalways be 100 or lower.Threat in<strong>for</strong>mation <strong>for</strong> a pair <strong>of</strong> units is only returned if the player has threatagainst the NPC unit in question. (For example, no threat data is provided ifthe player’s pet is attacking an NPC but the player himself has taken no action,even though the pet has threat against the NPC.)Arguments:unit—The unit whose threat situation is being requested (unitid)name—The name <strong>of</strong> a unit to query. Only valid <strong>for</strong> the player, pet, <strong>and</strong>party/raid members. (string)mobUnit—An NPC unit the first unit may have threat against (unitid)Returns:isTanking—1 if unit is mobUnit’s primary target, nil otherwise (1nil)status—A threat status category (number)0—Unit has less than 100% raw threat (default UI shows no indicator)1—Unit has 100% or higher raw threat but isn’t mobUnit’s primary target(default UI shows yellow indicator)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!