perf(WG): drop per-kill assist iteration; credit killer only#150
Merged
Nyeriah merged 1 commit intoMay 27, 2026
Merged
Conversation
azerothcore#149 credited the killer plus iterated all same-team players in the WG zone (ForEachPlayerInZone) within 40y on every player kill. The iteration scales with war population (~100 players in a full WG) and runs for every kill, including the common non-lieutenant case -- too costly for a daily-quest credit path. The killer-direct credit was the actual fix from azerothcore#149 (daily advances on any WG-zone kill, war or not, and crossfaction players still advance their original-faction quest via otherCredit). Keep that part and drop the per-kill iteration. Lieutenant dedup is now O(1): skip coreCredit only when the victim is a lieutenant AND the killer is in PlayersInWar[killerTeam] (a single hash-set count, not a scan). Core's existing lieutenant-only assist path in BattlefieldWG::HandleKill still fires unchanged for nearby allies on lieutenant kills. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
eed965f to
628addc
Compare
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.
Summary
Follow-up to #149. That PR fixed the actual bug (Slay Them All not crediting outside an active war) by crediting the killer directly and iterating nearby same-team players in the zone for assist credit. The iteration scales with war population (~100 players in a full WG) and runs on every kill — too costly for a daily-quest credit path.
ForEachPlayerInZonescan.count(killer->GetGUID())instead of an iteration.BattlefieldWG::HandleKillstill fires unchanged for nearby allies on lieutenant kills.Net result: same user-visible behavior as #149 for the killer (the only player that must be credited for the daily to advance), at O(1) per kill instead of O(zone-population).
Test plan
otherCredit).🤖 Generated with Claude Code