mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
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:
@@ -79,9 +79,16 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
||||
return false;
|
||||
|
||||
Creature* creature = botAI->GetCreature(lootObject.guid);
|
||||
if (creature && bot->GetDistance(creature) > INTERACTION_DISTANCE)
|
||||
if (creature && bot->GetDistance(creature) > INTERACTION_DISTANCE - 2.0f)
|
||||
return false;
|
||||
|
||||
// Dismount if the bot is mounted
|
||||
if (bot->IsMounted())
|
||||
{
|
||||
bot->Dismount();
|
||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->lootDelay); // Small delay to avoid animation issues
|
||||
}
|
||||
|
||||
if (creature && creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
||||
{
|
||||
WorldPacket packet(CMSG_LOOT, 8);
|
||||
@@ -116,7 +123,7 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
||||
}
|
||||
|
||||
GameObject* go = botAI->GetGameObject(lootObject.guid);
|
||||
if (go && bot->GetDistance(go) > INTERACTION_DISTANCE)
|
||||
if (go && bot->GetDistance(go) > INTERACTION_DISTANCE - 2.0f)
|
||||
return false;
|
||||
|
||||
if (go && (go->GetGoState() != GO_STATE_READY))
|
||||
@@ -418,6 +425,7 @@ bool StoreLootAction::Execute(Event event)
|
||||
WorldPacket packet(CMSG_AUTOSTORE_LOOT_ITEM, 1);
|
||||
packet << itemindex;
|
||||
bot->GetSession()->HandleAutostoreLootItemOpcode(packet);
|
||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->lootDelay);
|
||||
|
||||
if (proto->Quality > ITEM_QUALITY_NORMAL && !urand(0, 50) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig->randomBotEmote)
|
||||
botAI->PlayEmote(TEXT_EMOTE_CHEER);
|
||||
|
||||
Reference in New Issue
Block a user