From 2a5b7dcb610048b209e6b3dd8c91b3cbe906b9b3 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 14 Aug 2024 18:28:14 +0800 Subject: [PATCH] Aggresive water elemental --- src/PlayerbotAI.cpp | 25 +++++++++++++++++++ src/PlayerbotAI.h | 2 ++ src/strategy/actions/ChatShortcutActions.cpp | 5 ++++ .../actions/UseMeetingStoneAction.cpp | 4 +-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index c5a4a375..7a4a803f 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -5742,3 +5742,28 @@ uint32 PlayerbotAI::GetReactDelay() return base * multiplier; } +void PlayerbotAI::PetFollow() +{ + Pet* pet = bot->GetPet(); + if (!pet) + return; + pet->AttackStop(); + pet->InterruptNonMeleeSpells(false); + pet->ClearInPetCombat(); + pet->GetMotionMaster()->MoveFollow(bot, PET_FOLLOW_DIST, pet->GetFollowAngle()); + if (pet->ToPet()) + pet->ToPet()->ClearCastWhenWillAvailable(); + CharmInfo* charmInfo = pet->GetCharmInfo(); + if (!charmInfo) + return; + charmInfo->SetCommandState(COMMAND_FOLLOW); + + charmInfo->SetIsCommandAttack(false); + charmInfo->SetIsAtStay(false); + charmInfo->SetIsReturning(true); + charmInfo->SetIsCommandFollow(true); + charmInfo->SetIsFollowing(false); + charmInfo->RemoveStayPosition(); + charmInfo->SetForcedSpell(0); + charmInfo->SetForcedTargetGUID(); +} \ No newline at end of file diff --git a/src/PlayerbotAI.h b/src/PlayerbotAI.h index f9edd7ff..fb76b5cc 100644 --- a/src/PlayerbotAI.h +++ b/src/PlayerbotAI.h @@ -560,6 +560,8 @@ public: std::vector GetCurrentIncompleteQuests(); std::set GetAllCurrentQuestIds(); std::set GetCurrentIncompleteQuestIds(); + void PetFollow(); + private: static void _fillGearScoreData(Player* player, Item* item, std::vector* gearScore, uint32& twoHandScore, bool mixed = false); bool IsTellAllowed(PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL); diff --git a/src/strategy/actions/ChatShortcutActions.cpp b/src/strategy/actions/ChatShortcutActions.cpp index 00a89483..0d5163eb 100644 --- a/src/strategy/actions/ChatShortcutActions.cpp +++ b/src/strategy/actions/ChatShortcutActions.cpp @@ -62,6 +62,11 @@ bool FollowChatShortcutAction::Execute(Event event) true, priority); } + if (Pet* pet = bot->GetPet()) + { + botAI->PetFollow(); + } + if (moved) { botAI->TellMaster("Following"); diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index ad09b486..f0df16b8 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -79,9 +79,7 @@ bool SummonAction::Execute(Event event) if (Pet* pet = bot->GetPet()) { - pet->SetReactState(REACT_PASSIVE); - pet->GetCharmInfo()->SetIsCommandFollow(true); - pet->GetCharmInfo()->IsReturning(); + botAI->PetFollow(); } if (master->GetSession()->GetSecurity() >= SEC_PLAYER)