mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Warlock Soulstone/Soulshard hotfix (#1452)
Hello everybody, This PR is to address issues #1439 and #1451. I added a 1 second cooldown to the createsoulshard action, as the warlock wouldn't ever use more than 1 soul shard per second. I also added a cooldown check to the soulstone trigger, so it doesn't simply try to use the ss healer, ss self, ss tank, or ss master if the soulstone is present in the inventory. I checked the logs, and was able to recreate the issue of #1451 - the bot was shifting targets over and over again, and that was because previously the trigger was just checking to see if a soulstone was present at all. Now it won't fire if it's on cooldown.
This commit is contained in:
@@ -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<CharacterDatabaseConnection> trans = CharacterDatabase.BeginTransaction();
|
||||
bot->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
lastCreateSoulShardTime = now; // update timer on successful creation
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user