diff --git a/src/strategy/warlock/WarlockActions.cpp b/src/strategy/warlock/WarlockActions.cpp index 91744c7d..58789d83 100644 --- a/src/strategy/warlock/WarlockActions.cpp +++ b/src/strategy/warlock/WarlockActions.cpp @@ -116,6 +116,12 @@ bool CastSoulshatterAction::isUseful() // Checks if the bot has enough bag space to create a soul shard, then does so bool CreateSoulShardAction::Execute(Event event) { + uint32 now = getMSTime(); + + // 1000 ms = 1 second cooldown + if (now < lastCreateSoulShardTime + 1000) + return false; + Player* bot = botAI->GetBot(); if (!bot) return false; @@ -130,6 +136,7 @@ bool CreateSoulShardAction::Execute(Event event) SQLTransaction trans = CharacterDatabase.BeginTransaction(); bot->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); + lastCreateSoulShardTime = now; // update timer on successful creation return true; } return false; diff --git a/src/strategy/warlock/WarlockActions.h b/src/strategy/warlock/WarlockActions.h index 69530775..f60488ba 100644 --- a/src/strategy/warlock/WarlockActions.h +++ b/src/strategy/warlock/WarlockActions.h @@ -47,6 +47,8 @@ public: CreateSoulShardAction(PlayerbotAI* botAI) : Action(botAI, "create soul shard") {} bool Execute(Event event) override; bool isUseful() override; +private: + uint32 lastCreateSoulShardTime = 0; // Per-bot cooldown timer in ms }; class DestroySoulShardAction : public InventoryAction diff --git a/src/strategy/warlock/WarlockTriggers.h b/src/strategy/warlock/WarlockTriggers.h index 4dedc218..e0ef2289 100644 --- a/src/strategy/warlock/WarlockTriggers.h +++ b/src/strategy/warlock/WarlockTriggers.h @@ -72,8 +72,18 @@ public: bool IsActive() override { - // Just check if we have a soulstone item available - return AI_VALUE2(uint32, "item count", "soulstone") > 0; + static const std::vector soulstoneSpellIds = {20707, 20762, 20763, 20764, 20765, 27239, 47883}; + + if (AI_VALUE2(uint32, "item count", "soulstone") == 0) + return false; + + for (uint32 spellId : soulstoneSpellIds) + { + if (!bot->HasSpellCooldown(spellId)) + return true; // Ready to use + } + + return false; // All are on cooldown } };