Core/StatSystem: Implemented mastery.

This commit is contained in:
Shauren committed 2013-05-12 17:56:37 +02:00
1 parent 1c91680f9c
commit 64f0e99958
10 files changed
+364 -147

No files matched your search

+66 -2
View File
@@ -1432,6 +1432,9 @@ void SpellMgr::LoadSpellLearnSpells()
++count;
} while (result->NextRow());
// copy state loaded from db
SpellLearnSpellMap dbSpellLearnSpells = mSpellLearnSpells;
// search auto-learned spells and add its to map also for use in unlearn spells/talents
uint32 dbc_count = 0;
for (uint32 spell = 0; spell < GetSpellInfoStoreSize(); ++spell)
@@ -1458,7 +1461,7 @@ void SpellMgr::LoadSpellLearnSpells()
// other required explicit dependent learning
dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(spell);
bool found = false;
for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
@@ -1481,7 +1484,68 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
uint32 mastery_count = 0;
for (uint32 i = 0; i < sTalentTabStore.GetNumRows(); ++i)
{
TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(i);
if (!talentTab)
continue;
for (uint32 c = CLASS_WARRIOR; c < MAX_CLASSES; ++c)
{
if (!(talentTab->ClassMask & (1 << (c - 1))))
continue;
uint32 masteryMainSpell = MasterySpells[c];
for (uint32 m = 0; m < MAX_MASTERY_SPELLS; ++m)
{
uint32 mastery = talentTab->MasterySpellId[m];
if (!mastery)
continue;
SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(masteryMainSpell);
bool found = false;
for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
{
if (itr->second.spell == mastery)
{
sLog->outError(LOG_FILTER_SQL, "Found redundant record (entry: %u, SpellID: %u) in `spell_learn_spell`, spell added automatically as mastery learned spell from TalentTab.dbc", masteryMainSpell, mastery);
found = true;
break;
}
}
if (found)
continue;
// Check if it is already found in Spell.dbc, ignore silently if yes
SpellLearnSpellMapBounds dbc_node_bounds = GetSpellLearnSpellMapBounds(masteryMainSpell);
found = false;
for (SpellLearnSpellMap::const_iterator itr = dbc_node_bounds.first; itr != dbc_node_bounds.second; ++itr)
{
if (itr->second.spell == mastery)
{
found = true;
break;
}
}
if (found)
continue;
SpellLearnSpellNode masteryNode;
masteryNode.spell = mastery;
masteryNode.active = true;
masteryNode.autoLearned = false;
mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(masteryMainSpell, masteryNode));
++mastery_count;
}
}
}
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells, %u found in Spell.dbc and %u from TalentTab.dbc in %u ms", count, dbc_count, mastery_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellTargetPositions()