WoW API: GetWorldPVPAreaInfo

From AddOn Studio
Revision as of 03:43, 18 October 2010 by WoWWiki>DarkRyder (boilerplate)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW API < GetWorldPVPAreaInfo

Get information regarding a world PvP zone (e.g. Wintergrasp or Tol Barad).

pvpID, localizedName, isActive, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(pvpID)

Arguments

pvpID
Number - the zone's index, from 1 to GetNumWorldPVPAreas()

Returns

pvpID, localizedName, isActive, canQueue, startTime, canEnter
pvpID
Number - the zone's index, from 1 to GetNumWorldPVPAreas()
localizedName
String - the zone's name, in the current locale
isActive
Boolean - whether a battle is currently taking place in the zone
canQueue
Boolean - whether players can currently queue for the next or current battle
startTime
Number - time until the next battle starts, in seconds
canEnter
Boolean - whether the player meets the necessary requirements to participate in the zone's battle

Example

local _, localizedName, _, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(1)

if startTime > 0 then
    print("Cool your jets, " .. name .. " doesn't start for another " .. SecondsToTime(start) .. ".")
elif canEnter and canQueue then
    print("Get over to " .. name .. ", quick!")
else
    print("They're fighting over in " .. name .. ".  Don't you wish you could join in?")
end

Result

-- if the battle hasn't started yet
"Cool your jets, Tol Barad doesn't start for another 12:34."
-- if the battle is active and the player can join it
"Get over to Tol Barad, quick!"
-- if the battle is active but the player cannot join
"They're fighting over in Tol Barad.  Don't you with you could join in?"

Details

Note that there is some redundancy in the return values. For example, the first return value is always the same as the argument passed and isActive will always be false when startTime is greater than 0.