WoW:API GetBattlefieldStatus: Difference between revisions

m
No edit summary
Line 1: Line 1:
Get the status of the battlefield that the player is either queued for or inside.
  status, mapName, instanceID = GetBattlefieldStatus(index);
  status, mapName, instanceID = GetBattlefieldStatus(index);


Get status on a battlefield
== 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 [[Eastern Kingdoms]])
:;instanceID : Integer - Battlefield instance (returns 0 until you are inside an active battlefield)


Value of index appears to be the Battlefield queue index. Changed from null argument to index in 1.9
(''new in 1.12'')
:;lowestLevel : Integer - Appears to return the lowest level in the battleground that will be joining (10, 20, 30, 40, 51 or 60)
:;highestLevel : Integer - Appears to return the highest level in the battleground that will be joining (19, 29, 39, 49 or 60)


----
----
;''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 battlegrounds that the player is queued or inside of, if the player is not queued for all 3 battlegrounds at once then passing an index higher then they are queued for will return none for status and [[Eastern Kingdoms]] as a map name.
:;instanceID : Integer - The number of the Battlefield instance
 
==== Status ====
* queued - Waiting for a battlefield to become ready
* confirm - Ready to join a battlefield
* active - You're inside an active battlefield
* none - Invalid index passed, not in queue for anything
* error - This should never happen


----
=== Example ===
Auto join a battlefield as soon as it's ready to enter


   for i=1, MAX_BATTLEFIELD_QUEUES do
   for i=1, MAX_BATTLEFIELD_QUEUES do
     status, mapName, instanceID = GetBattlefieldStatus(i);
     status, mapName, instanceID = GetBattlefieldStatus(i);
     if ( instanceID ~= 0 ) then
     if( status == "confirm" ) then
        mapName = mapName.." "..instanceID;
      AcceptBattlefieldPort( i, true );
     end
     end
    ...


----
----
{{WoW API}}
{{wowapi}}
Anonymous user