diff --git a/src/modules/Bots/playerbot/LootObjectStack.cpp b/src/modules/Bots/playerbot/LootObjectStack.cpp index 442980249..4a86dc3b7 100644 --- a/src/modules/Bots/playerbot/LootObjectStack.cpp +++ b/src/modules/Bots/playerbot/LootObjectStack.cpp @@ -87,7 +87,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid) } GameObject* go = ai->GetGameObject(guid); - if (go && go->isSpawned()) + if (go && go->isSpawned() && go->getLootState() == GO_READY) { uint32 lockId = go->GetGOInfo()->GetLockId(); LockEntry const *lockInfo = sLockStore.LookupEntry(lockId); diff --git a/src/modules/Bots/playerbot/PlayerbotAI.cpp b/src/modules/Bots/playerbot/PlayerbotAI.cpp index fb7cf20ba..991329106 100644 --- a/src/modules/Bots/playerbot/PlayerbotAI.cpp +++ b/src/modules/Bots/playerbot/PlayerbotAI.cpp @@ -179,9 +179,20 @@ void PlayerbotAI::UpdateAI(uint32 elapsed) } } - if (nextAICheckDelay > sPlayerbotAIConfig.maxWaitForMove && bot->IsInCombat() && !bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (nextAICheckDelay > sPlayerbotAIConfig.maxWaitForMove && + !bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) { - nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove; + if (bot->IsInCombat()) + nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove; + else + { + Player* master = GetMaster(); + if (master && master->IsInCombat()) + { + InterruptSpell(); + nextAICheckDelay = sPlayerbotAIConfig.maxWaitForMove; + } + } } PlayerbotAIBase::UpdateAI(elapsed); diff --git a/src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp b/src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp index e538e673a..47980ca33 100644 --- a/src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp +++ b/src/modules/Bots/playerbot/strategy/actions/AddLootAction.cpp @@ -71,16 +71,27 @@ bool AddGatheringLootAction::AddLoot(ObjectGuid guid) return false; } + return AddAllLootAction::AddLoot(guid); +} + +bool AddGatheringLootAction::isUseful() +{ + // Don't gather in dungeons or raids + if (bot->GetMap()->IsDungeon()) + { + return false; + } + // NC gathering is a problem if you are supposed to be following Player* master = ai->GetMaster(); - if (master && ai->HasStrategy("follow master", BOT_STATE_NON_COMBAT)) + if (master && bot->GetGroup()) { float masterDist = bot->GetDistance(master); - if (masterDist > sPlayerbotAIConfig.reactDistance / 2) + if (masterDist > sPlayerbotAIConfig.reactDistance) { return false; } } - return AddAllLootAction::AddLoot(guid); + return AddAllLootAction::isUseful(); } diff --git a/src/modules/Bots/playerbot/strategy/actions/AddLootAction.h b/src/modules/Bots/playerbot/strategy/actions/AddLootAction.h index 402c50ad4..9effb0cf3 100644 --- a/src/modules/Bots/playerbot/strategy/actions/AddLootAction.h +++ b/src/modules/Bots/playerbot/strategy/actions/AddLootAction.h @@ -24,6 +24,7 @@ namespace ai class AddGatheringLootAction : public AddAllLootAction { public: AddGatheringLootAction(PlayerbotAI* ai) : AddAllLootAction(ai, "add gathering loot") {} + virtual bool isUseful(); protected: virtual bool AddLoot(ObjectGuid guid);