Core/Spells: implement SPELL_ATTR0_CU_IS_TALENT

This commit is contained in:
Ovahlord committed 2023-08-19 22:39:23 +02:00
1 parent ca034f4dbf
commit a4ffa701a5
1 file changed
+13 -3
+13 -3
View File
@@ -1086,7 +1086,8 @@ void SpellMgr::LoadSpellLearnSpells()
node.active = fields[2].GetBool();
node.autoLearned = false;
if (!GetSpellInfo(spell_id))
SpellInfo const* spellInfo = GetSpellInfo(spell_id);
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "The spell %u listed in `spell_learn_spell` does not exist.", spell_id);
continue;
@@ -1098,7 +1099,7 @@ void SpellMgr::LoadSpellLearnSpells()
continue;
}
if (sDBCManager.GetTalentSpellCost(node.spell))
if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT))
{
TC_LOG_ERROR("sql.sql", "The spell %u listed in `spell_learn_spell` attempts learning talent spell %u, skipped.", spell_id, node.spell);
continue;
@@ -1136,7 +1137,7 @@ void SpellMgr::LoadSpellLearnSpells()
// talent or passive spells or skill-step spells auto-cast and not need dependent learning,
// pet teaching spells must not be dependent learning (cast)
// other required explicit dependent learning
dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || sDBCManager.GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || entry->HasAttribute(SPELL_ATTR0_CU_IS_TALENT) || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(spell);
@@ -2669,6 +2670,12 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
TC_LOG_INFO("server.loading", ">> Loaded %u spell custom attributes from DB in %u ms", count, GetMSTimeDiffToNow(oldMSTime2));
}
std::set<uint32> talentSpells;
for (TalentEntry const* talentInfo : sTalentStore)
for (uint8 i = 0; i < MAX_TALENT_RANK; ++i)
if (uint32 spellId = talentInfo->SpellRank[i])
talentSpells.insert(spellId);
for (SpellInfo* spellInfo : mSpellInfoMap)
{
if (!spellInfo)
@@ -2879,6 +2886,9 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
spellInfo->_InitializeSpellPositivity();
if (talentSpells.count(spellInfo->Id))
spellInfo->AttributesCu |= SPELL_ATTR0_CU_IS_TALENT;
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_WARRIOR: