Playerbot: distinguish combat kills vs NPC-click credit in OnKillCredit
Combat kills carry a creature guid and are ALREADY shared to grouped bots by the core — pushing again double-counts, so skip grouped bots for those (only ungrouped bots get the push). NPC-click credits (Fear No Evil etc.) pass guid EMPTY and are single-caster/not reliably shared, so push to ALL owned bots for those. Distinguishes on guid.IsEmpty(): combat kill (non-empty) -> skip grouped; click (empty) -> push all.
This commit is contained in:
@@ -3214,6 +3214,8 @@ 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(
|
||||
@@ -3223,16 +3225,20 @@ void Module::OnKillCredit(Player* player, uint32 entry, ObjectGuid guid)
|
||||
if (bot->GetMapId() != player->GetMapId())
|
||||
continue;
|
||||
|
||||
// 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.
|
||||
// A real combat kill carries a creature guid and is ALREADY shared to
|
||||
// grouped bots by the core's party system — pushing again double-
|
||||
// counts the objective. So for combat kills (guid non-empty) skip
|
||||
// grouped bots; the core handles them, and only ungrouped bots need
|
||||
// the module push.
|
||||
//
|
||||
// An NPC-click credit (e.g. quest 63447 "Fear No Evil" — clicking
|
||||
// Injured Stormwind Infantry via a spell script) passes guid EMPTY
|
||||
// (0000000000000000): it is single-caster and NOT reliably shared to
|
||||
// party members (range/phase dependent). For those, push to ALL owned
|
||||
// in-world bots regardless of group so nobody misses a click.
|
||||
if (!guid.IsEmpty() && og && og->IsMember(bot->GetGUID()))
|
||||
continue;
|
||||
|
||||
bot->KilledMonsterCredit(entry, guid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user