mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Warlock Soul Shard/Soulstone ID conversion
Hello everyone, I'm still working on fixing issue #1439 , and I have a theory - it could be because the clients that are having the issue are not english, and the code currently checks for strings "soul shard" and "soulstone". This PR converts the check over to the item IDs, so it should work regardless of what client is being used. I tested it myself with the english client and there is functionally no difference than before - but I hope it solves the issue #1439 for the non-english clients and community.
This commit is contained in:
@@ -7,6 +7,32 @@
|
||||
#include "GenericTriggers.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 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;
|
||||
}
|
||||
|
||||
bool OutOfSoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot()) == 0; }
|
||||
|
||||
bool TooManySoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot()) >= 6; }
|
||||
|
||||
bool HasSoulstoneTrigger::IsActive() { return GetSoulstoneCount(botAI->GetBot()) == 0; }
|
||||
|
||||
// Checks if the target marked with the moon icon can be banished
|
||||
bool BanishTrigger::IsActive()
|
||||
{
|
||||
|
||||
@@ -34,14 +34,14 @@ class OutOfSoulShardsTrigger : public Trigger
|
||||
{
|
||||
public:
|
||||
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
|
||||
{
|
||||
public:
|
||||
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
|
||||
@@ -62,7 +62,7 @@ class HasSoulstoneTrigger : public Trigger
|
||||
{
|
||||
public:
|
||||
HasSoulstoneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soulstone") {}
|
||||
bool IsActive() override { return AI_VALUE2(uint32, "item count", "soulstone") == 0; }
|
||||
bool IsActive() override;
|
||||
};
|
||||
|
||||
class SoulstoneTrigger : public Trigger
|
||||
|
||||
Reference in New Issue
Block a user