AgentSkillsCN

wow-api-pvp

WoW Retail PvP、战场、竞技场、评级PvP、战争模式、决斗、战争游戏,以及荣誉/征服API的完整参考。涵盖C_PvP(PvP信息、评级数据、奖励、战场、竞技场、战争模式、乱斗、特殊事件)、决斗功能(AcceptDuel、CancelDuel、StartDuel)、战争游戏功能、荣誉/征服追踪、PvP天赋整合,以及PvP相关事件。当您需要处理PvP系统、战场、竞技场、评级PvP、战争模式、荣誉、征服、决斗,或PvP UI时,此功能将为您提供全面支持。

SKILL.md
--- frontmatter
name: wow-api-pvp
description: "Complete reference for WoW Retail PvP, Battlegrounds, Arenas, Rated PvP, War Mode, Duels, War Games, and Honor/Conquest APIs. Covers C_PvP (PvP info, rated stats, rewards, battlegrounds, arenas, war mode, brawls, special events), duel functions (AcceptDuel, CancelDuel, StartDuel), war game functions, honor/conquest tracking, PvP talent integration, and PvP-related events. Use when working with PvP systems, battlegrounds, arenas, rated PvP, war mode, honor, conquest, duels, or PvP UI."

PvP API (Retail — Patch 12.0.0)

Comprehensive reference for PvP, battlegrounds, arenas, rated PvP, war mode, and duels.

Source: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API Current as of: Patch 12.0.0 (Build 65655) — January 28, 2026 Scope: Retail only.


Scope

  • C_PvP — PvP info, rated stats, rewards, queuing
  • Battlegrounds — BG state, score, flags
  • Arenas — Arena info, teams, ratings
  • War Mode — War mode toggle, bonuses
  • Duels — Accept, cancel, start
  • Honor/Conquest — Currency tracking

C_PvP — Core PvP System

PvP State & Info

FunctionReturnsDescription
C_PvP.IsPVPMap()isPVPIn a PvP map?
C_PvP.IsInPVPBattleground()inBGIn a battleground? (deprecated name for IsInBattleground)
C_PvP.IsInBattleground()inBGIn a battleground?
C_PvP.IsBattleground()isBGCurrent zone is BG?
C_PvP.IsArena()isArenaIn an arena?
C_PvP.IsSoloShuffle()isSoloShuffleIn solo shuffle?
C_PvP.IsBlitz()isBlitzIn blitz BG?
C_PvP.IsRatedBattleground()isRatedIn rated BG?
C_PvP.IsRatedArena()isRatedIn rated arena?
C_PvP.IsRatedMap()isRatedIn any rated match?
C_PvP.IsWarModeDesired()isDesiredWar mode toggled on?
C_PvP.IsWarModeActive()isActiveWar mode currently active?
C_PvP.IsWarModeFeatureEnabled()isEnabledWar mode feature available?
C_PvP.CanToggleWarMode(toggle)canToggleCan toggle war mode?
C_PvP.ToggleWarMode()Toggle war mode
C_PvP.GetWarModeRewardBonus()bonusPercentWar mode XP/resource bonus %
C_PvP.IsPvPTalentsUnlocked()isUnlockedPvP talents available?
C_PvP.GetPVPActiveMatchDuration()durationActive match duration
C_PvP.GetPVPActiveMatchState()stateMatch state

Rated PvP

FunctionReturnsDescription
C_PvP.GetRatedBGRewards()rewardInfoRated BG rewards
C_PvP.GetArenaRewards(teamSize)rewardInfoArena rewards
C_PvP.GetSeasonBestInfo()tierID, nextTierIDSeason best tier
C_PvP.GetCurrentSeasonNumber()seasonCurrent PvP season
C_PvP.GetRankInfo(hk, guid)rankName, rankNumberPvP rank info
C_PvP.GetGlobalPvpScalingInfoForSpecID(specID)infoPvP scaling
C_PvP.GetLevelUpBattlegrounds()bgIDsAvailable BGs for level
C_PvP.GetRandomBGInfo()infoRandom BG info
C_PvP.GetRandomBGRewards()rewardInfoRandom BG rewards
C_PvP.GetRandomEpicBGInfo()infoRandom epic BG info
C_PvP.GetSkirmishInfo(bracketIndex)infoSkirmish info
C_PvP.GetPvpTierInfo(tierID)tierInfoPvP tier details
C_PvP.GetPvpTierID(bracketIndex, guid)tierIDPlayer's tier in bracket

Honor & Conquest

FunctionReturnsDescription
C_PvP.GetHonorRewardInfo(honorLevel)rewardInfoHonor level reward
GetHonorLevel()levelCurrent honor level
UnitHonorLevel(unit)levelUnit's honor level
GetMaxPlayerHonorLevel()maxLevelMax honor level
GetPVPLifetimeStats()hk, dk, highestRankLifetime PvP stats
GetPVPSessionStats()hk, dkSession PvP stats
GetPVPYesterdayStats()hk, dk, honorYesterday's stats

Battleground Score

FunctionReturnsDescription
GetNumBattlefieldScores()numScoresScore entries
GetBattlefieldScore(index)name, killingBlows, honorKills, deaths, honorGained, faction, race, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpecScore info
GetBattlefieldStatData(index, statIndex)valueBG-specific stat
GetNumBattlefieldStats()numStatsBG stat columns
GetBattlefieldStatInfo(statIndex)name, icon, tooltipStat column info

Battleground/Arena Queue

FunctionReturnsDescription
C_PvP.RequestCrowdControlSpell(unitToken)Request CC info
JoinBattlefield(index [, asGroup [, isRated]])Join BG queue
LeaveBattlefield()Leave BG
AcceptBattlefieldPort(index, acceptFlag)Accept/decline BG port
GetBattlefieldPortExpiration(index)expirationPort expiration time
GetBattlefieldStatus(index)status, mapName, teamSize, registeredMatch, suspendedQueue, queueType, gameID, role, asGroup, shortDescription, longDescriptionQueue status
GetMaxBattlefieldID()maxIDMax battlefield ID
GetBattlefieldInstanceRunTime()runTimeInstance elapsed ms
GetBattlefieldTimeWaited(index)timeWaitedTime in queue
GetBattlefieldEstimatedWaitTime(index)waitTimeEstimated wait
GetBattlefieldWinner()winnerWinning faction

Duel Functions

FunctionReturnsDescription
AcceptDuel()Accept duel request
CancelDuel()Decline/cancel duel
StartDuel(unit)Request duel

War Game Functions

FunctionReturnsDescription
C_PvP.StartWarGame(targetName, warGameType, ...)Start war game
C_PvP.IsWarGameByMasterAllowed()allowedCan start war games?

Common Patterns

Check PvP Context

lua
local function GetPvPContext()
    if C_PvP.IsArena() then return "arena"
    elseif C_PvP.IsInBattleground() then return "battleground"
    elseif C_PvP.IsWarModeActive() then return "warmode"
    else return "pve" end
end

Display Rated PvP Info

lua
local function PrintRatedInfo()
    local season = C_PvP.GetCurrentSeasonNumber()
    print("PvP Season:", season)
    
    -- Check bracket ratings
    for bracketIndex = 1, 4 do
        local tierID = C_PvP.GetPvpTierID(bracketIndex, UnitGUID("player"))
        if tierID then
            local tierInfo = C_PvP.GetPvpTierInfo(tierID)
            if tierInfo then
                print("Bracket", bracketIndex, ":", tierInfo.pvpTierEnum, tierInfo.tierName)
            end
        end
    end
end

Key Events

EventPayloadDescription
PVP_MATCH_ACTIVEPvP match started
PVP_MATCH_COMPLETEwinnerMatch ended
PVP_MATCH_INACTIVEMatch inactive
UPDATE_BATTLEFIELD_STATUSbattlefieldIndexQueue status changed
UPDATE_BATTLEFIELD_SCOREScoreboard updated
BATTLEFIELD_QUEUE_TIMEOUTQueue timed out
WARGAME_REQUESTEDopposingPartyMemberName, bgName, timeout, tournamentRulesWar game request
DUEL_REQUESTEDplayerNameDuel request received
DUEL_FINISHEDDuel ended
DUEL_INBOUNDSPlayer in duel bounds
DUEL_OUTOFBOUNDSPlayer out of bounds
HONOR_LEVEL_UPDATEisHigherLevelHonor level changed
PVP_RATED_STATS_UPDATERated stats updated
PVP_REWARDS_UPDATEPvP rewards updated
WAR_MODE_STATUS_UPDATEisWarModeDesiredWar mode toggled
PLAYER_FLAGS_CHANGEDunitTargetPvP flag changed
PVP_TIMER_UPDATEPvP timer updated
PVP_VEHICLE_INFO_UPDATEDPvP vehicle info changed
PVP_WORLDSTATE_UPDATEWorld state updated
ARENA_OPPONENT_UPDATEunitToken, updateReasonArena opponent updated
ARENA_PREP_OPPONENT_SPECIALIZATIONSArena opponent specs
ARENA_SEASON_WORLD_STATEArena season state

Gotchas & Restrictions

  1. War mode toggle location — Can only toggle war mode in Stormwind/Orgrimmar (capital cities), not anywhere.
  2. BG score indicesGetBattlefieldScore() indices are 1-based and may not match player order.
  3. Queue indexGetBattlefieldStatus() uses queue index (1-based), not battlefield ID.
  4. PvP talents — PvP talents are managed through C_SpecializationInfo, not C_PvP. See the talents skill.
  5. AcceptBattlefieldPort hardware event — Requires a hardware event to accept.
  6. 12.0.0 instance restrictions — In BGs and arenas, enemy player info (name, class, health) may be secret values.
  7. Honor is a currency — Honor and conquest are currencies. Use C_CurrencyInfo for tracking amounts.
  8. Season resets — Rated PvP data resets each season. GetCurrentSeasonNumber() tracks the season.