mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-29 16:33:46 +00:00
Warlock Soul Shard Hotfix (#1442)
Hello everyone, This PR is to address an issue that was posted recently - a player has shown that soul shards are being created in excess, spamming the player's chat log. I am adding an isuseful() check to the createsoulshard action, so it will never be executed if they have more than 5 soul shards. Also, out of an abundance of caution, I am lowering the cap for CastDrainSoulAction::isUseful() to 20 from 32. That way, if for some reason the warlock has 20+ shards, it won't attempt to collect any more / use drain soul.
This commit is contained in:
@@ -19,8 +19,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
// Checks if the bot has less than 32 soul shards, and if so, allows casting Drain Soul
|
// Checks if the bot has less than 20 soul shards, and if so, allows casting Drain Soul
|
||||||
bool CastDrainSoulAction::isUseful() { return AI_VALUE2(uint32, "item count", "soul shard") < 32; }
|
bool CastDrainSoulAction::isUseful() { return AI_VALUE2(uint32, "item count", "soul shard") < 20; }
|
||||||
|
|
||||||
// Checks if the bot's health is above a certain threshold, and if so, allows casting Life Tap
|
// Checks if the bot's health is above a certain threshold, and if so, allows casting Life Tap
|
||||||
bool CastLifeTapAction::isUseful() { return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig->lowHealth; }
|
bool CastLifeTapAction::isUseful() { return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig->lowHealth; }
|
||||||
@@ -135,6 +135,20 @@ bool CreateSoulShardAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks if the bot has less than 6 soul shards, allowing the creation of a new one
|
||||||
|
bool CreateSoulShardAction::isUseful()
|
||||||
|
{
|
||||||
|
Player* bot = botAI->GetBot();
|
||||||
|
if (!bot)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32 soulShardId = 6265;
|
||||||
|
uint32 currentShards = bot->GetItemCount(soulShardId, false); // false = only bags
|
||||||
|
const uint32 SHARD_CAP = 6; // adjust as needed
|
||||||
|
|
||||||
|
return currentShards < SHARD_CAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DestroySoulShardAction::Execute(Event event)
|
bool DestroySoulShardAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class CreateSoulShardAction : public Action
|
|||||||
public:
|
public:
|
||||||
CreateSoulShardAction(PlayerbotAI* botAI) : Action(botAI, "create soul shard") {}
|
CreateSoulShardAction(PlayerbotAI* botAI) : Action(botAI, "create soul shard") {}
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
|
bool isUseful() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DestroySoulShardAction : public InventoryAction
|
class DestroySoulShardAction : public InventoryAction
|
||||||
|
|||||||
Reference in New Issue
Block a user