diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp index fdd19899c3afb..5195727c9c737 100644 --- a/src/server/game/AI/NpcBots/bot_ai.cpp +++ b/src/server/game/AI/NpcBots/bot_ai.cpp @@ -611,8 +611,7 @@ void bot_ai::ResetBotAI(uint8 resetType) if (resetType == BOTAI_RESET_INIT || resetType == BOTAI_RESET_LOGOUT) { NpcBotData const* npcBotData = BotDataMgr::SelectNpcBotData(me->GetEntry()); - _checkOwershipTimer = (BotMgr::GetOwnershipExpireTime() && npcBotData->owner) ? - ((resetType == BOTAI_RESET_INIT || BotMgr::GetOwnershipExpireMode() == BOT_OWNERSHIP_EXPIRE_HIRE) ? 1000 : CalculateOwnershipCheckTime()) : 0; + _checkOwershipTimer = (BotMgr::GetOwnershipExpireTime() && npcBotData->owner) ? (resetType == BOTAI_RESET_INIT) ? 1000 : CalculateOwnershipCheckTime() : 0; if (resetType == BOTAI_RESET_INIT) homepos.Relocate(me); else //if (resetType == BOTAI_RESET_LOGOUT) @@ -15214,7 +15213,14 @@ void bot_ai::FindMaster() uint32 bot_ai::CalculateOwnershipCheckTime() { - return std::min(BotMgr::GetOwnershipExpireTime(), urand(58 * MINUTE * IN_MILLISECONDS, 62 * MINUTE * IN_MILLISECONDS)); + NpcBotData const* npcBotData = BotDataMgr::SelectNpcBotData(me->GetEntry()); + if (!npcBotData->owner) + return 0; + + if (!IAmFree() || BotMgr::GetOwnershipExpireMode() == BOT_OWNERSHIP_EXPIRE_OFFLINE) + return static_cast(std::min(BotMgr::GetOwnershipExpireTime(), urand(3 * MINUTE, 7 * MINUTE)) * IN_MILLISECONDS); + + return static_cast(std::max(time_t(npcBotData->hire_time + BotMgr::GetOwnershipExpireTime() + 1) - time(0), 5) * IN_MILLISECONDS); } bool bot_ai::IAmFree() const