This is an in-progress implementation of a bitset-like class that wraps the 96 bit SpellFamilyFlags + SpellFamilyFlags2 into a single object that can be accessed by individual bit position. Its implemented via template metaprogramming in order to achieve compile-time bit mask calculation in a transparent way with no overhead. This gives a more readable and verbose version of stuff like:
case SPELLFAMILY_WARLOCK:
// For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000060))
m_canTrigger = true;
break;
case SPELLFAMILY_PRIEST:
// For Penance,Mind Sear,Mind Flay heal/damage triggers need do it
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001800000800000) || (m_spellInfo->SpellFamilyFlags2 & 0x00000040))
m_canTrigger = true;
break;
that becomes:
case SPELLFAMILY_WARLOCK:
// For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it
if (m_spellInfo->SpellClassMask.test<CF_WARLOCK_RAIN_OF_FIRE, CF_WARLOCK_HELLFIRE, CF_WARLOCK_SEED_OF_CORRUPTION2>())
m_canTrigger = true;
break;
case SPELLFAMILY_PRIEST:
// For Penance,Mind Sear,Mind Flay heal/damage triggers need do it
if (m_spellInfo->SpellClassMask.test<CF_PRIEST_MIND_FLAY1, CF_PRIEST_PENANCE_DMG, CF_PRIEST_PENANCE_HEAL, CF_PRIEST_MIND_FLAY2>())
m_canTrigger = true;
break;
Where CF_* is an enum that associates the bit position with a name like:
enum CLASS_FLAG
{
CF_MAGE_FIREBALL = 0,
CF_MAGE_FIRE_BLAST = 1,
CF_MAGE_FLAMESTRIKE = 2,
CF_MAGE_FIRE_WARD = 3,
CF_MAGE_SCORCH = 4,
CF_MAGE_FROSTBOLT = 5,
// ...
Source code with the class here: http://paste2.org/p/1094906
sample implementation here
new version for 11623+