fix: bot stuck after drink or food && initialization customized

This commit is contained in:
Yunfan Li
2023-05-23 23:39:20 +08:00
parent 32da0c07c9
commit c16e587854
18 changed files with 247 additions and 119 deletions

View File

@@ -140,22 +140,11 @@ bool TalentSpec::CheckTalents(uint32 level, std::ostringstream* out)
//Set the talents for the bots to the current spec.
void TalentSpec::ApplyTalents(Player* bot, std::ostringstream* out)
{
for (auto& entry : talents)
for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
{
uint32 spellId = entry.talentInfo->RankID[rank];
if (!spellId)
continue;
if (bot->HasSpell(spellId) && entry.rank - 1 != rank)
{
bot->removeSpell(spellId, false, false);
}
else if (!bot->HasSpell(spellId) && entry.rank - 1 == rank)
{
bot->learnSpell(spellId);
}
}
for (auto& entry : talents) {
if (entry.rank == 0)
continue;
bot->LearnTalent(entry.talentInfo->TalentID, entry.rank - 1);
}
}
//Returns a base talentlist for a class.