From 4654218d39f03dbbc9b2d53d588ab92f5f776db2 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 9 Aug 2023 12:39:00 +0800 Subject: [PATCH] InitTalentsTree --- src/PlayerbotFactory.cpp | 5 ++++- src/PlayerbotFactory.h | 2 +- src/strategy/actions/ChangeTalentsAction.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index db0e6194..4ea4b591 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -705,7 +705,7 @@ void PlayerbotFactory::InitSpells() InitAvailableSpells(); } -void PlayerbotFactory::InitTalentsTree(bool increment/*false*/, bool use_template/*true*/) +void PlayerbotFactory::InitTalentsTree(bool increment/*false*/, bool use_template/*true*/, bool reset/*false*/) { uint32 specNo; uint8 cls = bot->getClass(); @@ -717,6 +717,9 @@ void PlayerbotFactory::InitTalentsTree(bool increment/*false*/, bool use_templat uint32 p2 = p1 + sPlayerbotAIConfig->specProbability[cls][1]; specNo = (point < p1 ? 0 : (point < p2 ? 1 : 2)); } + if (reset) { + bot->resetTalents(true); + } // use template if can if (use_template && sPlayerbotAIConfig->defaultTalentsOrder[cls][specNo].size() > 0) { InitTalentsByTemplate(specNo); diff --git a/src/PlayerbotFactory.h b/src/PlayerbotFactory.h index 1dc112c1..9cf72177 100644 --- a/src/PlayerbotFactory.h +++ b/src/PlayerbotFactory.h @@ -115,7 +115,7 @@ class PlayerbotFactory : public InventoryAction static uint32 tradeSkills[]; static float CalculateItemScore(uint32 item_id, Player* bot); - void InitTalentsTree(bool incremental = false, bool use_template = true); + void InitTalentsTree(bool incremental = false, bool use_template = true, bool reset = false); void InitAvailableSpells(); void InitClassSpells(); void InitEquipment(bool incremental); diff --git a/src/strategy/actions/ChangeTalentsAction.cpp b/src/strategy/actions/ChangeTalentsAction.cpp index 17a0d0a6..d1e11707 100644 --- a/src/strategy/actions/ChangeTalentsAction.cpp +++ b/src/strategy/actions/ChangeTalentsAction.cpp @@ -336,7 +336,7 @@ bool AutoSetTalentsAction::Execute(Event event) return false; PlayerbotFactory factory(bot, bot->GetLevel()); - factory.InitTalentsTree(true); + factory.InitTalentsTree(true, true, true); botAI->TellMaster(out);