Wikia

WoWWiki

Changes: API CanGrantLevel

Edit

Back to page

(bp)
 
Line 1: Line 1:
{{stub/API}}
 
 
{{wowapi}} __NOTOC__
 
{{wowapi}} __NOTOC__
+
Returns whether you can grant levels to a particular player.
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
 
 
status = CanGrantLevel("unit")
 
status = CanGrantLevel("unit")
 
   
 
== Arguments ==
 
== Arguments ==
<!-- List each argument, together with its type -->
+
;unit : String ([[UnitId]]) - unit to check level grant eligibility of.
:("unit")
 
 
:;unit : [[UnitId]] or a name, returns true if you can grant a level to the target or nil if not
 
 
   
 
== Returns ==
 
== Returns ==
<!-- List each return value, together with its type -->
+
;status : Flag - true if you can grant levels to the unit; nil otherwise (unit is not RAF-linked to you, does not meet level requirements, or you are out of levels to grant).
 
:;status : nil if false, true if you have levels to grant
 
 
   
 
== Example ==
 
== Example ==
  +
The snippet below prints whether you can grant levels to your target right now.
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
local status = CanGrantLevel("target")
 
local status = CanGrantLevel("target")
 
if status then
 
if status then
ChatFrame1:AddMessage("I can grant levels to my friend!")
+
print("I can grant levels to my friend!")
 
else
 
else
ChatFrame1:AddMessage("I am out of free levels for now.")
+
print("I am out of free levels for now.")
 
end
 
end
 
<big>'''Result'''</big>
 
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->
 
 
Outputs in the chat frame either if you can or if you can't grant levels to your target right now.
 

Latest revision as of 14:30, June 20, 2010

WoW API < CanGrantLevel

Returns whether you can grant levels to a particular player.

status = CanGrantLevel("unit")

Arguments Edit

unit 
String (UnitId) - unit to check level grant eligibility of.

Returns Edit

status 
Flag - true if you can grant levels to the unit; nil otherwise (unit is not RAF-linked to you, does not meet level requirements, or you are out of levels to grant).

Example Edit

The snippet below prints whether you can grant levels to your target right now.

local status = CanGrantLevel("target")
if status then
 print("I can grant levels to my friend!")
else
 print("I am out of free levels for now.")
end

Around Wikia's network

Random Wiki