mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[11623] Implement ClassFamilyMask as wrapper for uint64+uint32 spell family masks
Inspired by patch suggested by darkstalker Also * Remove existed enums for family masks as contra-productive for developement. * Drop one from horrible hack checks in SpellMgr::IsNoStackSpellDueToSpell (spells for any fimilies with exactly 0x800 mask) I fail find useful cases for current spell data with this check. All cases expected work correct without it. If will some problems detected with this please report for fix in less strange way.
This commit is contained in:
parent
20e9484e74
commit
c686697c2d
12 changed files with 117 additions and 127 deletions
|
|
@ -1164,13 +1164,7 @@ struct DoSpellProcEvent
|
|||
{
|
||||
if (spe.spellFamilyMask[i] != r_spe.spellFamilyMask[i])
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask from first rank in chain", spell_id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (spe.spellFamilyMask2[i] != r_spe.spellFamilyMask2[i])
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask2 from first rank in chain", spell_id);
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_event` as custom rank have different spellFamilyMask/spellFamilyMask2 from first rank in chain", spell_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1244,11 +1238,11 @@ struct DoSpellProcEvent
|
|||
bool empty = !spe.spellFamilyName ? true : false;
|
||||
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (spe.spellFamilyMask[i] || spe.spellFamilyMask2[i])
|
||||
if (spe.spellFamilyMask[i])
|
||||
{
|
||||
empty = false;
|
||||
uint32 const* ptr = spell->GetEffectSpellClassMask(SpellEffectIndex(i));
|
||||
if ((((uint64*)ptr)[0] != 0 && spe.spellFamilyMask[i] == ((uint64*)ptr)[0]) && (ptr[2] == 0 || spe.spellFamilyMask2[i] == ptr[2]))
|
||||
ClassFamilyMask const& mask = spell->GetEffectSpellClassMask(SpellEffectIndex(i));
|
||||
if (mask == spe.spellFamilyMask[i])
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_event` has same class mask as in Spell.dbc (EffectIndex %u) and doesn't have any other data", spell->Id, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1304,8 +1298,9 @@ void SpellMgr::LoadSpellProcEvents()
|
|||
|
||||
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
spe.spellFamilyMask[i] = (uint64)fields[i+3].GetUInt32()|((uint64)fields[i+6].GetUInt32()<<32);
|
||||
spe.spellFamilyMask2[i] = fields[i+9].GetUInt32();
|
||||
spe.spellFamilyMask[i] = ClassFamilyMask(
|
||||
(uint64)fields[i+3].GetUInt32() | ((uint64)fields[i+6].GetUInt32()<<32),
|
||||
fields[i+9].GetUInt32());
|
||||
}
|
||||
spe.procFlags = fields[12].GetUInt32();
|
||||
spe.procEx = fields[13].GetUInt32();
|
||||
|
|
@ -1827,19 +1822,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
|
|||
SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
|
||||
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
|
||||
|
||||
if(!spellInfo_1 || !spellInfo_2)
|
||||
if (!spellInfo_1 || !spellInfo_2)
|
||||
return false;
|
||||
|
||||
if(spellId_1 == spellId_2)
|
||||
return false;
|
||||
|
||||
//I think we don't check this correctly because i need a exception for spell:
|
||||
//72,11327,18461...(called from 1856,1857...) Call Aura 16,31, after trigger another spell who call aura 77 and 77 remove 16 and 31, this should not happen.
|
||||
if(spellInfo_2->SpellFamilyFlags == 2048)
|
||||
if (spellId_1 == spellId_2)
|
||||
return false;
|
||||
|
||||
// Resurrection sickness
|
||||
if((spellInfo_1->Id == SPELL_ID_PASSIVE_RESURRECTION_SICKNESS) != (spellInfo_2->Id==SPELL_ID_PASSIVE_RESURRECTION_SICKNESS))
|
||||
if ((spellInfo_1->Id == SPELL_ID_PASSIVE_RESURRECTION_SICKNESS) != (spellInfo_2->Id==SPELL_ID_PASSIVE_RESURRECTION_SICKNESS))
|
||||
return false;
|
||||
|
||||
// Allow stack passive and not passive spells
|
||||
|
|
@ -2255,8 +2245,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
|
|||
return true;
|
||||
|
||||
// Swift Retribution / Improved Devotion Aura (talents) and Paladin Auras
|
||||
if (((spellInfo_1->SpellFamilyFlags2 & 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028)) ||
|
||||
((spellInfo_2->SpellFamilyFlags2 & 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028)))
|
||||
if ((spellInfo_1->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028)) ||
|
||||
(spellInfo_2->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028)))
|
||||
return false;
|
||||
|
||||
// Beacon of Light and Light's Beacon
|
||||
|
|
@ -2302,7 +2292,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
|
|||
{
|
||||
// Windfury weapon
|
||||
if (spellInfo_1->SpellIconID==220 && spellInfo_2->SpellIconID==220 &&
|
||||
spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags)
|
||||
!spellInfo_1->IsFitToFamilyMask(spellInfo_2->SpellFamilyFlags))
|
||||
return false;
|
||||
|
||||
// Ghost Wolf
|
||||
|
|
@ -4107,7 +4097,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
|||
{
|
||||
if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000)
|
||||
{
|
||||
if(spellEntry->SpellFamilyFlags != 0 || spellEntry->SpellFamilyFlags2 != 0)
|
||||
if (spellEntry->SpellFamilyFlags)
|
||||
{
|
||||
sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.",
|
||||
spell, name.c_str(), familyMaskA, familyMaskB, code.c_str());
|
||||
|
|
@ -4117,7 +4107,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
|||
}
|
||||
else
|
||||
{
|
||||
if((spellEntry->SpellFamilyFlags & familyMaskA)==0 && (spellEntry->SpellFamilyFlags2 & familyMaskB)==0)
|
||||
if (!spellEntry->IsFitToFamilyMask(familyMaskA, familyMaskB))
|
||||
{
|
||||
sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.",spell,name.c_str(),familyMaskA,familyMaskB,code.c_str());
|
||||
continue;
|
||||
|
|
@ -4192,12 +4182,12 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
|||
{
|
||||
if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000)
|
||||
{
|
||||
if(spellEntry->SpellFamilyFlags != 0 || spellEntry->SpellFamilyFlags2 != 0)
|
||||
if (spellEntry->SpellFamilyFlags)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((spellEntry->SpellFamilyFlags & familyMaskA)==0 && (spellEntry->SpellFamilyFlags2 & familyMaskB)==0)
|
||||
if (!spellEntry->IsFitToFamilyMask(familyMaskA, familyMaskB))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue