Merge branch 'master' of git@github.com:mangos/mangos into procflag

This commit is contained in:
DiSlord 2008-12-23 18:03:21 +03:00
commit bae58eb069
270 changed files with 23161 additions and 7761 deletions

View file

@ -182,10 +182,10 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
if ((spellInfo->SpellFamilyFlags & 0x00000820180400LL) && (spellInfo->AttributesEx3 & 0x200))
return SPELL_JUDGEMENT;
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) // TODO: fix it for WotLK!!!
{
// only paladin auras have this
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID)
return SPELL_AURA;
}
break;
@ -203,7 +203,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
}
// only warlock armor/skin have this (in additional to family cases)
if( spellInfo->SpellVisual == 130 && spellInfo->SpellIconID == 89)
if( spellInfo->SpellVisual[0] == 130 && spellInfo->SpellIconID == 89)
{
return SPELL_WARLOCK_ARMOR;
}
@ -677,8 +677,8 @@ void SpellMgr::LoadSpellAffects()
uint32 count = 0;
// 0 1 2
QueryResult *result = WorldDatabase.Query("SELECT entry, effectId, SpellFamilyMask FROM spell_affect");
// 0 1 2 3 4
QueryResult *result = WorldDatabase.Query("SELECT entry, effectId, SpellClassMask0, SpellClassMask1, SpellClassMask2 FROM spell_affect");
if( !result )
{
@ -725,26 +725,29 @@ void SpellMgr::LoadSpellAffects()
continue;
}
uint64 spellAffectMask = fields[2].GetUInt64();
SpellAffectEntry affect;
affect.SpellClassMask[0] = fields[2].GetUInt32();
affect.SpellClassMask[1] = fields[3].GetUInt32();
affect.SpellClassMask[2] = fields[4].GetUInt32();
// Spell.dbc have own data for low part of SpellFamilyMask
if( spellInfo->EffectItemType[effectId])
// Spell.dbc have own data
uint32 const *ptr = 0;
switch (effectId)
{
if(spellInfo->EffectItemType[effectId] == spellAffectMask)
{
sLog.outErrorDb("Spell %u listed in `spell_affect` have redundant (same with EffectItemType%d) data for effect index (%u) and not needed, skipped.", entry,effectId+1,effectId);
case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break;
case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break;
case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break;
default:
continue;
}
// 24429 have wrong data in EffectItemType and overwrites by DB, possible bug in client
if(spellInfo->Id!=24429 && spellInfo->EffectItemType[effectId] != spellAffectMask)
{
sLog.outErrorDb("Spell %u listed in `spell_affect` have different low part from EffectItemType%d for effect index (%u) and not needed, skipped.", entry,effectId+1,effectId);
continue;
}
}
if(ptr[0] == affect.SpellClassMask[0] || ptr[1] == affect.SpellClassMask[1] || ptr[2] == affect.SpellClassMask[2])
{
char text[]="ABC";
sLog.outErrorDb("Spell %u listed in `spell_affect` have redundant (same with EffectSpellClassMask%c) data for effect index (%u) and not needed, skipped.", entry, text[effectId], effectId);
continue;
}
mSpellAffectMap.insert(SpellAffectMap::value_type((entry<<8) + effectId,spellAffectMask));
mSpellAffectMap[(entry<<8) + effectId] = affect;
++count;
} while( result->NextRow() );
@ -752,7 +755,7 @@ void SpellMgr::LoadSpellAffects()
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u spell affect definitions", count );
sLog.outString( ">> Loaded %u custom spell affect definitions", count );
for (uint32 id = 0; id < sSpellStore.GetNumRows(); ++id)
{
@ -768,7 +771,16 @@ void SpellMgr::LoadSpellAffects()
spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER) )
continue;
if(spellInfo->EffectItemType[effectId] != 0)
uint32 const *ptr = 0;
switch (effectId)
{
case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break;
case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break;
case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break;
default:
continue;
}
if(ptr[0] || ptr[1] || ptr[2])
continue;
if(mSpellAffectMap.find((id<<8) + effectId) != mSpellAffectMap.end())
@ -779,33 +791,20 @@ void SpellMgr::LoadSpellAffects()
}
}
bool SpellMgr::IsAffectedBySpell(SpellEntry const *spellInfo, uint32 spellId, uint8 effectId, uint64 familyFlags) const
bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
{
// false for spellInfo == NULL
if (!spellInfo)
if (!spellInfo || !mod)
return false;
SpellEntry const *affect_spell = sSpellStore.LookupEntry(spellId);
// false for affect_spell == NULL
if (!affect_spell)
SpellEntry const *affect_spell = sSpellStore.LookupEntry(mod->spellId);
// False if affect_spell == NULL or spellFamily not equal
if (!affect_spell || affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
return false;
// False if spellFamily not equal
if (affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
return false;
// If familyFlags == 0
if (!familyFlags)
{
// Get it from spellAffect table
familyFlags = GetSpellAffectMask(spellId,effectId);
// false if familyFlags == 0
if (!familyFlags)
return false;
}
// true
if (familyFlags & spellInfo->SpellFamilyFlags)
if (mod->mask & spellInfo->SpellFamilyFlags ||
mod->mask2 & spellInfo->SpellFamilyFlags2)
return true;
return false;
@ -1099,7 +1098,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
{
// Paladin aura Spell
if(spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN
&& spellInfo->Effect[i]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
&& spellInfo->Effect[i]==SPELL_EFFECT_APPLY_AREA_AURA_RAID)
return false;
// Druid form Spell
if(spellInfo->SpellFamilyName == SPELLFAMILY_DRUID
@ -1154,14 +1153,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
// Soulstone Resurrection and Twisting Nether (resurrector)
if( spellInfo_1->SpellIconID == 92 && spellInfo_2->SpellIconID == 92 && (
spellInfo_1->SpellVisual == 99 && spellInfo_2->SpellVisual == 0 ||
spellInfo_2->SpellVisual == 99 && spellInfo_1->SpellVisual == 0 ) )
spellInfo_1->SpellVisual[0] == 99 && spellInfo_2->SpellVisual[0] == 0 ||
spellInfo_2->SpellVisual[0] == 99 && spellInfo_1->SpellVisual[0] == 0 ) )
return false;
// Heart of the Wild and (Primal Instinct (Idol of Terror) triggering spell or Agility)
if( spellInfo_1->SpellIconID == 240 && spellInfo_2->SpellIconID == 240 && (
spellInfo_1->SpellVisual == 0 && spellInfo_2->SpellVisual == 78 ||
spellInfo_2->SpellVisual == 0 && spellInfo_1->SpellVisual == 78 ) )
spellInfo_1->SpellVisual[0] == 0 && spellInfo_2->SpellVisual[0] == 78 ||
spellInfo_2->SpellVisual[0] == 0 && spellInfo_1->SpellVisual[0] == 78 ) )
return false;
// Personalized Weather (thunder effect should overwrite rainy aura)
@ -1178,7 +1177,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
case SPELLFAMILY_WARRIOR:
{
// Scroll of Protection and Defensive Stance (multi-family check)
if( spellInfo_1->SpellIconID == 276 && spellInfo_1->SpellVisual == 196 && spellInfo_2->Id == 71)
if( spellInfo_1->SpellIconID == 276 && spellInfo_1->SpellVisual[0] == 196 && spellInfo_2->Id == 71)
return false;
// Improved Hamstring -> Hamstring (multi-family check)
@ -1190,7 +1189,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
case SPELLFAMILY_DRUID:
{
// Scroll of Stamina and Leader of the Pack (multi-family check)
if( spellInfo_1->SpellIconID == 312 && spellInfo_1->SpellVisual == 216 && spellInfo_2->Id == 24932 )
if( spellInfo_1->SpellIconID == 312 && spellInfo_1->SpellVisual[0] == 216 && spellInfo_2->Id == 24932 )
return false;
// Dragonmaw Illusion (multi-family check)
@ -1221,11 +1220,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
case SPELLFAMILY_PALADIN:
{
// Unstable Currents and other -> *Sanctity Aura (multi-family check)
if( spellInfo_2->SpellIconID==502 && spellInfo_1->SpellIconID==502 && spellInfo_1->SpellVisual==969 )
if( spellInfo_2->SpellIconID==502 && spellInfo_1->SpellIconID==502 && spellInfo_1->SpellVisual[0]==969 )
return false;
// *Band of Eternal Champion and Seal of Command(multi-family check)
if( spellId_1 == 35081 && spellInfo_2->SpellIconID==561 && spellInfo_2->SpellVisual==7992)
if( spellId_1 == 35081 && spellInfo_2->SpellIconID==561 && spellInfo_2->SpellVisual[0]==7992)
return false;
break;
@ -1241,16 +1240,16 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return false;
// Blink & Improved Blink
if( (spellInfo_1->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_2->SpellVisual == 72 && spellInfo_2->SpellIconID == 1499) ||
(spellInfo_2->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_1->SpellVisual == 72 && spellInfo_1->SpellIconID == 1499) )
if( (spellInfo_1->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499) ||
(spellInfo_2->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499) )
return false;
}
// Detect Invisibility and Mana Shield (multi-family check)
if( spellInfo_2->Id == 132 && spellInfo_1->SpellIconID == 209 && spellInfo_1->SpellVisual == 968 )
if( spellInfo_2->Id == 132 && spellInfo_1->SpellIconID == 209 && spellInfo_1->SpellVisual[0] == 968 )
return false;
// Combustion and Fire Protection Aura (multi-family check)
if( spellInfo_1->Id == 11129 && spellInfo_2->SpellIconID == 33 && spellInfo_2->SpellVisual == 321 )
if( spellInfo_1->Id == 11129 && spellInfo_2->SpellIconID == 33 && spellInfo_2->SpellVisual[0] == 321 )
return false;
break;
@ -1279,7 +1278,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return false;
}
// Detect Invisibility and Mana Shield (multi-family check)
if( spellInfo_1->Id == 132 && spellInfo_2->SpellIconID == 209 && spellInfo_2->SpellVisual == 968 )
if( spellInfo_1->Id == 132 && spellInfo_2->SpellIconID == 209 && spellInfo_2->SpellVisual[0] == 968 )
return false;
break;
case SPELLFAMILY_WARRIOR:
@ -1301,11 +1300,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return false;
// Defensive Stance and Scroll of Protection (multi-family check)
if( spellInfo_1->Id == 71 && spellInfo_2->SpellIconID == 276 && spellInfo_2->SpellVisual == 196 )
if( spellInfo_1->Id == 71 && spellInfo_2->SpellIconID == 276 && spellInfo_2->SpellVisual[0] == 196 )
return false;
// Bloodlust and Bloodthirst (multi-family check)
if( spellInfo_2->Id == 2825 && spellInfo_1->SpellIconID == 38 && spellInfo_1->SpellVisual == 0 )
if( spellInfo_2->Id == 2825 && spellInfo_1->SpellIconID == 38 && spellInfo_1->SpellVisual[0] == 0 )
return false;
break;
@ -1350,7 +1349,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
}
// Leader of the Pack and Scroll of Stamina (multi-family check)
if( spellInfo_1->Id == 24932 && spellInfo_2->SpellIconID == 312 && spellInfo_2->SpellVisual == 216 )
if( spellInfo_1->Id == 24932 && spellInfo_2->SpellIconID == 312 && spellInfo_2->SpellVisual[0] == 216 )
return false;
// Dragonmaw Illusion (multi-family check)
@ -1367,7 +1366,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
}
// Garrote -> Garrote-Silence (multi-family check)
if( spellInfo_1->SpellIconID == 498 && spellInfo_2->SpellIconID == 498 && spellInfo_2->SpellVisual == 0 )
if( spellInfo_1->SpellIconID == 498 && spellInfo_2->SpellIconID == 498 && spellInfo_2->SpellVisual[0] == 0 )
return false;
break;
case SPELLFAMILY_HUNTER:
@ -1404,15 +1403,15 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return true;
}
// Combustion and Fire Protection Aura (multi-family check)
if( spellInfo_2->Id == 11129 && spellInfo_1->SpellIconID == 33 && spellInfo_1->SpellVisual == 321 )
if( spellInfo_2->Id == 11129 && spellInfo_1->SpellIconID == 33 && spellInfo_1->SpellVisual[0] == 321 )
return false;
// *Sanctity Aura -> Unstable Currents and other (multi-family check)
if( spellInfo_1->SpellIconID==502 && spellInfo_2->SpellFamilyName == SPELLFAMILY_GENERIC && spellInfo_2->SpellIconID==502 && spellInfo_2->SpellVisual==969 )
if( spellInfo_1->SpellIconID==502 && spellInfo_2->SpellFamilyName == SPELLFAMILY_GENERIC && spellInfo_2->SpellIconID==502 && spellInfo_2->SpellVisual[0]==969 )
return false;
// *Seal of Command and Band of Eternal Champion (multi-family check)
if( spellInfo_1->SpellIconID==561 && spellInfo_1->SpellVisual==7992 && spellId_2 == 35081)
if( spellInfo_1->SpellIconID==561 && spellInfo_1->SpellVisual[0]==7992 && spellId_2 == 35081)
return false;
break;
case SPELLFAMILY_SHAMAN:
@ -1428,7 +1427,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
return false;
}
// Bloodlust and Bloodthirst (multi-family check)
if( spellInfo_1->Id == 2825 && spellInfo_2->SpellIconID == 38 && spellInfo_2->SpellVisual == 0 )
if( spellInfo_1->Id == 2825 && spellInfo_2->SpellIconID == 38 && spellInfo_2->SpellVisual[0] == 0 )
return false;
break;
default:
@ -1516,7 +1515,8 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
{
if( IsPositiveEffect(spellInfo->Id, i) && (
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID
) )
{
needRankSelection = true;
@ -1641,12 +1641,12 @@ void SpellMgr::LoadSpellChains()
continue;
}
if(node.req!=talentEntry->DependsOnSpell)
/*if(node.req!=talentEntry->DependsOnSpell)
{
sLog.outErrorDb("Talent %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has wrong required spell.",
spell_id,node.prev,node.first,node.rank,node.req);
continue;
}
}*/
}
}
@ -2058,7 +2058,187 @@ void SpellMgr::LoadSpellPetAuras()
sLog.outString( ">> Loaded %u spell pet auras", count );
}
/// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc
void SpellMgr::LoadPetLevelupSpellMap()
{
CreatureFamilyEntry const *creatureFamily;
SpellEntry const *spell;
uint32 count = 0;
for (uint32 i = 0; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
creatureFamily = sCreatureFamilyStore.LookupEntry(i);
if(!creatureFamily) // not exist
continue;
if(creatureFamily->petTalentType < 0) // not hunter pet family
continue;
for(uint32 j = 0; j < sSpellStore.GetNumRows(); ++j)
{
spell = sSpellStore.LookupEntry(j);
// not exist
if(!spell)
continue;
// not hunter spell
if(spell->SpellFamilyName != SPELLFAMILY_HUNTER)
continue;
// not pet spell
if(!(spell->SpellFamilyFlags & 0x1000000000000000LL))
continue;
// not Growl or Cower (generics)
if(spell->SpellIconID != 201 && spell->SpellIconID != 958)
{
switch(creatureFamily->ID)
{
case CREATURE_FAMILY_BAT: // Bite and Sonic Blast
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1577)
continue;
break;
case CREATURE_FAMILY_BEAR: // Claw and Swipe
if(spell->SpellIconID != 262 && spell->SpellIconID != 1562)
continue;
break;
case CREATURE_FAMILY_BIRD_OF_PREY: // Claw and Snatch
if(spell->SpellIconID != 262 && spell->SpellIconID != 168)
continue;
break;
case CREATURE_FAMILY_BOAR: // Bite and Gore
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1578)
continue;
break;
case CREATURE_FAMILY_CARRION_BIRD: // Bite and Demoralizing Screech
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1579)
continue;
break;
case CREATURE_FAMILY_CAT: // Claw and Prowl and Rake
if(spell->SpellIconID != 262 && spell->SpellIconID != 495 && spell->SpellIconID != 494)
continue;
break;
case CREATURE_FAMILY_CHIMAERA: // Bite and Froststorm Breath
if(spell->SpellIconID != 1680 && spell->SpellIconID != 62)
continue;
break;
case CREATURE_FAMILY_CORE_HOUND: // Bite and Lava Breath
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1197)
continue;
break;
case CREATURE_FAMILY_CRAB: // Claw and Pin
if(spell->SpellIconID != 262 && spell->SpellIconID != 2679)
continue;
break;
case CREATURE_FAMILY_CROCOLISK: // Bite and Bad Attitude
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1581)
continue;
break;
case CREATURE_FAMILY_DEVILSAUR: // Bite and Monstrous Bite
if(spell->SpellIconID != 1680 && spell->SpellIconID != 599)
continue;
break;
case CREATURE_FAMILY_DRAGONHAWK: // Bite and Fire Breath
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2128)
continue;
break;
case CREATURE_FAMILY_GORILLA: // Smack and Thunderstomp
if(spell->SpellIconID != 473 && spell->SpellIconID != 148)
continue;
break;
case CREATURE_FAMILY_HYENA: // Bite and Tendon Rip
if(spell->SpellIconID != 1680 && spell->SpellIconID != 138)
continue;
break;
case CREATURE_FAMILY_MOTH: // Serenity Dust and Smack
if(spell->SpellIconID != 1714 && spell->SpellIconID != 473)
continue;
break;
case CREATURE_FAMILY_NETHER_RAY: // Bite and Nether Shock
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2027)
continue;
break;
case CREATURE_FAMILY_RAPTOR: // Claw and Savage Rend
if(spell->SpellIconID != 262 && spell->SpellIconID != 245)
continue;
break;
case CREATURE_FAMILY_RAVAGER: // Bite and Ravage
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2253)
continue;
break;
case CREATURE_FAMILY_RHINO: // Smack and Stampede
if(spell->SpellIconID != 473 && spell->SpellIconID != 3066)
continue;
break;
case CREATURE_FAMILY_SCORPID: // Claw and Scorpid Poison
if(spell->SpellIconID != 262 && spell->SpellIconID != 163)
continue;
break;
case CREATURE_FAMILY_SERPENT: // Bite and Poison Spit
if(spell->SpellIconID != 1680 && spell->SpellIconID != 68)
continue;
break;
case CREATURE_FAMILY_SILITHID: // Claw and Venom Web Spray
if(spell->SpellIconID != 262 && (spell->SpellIconID != 272 && spell->SpellVisual[0] != 12013))
continue;
break;
case CREATURE_FAMILY_SPIDER: // Bite and Web
if(spell->SpellIconID != 1680 && (spell->SpellIconID != 272 && spell->SpellVisual[0] != 684))
continue;
break;
case CREATURE_FAMILY_SPIRIT_BEAST: // Claw and Prowl and Spirit Strike
if(spell->SpellIconID != 262 && spell->SpellIconID != 495 && spell->SpellIconID != 255)
continue;
break;
case CREATURE_FAMILY_SPOREBAT: // Smack and Spore Cloud
if(spell->SpellIconID != 473 && spell->SpellIconID != 2681)
continue;
break;
case CREATURE_FAMILY_TALLSTRIDER: // Claw and Dust Cloud
if(spell->SpellIconID != 262 && (spell->SpellIconID != 157 && !(spell->Attributes & 0x4000000)))
continue;
break;
case CREATURE_FAMILY_TURTLE: // Bite and Shell Shield
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1588)
continue;
break;
case CREATURE_FAMILY_WARP_STALKER: // Bite and Warp
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1952)
continue;
break;
case CREATURE_FAMILY_WASP: // Smack and Sting
if(spell->SpellIconID != 473 && spell->SpellIconID != 110)
continue;
break;
case CREATURE_FAMILY_WIND_SERPENT: // Bite and Lightning Breath
if(spell->SpellIconID != 1680 && spell->SpellIconID != 62)
continue;
break;
case CREATURE_FAMILY_WOLF: // Bite and Furious Howl
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1573)
continue;
break;
case CREATURE_FAMILY_WORM: // Acid Spit and Bite
if(spell->SpellIconID != 636 && spell->SpellIconID != 1680)
continue;
break;
default:
sLog.outError("LoadPetLevelupSpellMap: Unhandled creature family %u", creatureFamily->ID);
continue;
}
}
mPetLevelupSpellMap[creatureFamily->ID][spell->spellLevel] = spell->Id;
count++;
}
}
sLog.outString();
sLog.outString( ">> Loaded %u pet levelup spells", count );
}
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
{
// not exist
@ -2095,15 +2275,15 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
}
case SPELL_EFFECT_LEARN_SPELL:
{
SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[0]);
SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]);
if( !IsSpellValid(spellInfo2,pl,msg) )
{
if(msg)
{
if(pl)
ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[0]);
ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[i]);
else
sLog.outErrorDb("Spell %u learn to invalid spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[0]);
sLog.outErrorDb("Spell %u learn to invalid spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[i]);
}
return false;
}
@ -2136,7 +2316,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id)
{
// normal case
if( spellInfo->AreaId && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id )
if( spellInfo->AreaId > 0 && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id )
return false;
// elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup)