mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
fix: ⚡ added missing checks for PetIsDeadValue (#1376)
* fix: ⚡ added missing guildTaskEnabled checks for GuildTaskMgr
Even if guildTaskEnabled was set to 0 in the configuration file, a few queries like PLAYERBOTS_SEL_GUILD_TASKS_BY_VALUE, PLAYERBOTS_SEL_GUILD_TASKS_BY_OWNER were executed, which lead to a massive amount of unnecessary database load
* fix: ⚡ added missing checks for PetIsDeadValue
Hunter under level 10, which are not able to summon their pets defined in the database spammed SELECT id FROM character_pet WHERE owner = {}, since the result of the query was true. Bots under level 10 already have pets in their stables. Also the same thing applied to Bots on mounts, because, while mounted, pets get despawned. This should drastically improve server performance.
* fix: ⚡ refactored query, pet should only check death state of his current pet
The old query also fetched all pets out of his stable, which is not needed, since we are looking for slot 0 (active pet)
* style: 🎨 and to AND typo
* fix: 🐛 Reverted 5a6182f977
A few hunters with pets in stable, where slot = 100 would not summon their pets
This commit is contained in:
@@ -525,6 +525,11 @@ uint32 GuildTaskMgr::GetMaxItemTaskCount(uint32 itemId)
|
||||
|
||||
bool GuildTaskMgr::IsGuildTaskItem(uint32 itemId, uint32 guildId)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->guildTaskEnabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 value = 0;
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
@@ -548,6 +553,11 @@ bool GuildTaskMgr::IsGuildTaskItem(uint32 itemId, uint32 guildId)
|
||||
std::map<uint32, uint32> GuildTaskMgr::GetTaskValues(uint32 owner, std::string const type,
|
||||
[[maybe_unused]] uint32* validIn /* = nullptr */)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->guildTaskEnabled)
|
||||
{
|
||||
return std::map<uint32, uint32>();
|
||||
}
|
||||
|
||||
std::map<uint32, uint32> results;
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
@@ -576,6 +586,11 @@ std::map<uint32, uint32> GuildTaskMgr::GetTaskValues(uint32 owner, std::string c
|
||||
|
||||
uint32 GuildTaskMgr::GetTaskValue(uint32 owner, uint32 guildId, std::string const type, [[maybe_unused]] uint32* validIn /* = nullptr */)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->guildTaskEnabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 value = 0;
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
|
||||
@@ -40,6 +40,11 @@ bool IsDeadValue::Calculate()
|
||||
|
||||
bool PetIsDeadValue::Calculate()
|
||||
{
|
||||
if ((bot->GetLevel() < 10 && bot->getClass() == CLASS_HUNTER) || bot->IsMounted())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot->GetPet())
|
||||
{
|
||||
uint32 ownerid = bot->GetGUID().GetCounter();
|
||||
|
||||
Reference in New Issue
Block a user