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()) if (bots.empty())
return; return;
Group* og = player->GetGroup();
for (BotId id : bots) for (BotId id : bots)
{ {
Player* bot = ObjectAccessor::FindConnectedPlayer( Player* bot = ObjectAccessor::FindConnectedPlayer(
@@ -3225,18 +3223,16 @@ void Module::OnKillCredit(Player* player, uint32 entry, ObjectGuid guid)
if (bot->GetMapId() != player->GetMapId()) if (bot->GetMapId() != player->GetMapId())
continue; continue;
// Grouped bots are already credited by the core's party-shared // NPC-click credits (e.g. quest 63447 "Fear No Evil" — clicking
// kill-credit system when nearby and on the quest — for COMBAT kills // Injured Stormwind Infantry) are single-caster spell-script credits
// AND non-combat credits like NPC-click objectives (observed: quest // the core does NOT reliably share to party members (range/phase
// 63447 "Fear No Evil", clicking Injured Stormwind Infantry fires // dependent). The module's push is what guarantees every owned bot
// OnKillCredit for every grouped bot). Pushing again double-counts // receives the click. Pushing is idempotent for bots that already got
// the objective. Only push to bots NOT in the owner's group. // it (the core's UpdateQuestObjectiveProgress ignores a completed
if (og && og->IsMember(bot->GetGUID())) // objective and never double-counts the same player twice), and the
continue; // 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
TC_LOG_ERROR("playerbot.v2", // regardless of group membership.
"[OnKillCredit] push {} entry={} (not in owner group)",
bot->GetName(), entry);
bot->KilledMonsterCredit(entry, guid); bot->KilledMonsterCredit(entry, guid);
} }
} }