WoW:API GetBattlefieldStatus: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Slightly better example)
(Renamed teamType to teamSize)
Line 15: Line 15:
:;map : String - Localized battlefield name ([[Warsong Gulch]], [[Arathi Basin]], [[Alterac Valley]] or [[Eastern Kingdoms]])
:;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)
:;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 or 60)
(''new in 1.12'')
:;highestLevel : Integer - Highest level in the battleground that will be joining (19, 29, 39, 49 or 60)
:;lowestLevel : Integer - Appears to return the lowest level in the battleground that will be joining (10, 20, 30, 40, 51 or 60)
(''new in 2.0.1'')
:;highestLevel : Integer - Appears to return the highest level in the battleground that will be joining (19, 29, 39, 49 or 60)
:;teamSize: Integer - This appears to be used for arena's and is the team size for the arena (2, 3, 5 or 0 if it's not an arena queue)
 
----
----


Line 36: Line 35:
----
----
=== Example ===
=== Example ===
Display a list of battlefield brackets you're currently queued for, pending confirmation, in, or just finished.
Display a list of battlefield brackets and arena's you're currently queued for, pending confirmation, in, or just finished.


  local status, mapName, instanceID, minlevel, maxlevel;
  local status, mapName, instanceID, minlevel, maxlevel;
  for i=1, MAX_BATTLEFIELD_QUEUES do
  for i=1, MAX_BATTLEFIELD_QUEUES do
   status, mapName, instanceID, minlevel, maxlevel = GetBattlefieldStatus(i);
   status, mapName, instanceID, minlevel, maxlevel, teamSize = GetBattlefieldStatus(i);
   DEFAULT_CHAT_FRAME:AddMessage(mapName .. string.format(" (%d-%d): ", minlevel, maxlevel) ..status);
   if( teamSize > 0 ) then
end
    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

Revision as of 05:54, 10 December 2006

WoW API < GetBattlefieldStatus

Get the status of the battlefield that the player is either queued for or inside.

status, mapName, instanceID = GetBattlefieldStatus(index);

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)
lowestLevel
Integer - Lowest level in the battleground that will be joining (10, 20, 30, 40, 51 or 60)
highestLevel
Integer - Highest level in the battleground that will be joining (19, 29, 39, 49 or 60)

(new in 2.0.1)

teamSize
Integer - This appears to be used for arena's and is the team size for the arena (2, 3, 5 or 0 if it's not an arena queue)

Details

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

  • 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

Display a list of battlefield brackets and arena's 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