Core: Cosmetic changes in Threat related code (per request) and remove of extra call to SpellMgr singleton inside that singleton

This commit is contained in:
Spp
2011-08-04 13:16:09 +02:00
parent 68d34ab3c2
commit 1c882084f3
8 changed files with 264 additions and 259 deletions
+1 -5
View File
@@ -7077,11 +7077,7 @@ void Spell::EffectBind(SpellEffIndex effIndex)
void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex) {
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *player = m_caster->ToPlayer();
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true);
+28 -30
View File
@@ -1147,7 +1147,7 @@ void SpellMgr::LoadSpellRanks()
break;
}
// check if chain is made with valid first spell
SpellInfo const* first = sSpellMgr->GetSpellInfo(lastSpell);
SpellInfo const* first = GetSpellInfo(lastSpell);
if (!first)
{
sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
@@ -1164,7 +1164,7 @@ void SpellMgr::LoadSpellRanks()
// check spells in chain
for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
{
SpellInfo const* spell = sSpellMgr->GetSpellInfo(itr->first);
SpellInfo const* spell = GetSpellInfo(itr->first);
if (!spell)
{
sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
@@ -1235,13 +1235,13 @@ void SpellMgr::LoadSpellRequired()
uint32 spell_id = fields[0].GetUInt32();
uint32 spell_req = fields[1].GetUInt32();
// check if chain is made with valid first spell
SpellInfo const* spell = sSpellMgr->GetSpellInfo(spell_id);
SpellInfo const* spell = GetSpellInfo(spell_id);
if (!spell)
{
sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
continue;
}
SpellInfo const* req_spell = sSpellMgr->GetSpellInfo(spell_req);
SpellInfo const* req_spell = GetSpellInfo(spell_req);
if (!req_spell)
{
sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
@@ -1277,7 +1277,7 @@ void SpellMgr::LoadSpellLearnSkills()
uint32 dbc_count = 0;
for (uint32 spell = 0; spell < sSpellMgr->GetSpellInfoStoreSize(); ++spell)
{
SpellInfo const* entry = sSpellMgr->GetSpellInfo(spell);
SpellInfo const* entry = GetSpellInfo(spell);
if (!entry)
continue;
@@ -1334,13 +1334,13 @@ void SpellMgr::LoadSpellLearnSpells()
node.active = fields[2].GetBool();
node.autoLearned= false;
if (!sSpellMgr->GetSpellInfo(spell_id))
if (!GetSpellInfo(spell_id))
{
sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id);
continue;
}
if (!sSpellMgr->GetSpellInfo(node.spell))
if (!GetSpellInfo(node.spell))
{
sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
continue;
@@ -1359,9 +1359,9 @@ void SpellMgr::LoadSpellLearnSpells()
// 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 < sSpellMgr->GetSpellInfoStoreSize(); ++spell)
for (uint32 spell = 0; spell < GetSpellInfoStoreSize(); ++spell)
{
SpellInfo const* entry = sSpellMgr->GetSpellInfo(spell);
SpellInfo const* entry = GetSpellInfo(spell);
if (!entry)
continue;
@@ -1375,7 +1375,7 @@ void SpellMgr::LoadSpellLearnSpells()
dbc_node.active = true; // all dbc based learned spells is active (show in spell book or hide by client itself)
// ignore learning not existed spells (broken/outdated/or generic learnig spell 483
if (!sSpellMgr->GetSpellInfo(dbc_node.spell))
if (!GetSpellInfo(dbc_node.spell))
continue;
// talent or passive spells or skill-step spells auto-casted and not need dependent learning,
@@ -1454,7 +1454,7 @@ void SpellMgr::LoadSpellTargetPositions()
continue;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(Spell_ID);
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
if (!spellInfo)
{
sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
@@ -1582,7 +1582,7 @@ void SpellMgr::LoadSpellGroups()
}
else
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second);
SpellInfo const* spellInfo = GetSpellInfo(itr->second);
if (!spellInfo)
{
@@ -1685,7 +1685,7 @@ void SpellMgr::LoadSpellProcEvents()
uint32 entry = fields[0].GetUInt32();
SpellInfo const* spell = sSpellMgr->GetSpellInfo(entry);
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
@@ -1756,7 +1756,7 @@ void SpellMgr::LoadSpellProcs()
spellId = -spellId;
}
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellId);
SpellInfo const* spellEntry = GetSpellInfo(spellId);
if (!spellEntry)
{
sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId);
@@ -1765,7 +1765,7 @@ void SpellMgr::LoadSpellProcs()
if (allRanks)
{
if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
if (GetFirstSpellInChain(spellId) != uint32(spellId))
{
sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
continue;
@@ -1855,8 +1855,8 @@ void SpellMgr::LoadSpellProcs()
if (allRanks)
{
spellId = sSpellMgr->GetNextSpellInChain(spellId);
spellEntry = sSpellMgr->GetSpellInfo(spellId);
spellId = GetNextSpellInChain(spellId);
spellEntry = GetSpellInfo(spellId);
}
else
break;
@@ -1888,7 +1888,7 @@ void SpellMgr::LoadSpellBonusess()
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
SpellInfo const* spell = sSpellMgr->GetSpellInfo(entry);
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
@@ -1920,7 +1920,7 @@ void SpellMgr::LoadSpellThreats()
QueryResult result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
if (!result)
{
sLog->outString(">> Loaded %u aggro generating spells", count);
sLog->outString(">> Loaded 0 aggro generating spells");
sLog->outString();
return;
}
@@ -1932,7 +1932,7 @@ void SpellMgr::LoadSpellThreats()
uint32 entry = fields[0].GetUInt32();
uint16 Threat = fields[1].GetUInt16();
if (!sSpellMgr->GetSpellInfo(entry))
if (!GetSpellInfo(entry))
{
sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
continue;
@@ -2000,7 +2000,7 @@ void SpellMgr::LoadSpellPetAuras()
itr->second.AddAura(pet, aura);
else
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
SpellInfo const* spellInfo = GetSpellInfo(spell);
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
@@ -2014,7 +2014,7 @@ void SpellMgr::LoadSpellPetAuras()
continue;
}
SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(aura);
SpellInfo const* spellInfo2 = GetSpellInfo(aura);
if (!spellInfo2)
{
sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
@@ -2144,13 +2144,13 @@ void SpellMgr::LoadSpellLinked()
int32 effect = fields[1].GetInt32();
int32 type = fields[2].GetInt32();
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(abs(trigger));
SpellInfo const* spellInfo = GetSpellInfo(abs(trigger));
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
continue;
}
spellInfo = sSpellMgr->GetSpellInfo(abs(effect));
spellInfo = GetSpellInfo(abs(effect));
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
@@ -2209,7 +2209,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
continue;
SpellInfo const* spell = sSpellMgr->GetSpellInfo(skillLine->spellId);
SpellInfo const* spell = GetSpellInfo(skillLine->spellId);
if (!spell) // not exist or triggered or talent
continue;
@@ -2320,7 +2320,7 @@ void SpellMgr::LoadPetDefaultSpells()
// different summon spells
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(i);
SpellInfo const* spellEntry = GetSpellInfo(i);
if (!spellEntry)
continue;
@@ -2397,7 +2397,7 @@ void SpellMgr::LoadSpellAreas()
spellArea.gender = Gender(fields[7].GetUInt8());
spellArea.autocast = fields[8].GetBool();
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
if (SpellInfo const* spellInfo = GetSpellInfo(spell))
{
if (spellArea.autocast)
const_cast<SpellInfo*>(spellInfo)->Attributes |= SPELL_ATTR0_CANT_CANCEL;
@@ -2467,7 +2467,7 @@ void SpellMgr::LoadSpellAreas()
if (spellArea.auraSpell)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(abs(spellArea.auraSpell));
SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell));
if (!spellInfo)
{
sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
@@ -2880,9 +2880,7 @@ void SpellMgr::LoadDbcDataCorrections()
}
if (spellInfo->activeIconID == 2158) // flight
{
spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;
}
switch (spellInfo->Id)
{
+3 -1
View File
@@ -536,7 +536,9 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
class SpellMgr
{
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
// Constructors
private:
SpellMgr();
~SpellMgr();