diff --git a/src/strategy/warlock/WarlockActions.cpp b/src/strategy/warlock/WarlockActions.cpp index c57a21c2..69f1f335 100644 --- a/src/strategy/warlock/WarlockActions.cpp +++ b/src/strategy/warlock/WarlockActions.cpp @@ -145,9 +145,51 @@ bool CreateSoulShardAction::isUseful() uint32 currentShards = bot->GetItemCount(ITEM_SOUL_SHARD, false); // false = only bags const uint32 SHARD_CAP = 6; // adjust as needed - return currentShards < SHARD_CAP; + // Only allow if under cap AND there is space for a new shard + ItemPosCountVec dest; + uint32 count = 1; + bool hasSpace = (bot->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_SOUL_SHARD, count) == EQUIP_ERR_OK); + + return (currentShards < SHARD_CAP) && hasSpace; } +bool CastCreateSoulstoneAction::isUseful() +{ + Player* bot = botAI->GetBot(); + if (!bot) + return false; + + // List of all Soulstone item IDs + static const std::vector soulstoneIds = { + 5232, // Minor Soulstone + 16892, // Lesser Soulstone + 16893, // Soulstone + 16895, // Greater Soulstone + 16896, // Major Soulstone + 22116, // Master Soulstone + 36895 // Demonic Soulstone + }; + + // Check if the bot already has any soulstone + uint32 currentSoulstones = 0; + for (uint32 id : soulstoneIds) + currentSoulstones += bot->GetItemCount(id, false); // false = only bags + + // Allow only if the bot has no soulstone AND there is space for one + ItemPosCountVec dest; + uint32 count = 1; + bool hasSpace = false; + for (uint32 id : soulstoneIds) + { + if (bot->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, id, count) == EQUIP_ERR_OK) + { + hasSpace = true; + break; + } + } + + return (currentSoulstones == 0) && hasSpace; +} bool DestroySoulShardAction::Execute(Event event) { diff --git a/src/strategy/warlock/WarlockActions.h b/src/strategy/warlock/WarlockActions.h index 69530775..b3b7a3e2 100644 --- a/src/strategy/warlock/WarlockActions.h +++ b/src/strategy/warlock/WarlockActions.h @@ -84,6 +84,7 @@ class CastCreateSoulstoneAction : public CastBuffSpellAction { public: CastCreateSoulstoneAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "create soulstone") {} + bool isUseful() override; }; class UseSoulstoneSelfAction : public UseSpellItemAction