Skip to content

Commit

Permalink
-Custom spell fix: Bots now properly cast location spells on location…
Browse files Browse the repository at this point in the history
…s and report their location target properly.
  • Loading branch information
mostlikely4r committed Aug 9, 2024
1 parent 29d2e03 commit 28bc313
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions playerbot/strategy/actions/CastCustomSpellAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,18 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo, Player* r

if (!executed && wo)
{
if (wo->GetObjectGuid().IsUnit())
if (pSpellInfo->Targets & TARGET_FLAG_DEST_LOCATION)
{
if (ai->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ(), nullptr, false, &spellDuration))
{
ai->TellPlayer(requester, "Casting " + ChatHelper::formatSpell(pSpellInfo) + " near " + ChatHelper::formatWorldobject(wo), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
executed = true;
}
}
else if (wo->GetObjectGuid().IsUnit())
{
if (ai->CastSpell(spellId, (Unit*)wo, nullptr, false, &spellDuration))
{
ai->TellPlayer(requester, "Casting " + ChatHelper::formatSpell(pSpellInfo) + " on " + ChatHelper::formatWorldobject(wo), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
if(wo != bot)
ai->TellPlayer(requester, "Casting " + ChatHelper::formatSpell(pSpellInfo) + " on " + ChatHelper::formatWorldobject(wo), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
else
Expand All @@ -575,7 +582,7 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo, Player* r
{
if (ai->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ(), nullptr, false, &spellDuration))
{
ai->TellPlayer(requester, "Casting " + ChatHelper::formatSpell(pSpellInfo) + " on " + ChatHelper::formatWorldobject(wo), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
ai->TellPlayer(requester, "Casting " + ChatHelper::formatSpell(pSpellInfo) + " near " + ChatHelper::formatWorldobject(wo), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false);
executed = true;
}
}
Expand Down

0 comments on commit 28bc313

Please sign in to comment.