fix(Core/BG): award correct Alterac Valley reputation - #1
Open
icemansparks wants to merge 1 commit into
Open
Conversation
End-of-battle bonus reputation was accumulated in a uint8, so a normal win (towers + graveyards + mines + surviving captain) overflowed 255 and awarded almost nothing. Widen the accumulator to uint32. The three Commander quest turn-ins passed teamId as the faction id, so they modified faction 0/1 instead of Stormpike Guard (730) / Frostwolf Clan (729).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Players report gaining no Alterac Valley reputation. Two independent defects in
src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp, both inherited from upstream AzerothCore: our copy of the file is byte-identical toazerothcore/azerothcore-wotlk(blob0941c82a), so this is not local drift, and no upstream issue covers either one. Realm config is clean on both realms (Rate.Reputation.Gain.AV = 1,Battleground.Alterac.ReputationOnBossDeath = 350), so the tuning knobs are not the cause.1. End-of-battle reputation overflowed a uint8
EndBattlegroundaccumulates every end-of-match bonus into one counter per team, then hands it toRewardReputationToTeam:The node ranges are 8 towers (
BG_AV_NODES_DUNBALDAR_SOUTH7 …BG_AV_NODES_FROSTWOLF_WTOWER14) and 7 graveyards (BG_AV_NODES_FIRSTAID_STATION0 …BG_AV_NODES_FROSTWOLF_HUT6), so the ceiling is 353 at default rate and 517 on a BG weekend, well past 255. It does not take a perfect match to wrap: 4 towers + 5 graveyards + 1 mine + a surviving captain is 257, which truncates to 1 reputation. The failure gets worse the better the team played, and any server runningRate.Reputation.Gain.AVabove 1 wraps sooner. This is the largest single reputation award in the battleground, which is why the symptom reads as "AV gives no rep".The counter is the only thing that is wrong here. The reward values themselves are correct Blizzlike numbers,
RewardReputationToTeamtakesuint32 reputation(Battleground.h:472), andBattleground::RewardReputationToTeamdoes the rate/aura math infloatbefore callingReputationMgr::ModifyReputation. So the accumulator is the one narrow link in an otherwise 32-bit path, and widening it touint32makes the local type match the parameter it feeds rather than introducing a new convention.uint8 kills[2]on the line above is deliberately left alone: its ceiling is 4 + 8 ×BG_AV_KILL_SURVIVING_TOWER(2) +BG_AV_KILL_SURVIVING_CAPTAIN(2) = 22. It cannot overflow, and changing it would be unrelated churn.This line dates back to the initial 2016 import (
e8e94a0a), i.e. it predates AzerothCore and was never revisited.2. Commander quest turn-ins rewarded faction id 0/1
The first parameter is
uint32 factionId, not a team.TeamIdis 0/1, so these three call sites ask for reputation with faction 0 or faction 1.Battleground::RewardReputationToTeamresolves the faction throughGetRealRepFactionForPlayer, whose switch only knowsBG_REP_AV_ALLIANCE/BG_REP_AV_HORDE(and the AB/WSG pairs), then doessFactionStore.LookupEntry(realFactionId)and only callsModifyReputationinsideif (FactionEntry const* factionEntry = ...). Faction 0/1 is not a valid entry, so the lookup fails and nothing is awarded at all — not the wrong faction, no faction. The mercenary-mode reversal thatGetRealRepFactionForPlayerexists for is also silently skipped, because the switch never matches.The three call sites now pass
teamId == TEAM_ALLIANCE ? 730 : 729, which is exactly what every other reputation call in this same file already does — boss kills (105, 113), captain kills (126, 144), tower destruction (661) and the end-of-battle award (560). Same argument order, same ternary, same literals, so the file stays internally consistent and the change is four characters of logic rather than a new helper.Note that only the amount of these three calls was touched recently, by
da5fb6c9/ azerothcore#22685 ("BG reputation modifier for WSG, AB and AV", Oct 2025), which wrapped the constant1in the new AV rate multiplier. TheteamIdfirst argument was already there before that PR and is untouched by it, so the defect is long-standing, not a regression from the rate work. The awarded amount (1 × rate per turn-in) is left exactly as it is: whether 1 is the correct Blizzlike value for the soldier/lieutenant/commander turn-ins is a separate question from the faction being invalid, and mixing the two would make this PR unreviewable.Alternatives considered
BG_REP_AV_ALLIANCE/BG_REP_AV_HORDE(Battleground.h:143-144) instead of730/729. Semantically identical. Rejected for consistency: every reward call in the BG zone files uses the bare literals, and the named enum is referenced only insideGetRealRepFactionForPlayer. Introducing the constants at three of the file's nine call sites would leave the file half-converted. Converting all of them is a readability cleanup that deserves its own commit, not a bugfix that has to be cherry-picked and verified.Battleground.Alterac.ReputationOnBossDeathconfig are built around.RewardReputationToTeamcalls per match end, more packets, and it changes observable behaviour (several small reputation messages instead of one). No benefit over fixing the type.battleground_templateor any world table.Scope and verification
Four changed lines, one file, no signature or API changes, no DB migration. Both fixes are independent, so a failure in play-testing points at exactly one of them.
Merging here first is what makes a test build possible at all:
ops config repo branchpins the core repo tomerkerhoodbecause it calibrates the config matrix and module set, so a side branch cannot be checked out for a testcore build. Upstream PR toazerothcore/azerothcore-wotlkfollows once a test AV run confirms the reputation numbers.