Resolved issues with herb gathering (#926)

* Check game objects loot tables and determine if loot is valid

* Removed LOS checks since they already occur and removed enemy near node check

* Dismount if mounted, decresed interaction distance, added looting delay

* Decreased interaction distance

* oops, wrong file

* Check game objects loot tables and determine if loot is valid
This commit is contained in:
avirar
2025-01-30 10:29:17 +11:00
committed by GitHub
parent 247c67e449
commit 0c8785d8d1
4 changed files with 131 additions and 53 deletions

View File

@@ -51,29 +51,11 @@ bool AddGatheringLootAction::AddLoot(ObjectGuid guid)
if (loot.IsEmpty() || !wo)
return false;
if (!bot->IsWithinLOSInMap(wo))
return false;
if (loot.skillId == SKILL_NONE)
return false;
if (!loot.IsLootPossible(bot))
return false;
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, wo), INTERACTION_DISTANCE))
{
std::list<Unit*> targets;
Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, bot, sPlayerbotAIConfig->lootDistance);
Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(bot, targets, u_check);
Cell::VisitAllObjects(bot, searcher, sPlayerbotAIConfig->lootDistance * 1.5f);
if (!targets.empty())
{
std::ostringstream out;
out << "Kill that " << targets.front()->GetName() << " so I can loot freely";
botAI->TellError(out.str());
return false;
}
}
return AddAllLootAction::AddLoot(guid);
}