Skip to content

Commit

Permalink
Warlock pet learning (#122)
Browse files Browse the repository at this point in the history
* Minor edit to allow warlock randoms to learn the lowerlevel imp spells.

* Allow alt bot pets to learn skills.

* Updated InitializePet::isUsefull to check if bot is random and cheat enabled or if bot is not random and autoLearnTrainerSpells is enabled.

Updated Warlock Pet strategy to initialize pet when not in combat.
  • Loading branch information
Pip1987 authored Jan 12, 2025
1 parent 9f60d07 commit 861169a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion playerbot/PlayerbotFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,14 @@ void PlayerbotFactory::Randomize(bool incremental, bool syncWithMaster)
#endif
}

if (bot->GetLevel() >= 10)
if (bot->GetLevel() >= 10 && bot->getClass() == CLASS_HUNTER)
{
auto pmo_pet = sPerformanceMonitor.start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet");
sLog.outDetail("Initializing pet...");
InitPet();
InitPetSpells();
}
else if (bot->getClass() == CLASS_WARLOCK)
{
auto pmo_pet = sPerformanceMonitor.start(PERF_MON_RNDBOT, "PlayerbotFactory_Pet");
sLog.outDetail("Initializing pet...");
Expand Down
4 changes: 3 additions & 1 deletion playerbot/strategy/actions/GenericActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ bool InitializePetAction::Execute(Event& event)
bool InitializePetAction::isUseful()
{
// Only for random bots with item cheats enabled
if (ai->HasCheat(BotCheatMask::item) && sPlayerbotAIConfig.IsInRandomAccountList(bot->GetSession()->GetAccountId()))
if ((ai->HasCheat(BotCheatMask::item) && sPlayerbotAIConfig.IsInRandomAccountList(bot->GetSession()->GetAccountId())) ||
// Or if alt bot and autoLearnTrainerSpells is true
(!sPlayerbotAIConfig.IsInRandomAccountList(bot->GetSession()->GetAccountId()) && sPlayerbotAIConfig.autoLearnTrainerSpells));
{
if (bot->getClass() == CLASS_HUNTER)
{
Expand Down
8 changes: 7 additions & 1 deletion playerbot/strategy/warlock/WarlockStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ void WarlockPetStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)

void WarlockPetStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
{

triggers.push_back(new TriggerNode(
"often",
NextAction::array(0, new NextAction("initialize pet", ACTION_NORMAL), NULL)));
}

void WarlockPetPvpStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)
Expand Down Expand Up @@ -1394,6 +1396,10 @@ void WarlockManualPetStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& tr
triggers.push_back(new TriggerNode(
triggerName,
NextAction::array(0, new NextAction(actionName, ACTION_HIGH), NULL)));

triggers.push_back(new TriggerNode(
"often",
NextAction::array(0, new NextAction("initialize pet", ACTION_NORMAL + 1), NULL)));
}

void WarlockManualCurseStrategy::InitCombatTriggers(std::list<TriggerNode*>& triggers)
Expand Down

0 comments on commit 861169a

Please sign in to comment.