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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 27 ■ API <strong>Reference</strong> 949Only applies when the player has attempted to cast a spell but the spellrequires a target be<strong>for</strong>e it can begin casting (i.e. the glowing h<strong>and</strong> cursor isshowing).Returns:canTarget—1 if the spell can target an item; otherwise nil (1nil)SpellCanTargetUnitReturns whether the spell currently awaiting a target can target a given unit.canTarget = SpellCanTargetUnit(“unit“) or SpellCanTargetUnit(“name“)Only applies when the player has attempted to cast a spell but the spellrequires a target be<strong>for</strong>e it can begin casting (i.e. the glowing h<strong>and</strong> cursor isshowing).Arguments:unit—A unit to target (string, unitID)name—The name <strong>of</strong> a unit to target; only valid <strong>for</strong> player, pet, <strong>and</strong> party/raidmembers (string)Returns:canTarget—1 if the spell currently awaiting targeting can target the given unit(1nil)SpellHasRangeReturns whether an item has a range limitation <strong>for</strong> its use.hasRange = SpellHasRange(index, “bookType“) or SpellHasRange(“name“)For example: Shadowbolt can only be used on a unit within a given range <strong>of</strong>the player; Ritual <strong>of</strong> Summoning requires a target but has no range restriction;Fel Armor has no target <strong>and</strong> thus no range restriction.Arguments:index—Index <strong>of</strong> a spell in the spellbook (number, spellbookID)bookType—Type <strong>of</strong> spellbook (string)pet—The pet’s spellbookspell—The player’s spellbookname—Name <strong>of</strong> a spell (string)Returns:hasRange—1 if the spell has an effective range; otherwise nil. (1nil)SpellIsTargetingReturns whether a spell is currently awaiting a target.isTargeting = SpellIsTargeting()ProtectedReturns:isTargeting—1 if a spell is currently awaiting a target; otherwise nil (1nil)SpellStopCastingStops casting or targeting the spell in progress.

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

Saved successfully!

Ooh no, something went wrong!