Skip to content

Commit c490ac6

Browse files
Nyeriahclaude
andcommitted
fix(WG): use public PlayersInWar getter for assist propagation
ForEachPlayerInZone is protected, so iterate the public PlayersInWar sets for both teams instead. The killer is still credited directly (unconditionally), so non-war kills continue to advance the daily. The FFA assist propagation from azerothcore#145 is preserved verbatim for the in-war case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent eecf18d commit c490ac6

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

src/CFBG_SC.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ class CFBG_Battlefield : public BattlefieldScript
321321

322322
// Grant both PvP-kill credit NPCs ("Slay Them All" Horde 13180 needs
323323
// 31086; Alliance counterparts 13177/13179 need 39019) to the killer and
324-
// to nearby same-team allies in the WG zone. KilledMonsterCredit on a
324+
// to nearby war participants on both teams. KilledMonsterCredit on a
325325
// quest the player does not hold is a no-op, so handing out both IDs
326326
// safely covers crossfaction players whose held quest does not match
327-
// their assigned team.
327+
// their assigned team (see #145).
328328
//
329-
// We deliberately do NOT gate on PlayersInWar: the daily must advance
330-
// for kills in the WG zone even when no active war is running.
329+
// Crediting the killer is NOT gated on PlayersInWar: the daily must
330+
// advance for kills in the WG zone even when no active war is running.
331331
TeamId killerTeam = killer->GetTeamId();
332332
uint32 coreCredit = (killerTeam == TEAM_HORDE) ? WG_NPC_QUEST_PVP_KILL_ALLIANCE
333333
: WG_NPC_QUEST_PVP_KILL_HORDE;
@@ -352,17 +352,22 @@ class CFBG_Battlefield : public BattlefieldScript
352352
// war is running and PlayersInWar is empty.
353353
grantTo(killer);
354354

355-
// Propagate assist credit to nearby same-team allies in the zone.
356-
bf->ForEachPlayerInZone([&](Player* p)
355+
// FFA assist credit to nearby war participants on both teams (#145):
356+
// covers flipped players on the opposite team whose original-faction
357+
// quest needs the other credit NPC. No-op outside of an active war
358+
// when PlayersInWar is empty.
359+
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
357360
{
358-
if (!p || p == killer)
359-
return;
360-
if (p->GetTeamId() != killerTeam)
361-
return;
362-
if (p->GetDistance2d(killer) >= 40.0f)
363-
return;
364-
grantTo(p);
365-
});
361+
for (ObjectGuid const& guid : bf->GetPlayersInWarSet(TeamId(team)))
362+
{
363+
Player* p = ObjectAccessor::FindPlayer(guid);
364+
if (!p || p == killer)
365+
continue;
366+
if (p->GetDistance2d(killer) >= 40.0f)
367+
continue;
368+
grantTo(p);
369+
}
370+
}
366371
}
367372

368373
void OnBattlefieldWarEnd(Battlefield* bf, bool /*endByTimer*/) override

0 commit comments

Comments
 (0)