Merge pull request #1463 from ThePenguinMan96/Warlock-Soul-Shard/Soulstone-ID-conversion

Warlock Soul Shard/Soulstone ID conversion
This commit is contained in:
kadeshar
2025-07-26 00:53:23 +02:00
committed by GitHub
5 changed files with 80 additions and 8 deletions

View File

@@ -145,9 +145,48 @@ bool CreateSoulShardAction::isUseful()
uint32 currentShards = bot->GetItemCount(ITEM_SOUL_SHARD, false); // false = only bags uint32 currentShards = bot->GetItemCount(ITEM_SOUL_SHARD, false); // false = only bags
const uint32 SHARD_CAP = 6; // adjust as needed 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<uint32> 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
for (uint32 id : soulstoneIds)
{
if (bot->GetItemCount(id, false) > 0)
return false; // Already has a soulstone
}
// Only need to check one soulstone type for bag space (usually the highest-tier)
ItemPosCountVec dest;
uint32 count = 1;
// Use the last in the list (highest tier)
uint32 soulstoneToCreate = soulstoneIds.back();
bool hasSpace = (bot->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, soulstoneToCreate, count) == EQUIP_ERR_OK);
return hasSpace;
}
bool DestroySoulShardAction::Execute(Event event) bool DestroySoulShardAction::Execute(Event event)
{ {

View File

@@ -84,6 +84,7 @@ class CastCreateSoulstoneAction : public CastBuffSpellAction
{ {
public: public:
CastCreateSoulstoneAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "create soulstone") {} CastCreateSoulstoneAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "create soulstone") {}
bool isUseful() override;
}; };
class UseSoulstoneSelfAction : public UseSpellItemAction class UseSoulstoneSelfAction : public UseSpellItemAction

View File

@@ -138,7 +138,7 @@ public:
creators["no healthstone"] = &WarlockTriggerFactoryInternal::HasHealthstone; creators["no healthstone"] = &WarlockTriggerFactoryInternal::HasHealthstone;
creators["no firestone"] = &WarlockTriggerFactoryInternal::HasFirestone; creators["no firestone"] = &WarlockTriggerFactoryInternal::HasFirestone;
creators["no spellstone"] = &WarlockTriggerFactoryInternal::HasSpellstone; creators["no spellstone"] = &WarlockTriggerFactoryInternal::HasSpellstone;
creators["no soulstone"] = &WarlockTriggerFactoryInternal::HasSoulstone; creators["no soulstone"] = &WarlockTriggerFactoryInternal::OutOfSoulstone;
creators["firestone"] = &WarlockTriggerFactoryInternal::firestone; creators["firestone"] = &WarlockTriggerFactoryInternal::firestone;
creators["spellstone"] = &WarlockTriggerFactoryInternal::spellstone; creators["spellstone"] = &WarlockTriggerFactoryInternal::spellstone;
creators["soulstone"] = &WarlockTriggerFactoryInternal::soulstone; creators["soulstone"] = &WarlockTriggerFactoryInternal::soulstone;
@@ -182,7 +182,7 @@ private:
static Trigger* HasHealthstone(PlayerbotAI* botAI) { return new HasHealthstoneTrigger(botAI); } static Trigger* HasHealthstone(PlayerbotAI* botAI) { return new HasHealthstoneTrigger(botAI); }
static Trigger* HasFirestone(PlayerbotAI* botAI) { return new HasFirestoneTrigger(botAI); } static Trigger* HasFirestone(PlayerbotAI* botAI) { return new HasFirestoneTrigger(botAI); }
static Trigger* HasSpellstone(PlayerbotAI* botAI) { return new HasSpellstoneTrigger(botAI); } static Trigger* HasSpellstone(PlayerbotAI* botAI) { return new HasSpellstoneTrigger(botAI); }
static Trigger* HasSoulstone(PlayerbotAI* botAI) { return new HasSoulstoneTrigger(botAI); } static Trigger* OutOfSoulstone(PlayerbotAI* botAI) { return new OutOfSoulstoneTrigger(botAI); }
static Trigger* firestone(PlayerbotAI* botAI) { return new FirestoneTrigger(botAI); } static Trigger* firestone(PlayerbotAI* botAI) { return new FirestoneTrigger(botAI); }
static Trigger* spellstone(PlayerbotAI* botAI) { return new SpellstoneTrigger(botAI); } static Trigger* spellstone(PlayerbotAI* botAI) { return new SpellstoneTrigger(botAI); }
static Trigger* soulstone(PlayerbotAI* botAI) { return new SoulstoneTrigger(botAI); } static Trigger* soulstone(PlayerbotAI* botAI) { return new SoulstoneTrigger(botAI); }

View File

@@ -7,6 +7,32 @@
#include "GenericTriggers.h" #include "GenericTriggers.h"
#include "Playerbots.h" #include "Playerbots.h"
static const uint32 SOUL_SHARD_ITEM_ID = 6265;
uint32 GetSoulShardCount(Player* bot)
{
return bot->GetItemCount(SOUL_SHARD_ITEM_ID, false); // false = only bags
}
// List of all Soulstone item IDs
static const std::vector<uint32> soulstoneItemIds = {
5232, // Minor Soulstone
16892, // Lesser Soulstone
16893, // Soulstone
16895, // Greater Soulstone
16896, // Major Soulstone
22116, // Master Soulstone
36895 // Demonic Soulstone
};
uint32 GetSoulstoneCount(Player* bot)
{
uint32 count = 0;
for (uint32 id : soulstoneItemIds)
count += bot->GetItemCount(id, false); // false = only bags
return count;
}
bool SpellstoneTrigger::IsActive() { return BuffTrigger::IsActive() && AI_VALUE2(uint32, "item count", getName()) > 0; } bool SpellstoneTrigger::IsActive() { return BuffTrigger::IsActive() && AI_VALUE2(uint32, "item count", getName()) > 0; }
bool FirestoneTrigger::IsActive() { return BuffTrigger::IsActive() && AI_VALUE2(uint32, "item count", getName()) > 0; } bool FirestoneTrigger::IsActive() { return BuffTrigger::IsActive() && AI_VALUE2(uint32, "item count", getName()) > 0; }
@@ -16,6 +42,12 @@ bool WarlockConjuredItemTrigger::IsActive()
return ItemCountTrigger::IsActive() && AI_VALUE2(uint32, "item count", "soul shard") > 0; return ItemCountTrigger::IsActive() && AI_VALUE2(uint32, "item count", "soul shard") > 0;
} }
bool OutOfSoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot()) == 0; }
bool TooManySoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot()) >= 6; }
bool OutOfSoulstoneTrigger::IsActive() { return GetSoulstoneCount(botAI->GetBot()) == 0; }
// Checks if the target marked with the moon icon can be banished // Checks if the target marked with the moon icon can be banished
bool BanishTrigger::IsActive() bool BanishTrigger::IsActive()
{ {

View File

@@ -34,14 +34,14 @@ class OutOfSoulShardsTrigger : public Trigger
{ {
public: public:
OutOfSoulShardsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soul shard", 2) {} OutOfSoulShardsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soul shard", 2) {}
bool IsActive() override { return AI_VALUE2(uint32, "item count", "soul shard") == 0; } bool IsActive() override;
}; };
class TooManySoulShardsTrigger : public Trigger class TooManySoulShardsTrigger : public Trigger
{ {
public: public:
TooManySoulShardsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "too many soul shards") {} TooManySoulShardsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "too many soul shards") {}
bool IsActive() override { return AI_VALUE2(uint32, "item count", "soul shard") >= 6; } bool IsActive() override;
}; };
class FirestoneTrigger : public BuffTrigger class FirestoneTrigger : public BuffTrigger
@@ -58,11 +58,11 @@ public:
bool IsActive() override; bool IsActive() override;
}; };
class HasSoulstoneTrigger : public Trigger class OutOfSoulstoneTrigger : public Trigger
{ {
public: public:
HasSoulstoneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soulstone") {} OutOfSoulstoneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soulstone") {}
bool IsActive() override { return AI_VALUE2(uint32, "item count", "soulstone") == 0; } bool IsActive() override;
}; };
class SoulstoneTrigger : public Trigger class SoulstoneTrigger : public Trigger