WoW:API GetBattlefieldStatus: Difference between revisions

m
Slightly better example
m (Slightly better example)
Line 1: Line 1:
{{wowapi}}
Get the status of the battlefield that the player is either queued for or inside.
Get the status of the battlefield that the player is either queued for or inside.


Line 24: Line 25:


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.
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.
Appears to return 0 for minlevel and maxlevel of Alterac Valley.


==== Status ====
==== Status ====
Line 34: Line 36:
----
----
=== Example ===
=== Example ===
Auto join a battlefield as soon as it's ready to enter
Display a list of battlefield brackets you're currently queued for, pending confirmation, in, or just finished.
 
  for i=1, MAX_BATTLEFIELD_QUEUES do
    status, mapName, instanceID = GetBattlefieldStatus(i);
    if( status == "confirm" ) then
      AcceptBattlefieldPort( i, true );
    end


----
local status, mapName, instanceID, minlevel, maxlevel;
{{wowapi}}
for i=1, MAX_BATTLEFIELD_QUEUES do
  status, mapName, instanceID, minlevel, maxlevel = GetBattlefieldStatus(i);
  DEFAULT_CHAT_FRAME:AddMessage(mapName .. string.format(" (%d-%d): ", minlevel, maxlevel) ..status);
end