Playerbot: push kill/click credit to ALL owned bots (fix missed clicks)

NPC-click objectives (quest 63447 'Fear No Evil') are single-caster spell-script
credits the core does not reliably share to party members — when the owner
rushed the clicks, an out-of-range/sync bot (Lica) missed a click. Pushing
KilledMonsterCredit to every owned in-world bot regardless of group makes it
robust; it is idempotent (core ignores already-complete objectives) and the
per-bot OnKillCredit re-entry is filtered by IsBot(), so no double count.
This commit is contained in:
devbox
2026-08-20 18:01:26 +10:00
parent 80667a6bf7
commit 802acdfc3a
+10 -14
View File
@@ -3214,8 +3214,6 @@ void Module::OnKillCredit(Player* player, uint32 entry, ObjectGuid guid)
if (bots.empty())
return;
Group* og = player->GetGroup();
for (BotId id : bots)
{
Player* bot = ObjectAccessor::FindConnectedPlayer(
@@ -3225,18 +3223,16 @@ void Module::OnKillCredit(Player* player, uint32 entry, ObjectGuid guid)
if (bot->GetMapId() != player->GetMapId())
continue;
// Grouped bots are already credited by the core's party-shared
// kill-credit system when nearby and on the quest — for COMBAT kills
// AND non-combat credits like NPC-click objectives (observed: quest
// 63447 "Fear No Evil", clicking Injured Stormwind Infantry fires
// OnKillCredit for every grouped bot). Pushing again double-counts
// the objective. Only push to bots NOT in the owner's group.
if (og && og->IsMember(bot->GetGUID()))
continue;
TC_LOG_ERROR("playerbot.v2",
"[OnKillCredit] push {} entry={} (not in owner group)",
bot->GetName(), entry);
// NPC-click credits (e.g. quest 63447 "Fear No Evil" — clicking
// Injured Stormwind Infantry) are single-caster spell-script credits
// the core does NOT reliably share to party members (range/phase
// dependent). The module's push is what guarantees every owned bot
// receives the click. Pushing is idempotent for bots that already got
// it (the core's UpdateQuestObjectiveProgress ignores a completed
// objective and never double-counts the same player twice), and the
// per-bot OnKillCredit re-entry is filtered by sess->IsBot() above, so
// there is no self-reinforcing loop. Push to ALL owned in-world bots
// regardless of group membership.
bot->KilledMonsterCredit(entry, guid);
}
}