Playerbot: sell_trash — drop the 4y vendor proximity gate + result log
Bots follow the owner at formation distance (2.5-8y), so when the owner uses sell-all-junk the bot is usually beyond GetNPCIfCanInteractWith's ~4y range and sell_trash bailed with InvalidTarget — nothing was ever sold. Bots are headless, so look the vendor up directly (flag-checked) without the proximity requirement, and log the sold-item count.
This commit is contained in:
@@ -4012,8 +4012,13 @@ static bool BotShouldVendorBoeGreen(Player* p, Item* it, ItemTemplate const* tmp
|
||||
Result API::sell_trash(ObjectGuid npc)
|
||||
{
|
||||
if (!p_) return Result::Other;
|
||||
Creature* vendor = p_->GetNPCIfCanInteractWith(npc, UNIT_NPC_FLAG_VENDOR, UNIT_NPC_FLAG_2_NONE);
|
||||
if (!vendor) return Result::InvalidTarget;
|
||||
// Owner commands sell-all-junk at THEIR vendor. The bot follows at
|
||||
// formation distance and is usually beyond the ~4y interaction range, so
|
||||
// the proximity gate in GetNPCIfCanInteractWith rejects it. Bots are
|
||||
// headless — look the vendor up directly and verify the flag instead.
|
||||
Creature* vendor = ObjectAccessor::GetCreature(*p_, npc);
|
||||
if (!vendor || !vendor->HasNpcFlag(UNIT_NPC_FLAG_VENDOR))
|
||||
return Result::InvalidTarget;
|
||||
|
||||
// Iterate inventory and main bags. Sell:
|
||||
// 1) Every Poor (grey) item — vendor trash baseline.
|
||||
@@ -4109,6 +4114,10 @@ Result API::sell_trash(ObjectGuid npc)
|
||||
for (Item* it : to_sell)
|
||||
p_->SellItemToVendor(it, it->GetCount());
|
||||
|
||||
TC_LOG_ERROR("playerbot.v2",
|
||||
"[SellTrash] {} sold {} item(s) at {} (bags_tight={})",
|
||||
p_->GetName(), to_sell.size(), vendor->GetName(), bags_tight);
|
||||
|
||||
return to_sell.empty() ? Result::InvalidTarget : Result::Ok;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user