WoW:API GetBattlefieldStatus: Difference between revisions

m
Move page script moved page API GetBattlefieldStatus to WoW:API GetBattlefieldStatus without leaving a redirect
No edit summary
m (Move page script moved page API GetBattlefieldStatus to WoW:API GetBattlefieldStatus without leaving a redirect)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
status, mapName, instanceID = GetBattlefieldStatus(index);
{{wowapi}} __NOTOC__
Get the status of the battlefield that the player is either queued for or inside.


Get status on a battlefield
status, mapName, instanceID, lowestlevel, highestlevel, teamSize, registeredMatch = GetBattlefieldStatus(index);


Value of index appears to be the Battlefield queue index. Changed from null argument to index in 1.9
== Parameters ==
=== Arguments ===


:;index : Index of the battlefield you wish to view
----
=== Returns ===
:;status : String - Battlefield status (none, queued, confirm, active, error)
:;map : String - Localized battlefield name ([[Warsong Gulch]], [[Arathi Basin]], [[Alterac Valley]] or nil)
:;instanceID : Integer - Battlefield instance (returns 0 until you are inside an active battlefield)
:;lowestLevel : Integer - Lowest level in the battleground that will be joining (10, 20, 30, 40, 51, 60, 61, 70)
:;highestLevel : Integer - Highest level in the battleground that will be joining (19, 29, 39, 49, 60, 69, 70)
:;teamSize: Integer - Team size of the battlefields queue (2, 3, 5 or 0 if not an arena queue)
:;registeredMatch: Integer - Returns 1 if it's a registered arena queue, returns 0 if it's a skirimish or not an arena queue, use teamSize to check for arenas
----
----
;''Returns''


:status, mapName, instanceID
=== Details ===
:;status : String - The player's Battlefield status ('none', 'queued', 'confirm', 'active', 'error')
 
:;mapName : String - The queued Battlefield's name ('Alterac Valley', etc.)
Used for retrieving the status of the battlefields that the player is queued or inside of. If the player is not queued for a battlefield you request it'll return a status of none, requesting an index above 3 will return nil, map name will either be the last battlefield this index was used for or nil you should always use status to verify if it's an an active queue/game.
:;instanceID : Integer - The number of the Battlefield instance


As of [[Patch 2.4.0]] map is displayed as "Eastern Kingdoms" during confirm status, and the real map is shown once it's changed to active. instanceID is now always 0 for arena matches as well.


  for i=1, MAX_BATTLEFIELD_QUEUES do
==== Status ====
    status, mapName, instanceID = GetBattlefieldStatus(i);
* queued - Waiting for a battlefield to become ready, you're in the queue
    if ( instanceID ~= 0 ) then
* confirm - Ready to join a battlefield
        mapName = mapName.." "..instanceID;
* active - Inside an active battlefield
    end
* none - Not queued for anything in this index
    ...
* error - This should never happen


----
----
{{WoW API}}
 
=== Example ===
Display a list of battlefield brackets and arenas you're currently queued for, pending confirmation, in, or just finished.
 
local status, mapName, instanceID, minlevel, maxlevel;
for i=1, MAX_BATTLEFIELD_QUEUES do
  status, mapName, instanceID, minlevel, maxlevel, teamSize = GetBattlefieldStatus(i);
  if( teamSize > 0 ) then
    DEFAULT_CHAT_FRAME:AddMessage(mapName .. string.format("%dvs%d (%d-%d): ", minlevel, maxlevel, teamType, teamType) ..status);
  else
    DEFAULT_CHAT_FRAME:AddMessage(mapName .. string.format(" (%d-%d): ", minlevel, maxlevel) ..status);
  end
end
Anonymous user