Shadowed51320@legacy41570690 (talk | contribs) m (Updated to make this more accurate) |
Parl200143821@legacy41563549 (talk | contribs) m (→Example) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{wowapi}} |
+ | {{wowapi}} __NOTOC__ |
− | Queues the player, or the |
+ | Queues the player, or the player's group, for a battlefield instance. |
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | ;asGroup : Boolean - If true-equivalent, the player's group is queued for the battlefield, otherwise, only the player is queued. |
||
+ | ;isRated : Boolean - If true-equivalent, and queueing for an arena bracket, the group is queued for a rated match as opposed to a skirmish. |
||
− | == |
+ | == Details == |
+ | The function requests the player to be added to a queue for a particular instance of the currently selected battleground type, as set by {{api|RequestBattlegroundInstanceInfo}}(index). You CANNOT queue immediately after a {{api|RequestBattlegroundInstanceInfo}} call, and must instead capture the event that indicates that the instance list is available. |
||
⚫ | |||
− | :index, joinAs, isRated |
||
⚫ | |||
⚫ | |||
+ | The following code creates a utility function, JoinBattlegroundType, which allows you to queue for the first available instance of a specific battleground type. |
||
− | :;joinAs : Integer - Queue as a group |
||
+ | do |
||
− | :;isRated : Integer - Queues for a rated arena |
||
+ | local f, aG, iR = CreateFrame("FRAME"); |
||
+ | f:SetScript("OnEvent", function(self, event) |
||
⚫ | |||
+ | self:UnregisterEvent("PVPQUEUE_ANYWHERE_SHOW"); |
||
⚫ | |||
+ | function JoinBattlegroundType(index, asGroup, isRated) |
||
+ | if f:IsEventRegistered("PVPQUEUE_ANYWHERE_SHOW") then |
||
+ | error("A join battleground request is already being processed"); |
||
+ | end |
||
+ | f:RegisterEvent("PVPQUEUE_ANYWHERE_SHOW"); |
||
+ | aG, iR = asGroup, isRated; |
||
+ | RequestBattlegroundInstanceInfo(index); |
||
+ | end |
||
+ | end |
||
− | ---- |
||
− | === Details === |
||
− | Queues the player for the current battlefield they have open. |
||
+ | The following will queue you for Skirmish 2v2 if not in a group. |
||
⚫ | |||
− | |||
− | [[Patch 2.0.3]] You can no longer queue a group for Alterac Valley, and if the battlefield window is closed it won't queue you for the last opened battlefield. |
||
− | [[Patch 2.4.0]] Queuing for Alterac Valley as a group is back |
||
− | ---- |
||
⚫ | |||
− | Queue the players group for the battlefield window open. |
||
− | |||
⚫ | |||
− | -- Queue as a group for the first available battleground |
||
⚫ | |||
− | else |
||
− | -- Solo queue for the first available battleground |
||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
− | Queue the players group for a rated 3vs3 arena. |
||
+ | == Notes == |
||
− | JoinBattlefield(2, 1, 1); |
||
⚫ | |||
+ | == See Also == |
||
− | __NOTOC__ |
||
⚫ |
Revision as of 23:14, 7 March 2010
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Queues the player, or the player's group, for a battlefield instance.
JoinBattlefield(index[, asGroup[, isRated]])
Arguments
- index
- Number - Which battlefield instance to queue for (0 for first available), or which arena bracket to queue for.
- asGroup
- Boolean - If true-equivalent, the player's group is queued for the battlefield, otherwise, only the player is queued.
- isRated
- Boolean - If true-equivalent, and queueing for an arena bracket, the group is queued for a rated match as opposed to a skirmish.
Details
The function requests the player to be added to a queue for a particular instance of the currently selected battleground type, as set by RequestBattlegroundInstanceInfo(index). You CANNOT queue immediately after a RequestBattlegroundInstanceInfo call, and must instead capture the event that indicates that the instance list is available.
Example
The following code creates a utility function, JoinBattlegroundType, which allows you to queue for the first available instance of a specific battleground type.
do local f, aG, iR = CreateFrame("FRAME"); f:SetScript("OnEvent", function(self, event) JoinBattlefield(0, aG, iR); self:UnregisterEvent("PVPQUEUE_ANYWHERE_SHOW"); end); function JoinBattlegroundType(index, asGroup, isRated) if f:IsEventRegistered("PVPQUEUE_ANYWHERE_SHOW") then error("A join battleground request is already being processed"); end f:RegisterEvent("PVPQUEUE_ANYWHERE_SHOW"); aG, iR = asGroup, isRated; RequestBattlegroundInstanceInfo(index); end end
The following will queue you for Skirmish 2v2 if not in a group.
/script JoinBattlefield(1)
Notes
- When the Arena Battlemaster window is open, index 1 is 2vs2, index 2 is 3vs3 and index 3 is 5vs5.