refactor(Core/SpellInfo): Positive/Negative spells from SpellFamilyName into DB (#3149)

* Implement SPELL_ATTR0_CU_POSITIVE_EFF0

* Implement SPELL_ATTR0_CU_POSITIVE_EFF1

* Implement SPELL_ATTR0_CU_POSITIVE_EFF2

* Move SpellFamilyName spells into DB to define if they are POSITIVE or NEGATIVE spells

* Rename column from entry to spell_id to make more sense
This commit is contained in:
Kitzunu
2020-08-16 13:25:26 +02:00
committed by GitHub
parent 95dff359be
commit 8b9cec620d
4 changed files with 117 additions and 93 deletions

View File

@@ -1210,7 +1210,7 @@ bool SpellInfo::CanBeUsedInCombat() const
bool SpellInfo::IsPositive() const
{
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE);
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE) || (AttributesCu & SPELL_ATTR0_CU_POSITIVE);
}
bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
@@ -1219,11 +1219,11 @@ bool SpellInfo::IsPositiveEffect(uint8 effIndex) const
{
default:
case 0:
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF0);
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF0) || (AttributesCu & SPELL_ATTR0_CU_POSITIVE_EFF0);
case 1:
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF1);
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF1) || (AttributesCu & SPELL_ATTR0_CU_POSITIVE_EFF1);
case 2:
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF2);
return !(AttributesCu & SPELL_ATTR0_CU_NEGATIVE_EFF2) || (AttributesCu & SPELL_ATTR0_CU_POSITIVE_EFF2);
}
}
@@ -2548,91 +2548,6 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
if (Attributes & SPELL_ATTR0_NEGATIVE_1)
return false;
switch (SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (Id)
{
case 11196: // Recently bandaged
case 29214: // Wrath of the Plaguebringer
case 34700: // Allergic Reaction
case 34709: // Shadow Sight (arena stealth detection)
case 54836: // Wrath of the Plaguebringer
case 58867: // Shaman's Spirit Wolf leap
case 61987: // Avenging Wrath Marker
case 61988: // Divine Shield exclude aura
case 72998: // Shadow Prison (Blood Prince Council, ICC Encounter)
return false;
case 30877: // Tag Murloc
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
case 62344: // Fists of Stone
case 61819: // Manabonked! (item)
case 61834: // Manabonked! (minigob)
case 19451: // Enrage (Magmadar)
return true;
default:
break;
}
break;
case SPELLFAMILY_MAGE:
// Amplify Magic, Dampen Magic
if (SpellFamilyFlags[0] == 0x00002000)
return true;
if (SpellIconID == 242)
return true;
// Ignite
if (SpellIconID == 45)
return true;
break;
case SPELLFAMILY_PRIEST:
switch (Id)
{
case 64844: // Divine Hymn
case 64904: // Hymn of Hope
case 47585: // Dispersion
return true;
default:
break;
}
// Mind Flay
if (SpellFamilyFlags[0] & 0x800000)
return false;
break;
case SPELLFAMILY_HUNTER:
// Aspect of the Viper
if (Id == 34074)
return true;
break;
case SPELLFAMILY_ROGUE:
// Envenom
if (SpellIconID == 2237)
return true;
// Slice and Dice
else if (SpellFamilyFlags[0] & 0x40000)
return true;
// Distract
else if (Id == 1725)
return true;
break;
case SPELLFAMILY_SHAMAN:
if (Id == 30708)
return false;
break;
case SPELLFAMILY_PALADIN:
// Forberance
if (Id == 25771)
return false;
break;
case SPELLFAMILY_WARRIOR:
// Intervene, Warrior, considered negative due to triggered spell with threat
if (Id == 3411)
return true;
break;
default:
break;
}
switch (Mechanic)
{
case MECHANIC_IMMUNE_SHIELD:

View File

@@ -186,8 +186,12 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard
SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00800000,
SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x01000000, // pussywizard
SPELL_ATTR0_CU_POSITIVE_EFF0 = 0x02000000,
SPELL_ATTR0_CU_POSITIVE_EFF1 = 0x04000000,
SPELL_ATTR0_CU_POSITIVE_EFF2 = 0x08000000,
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
SPELL_ATTR0_CU_POSITIVE = SPELL_ATTR0_CU_POSITIVE_EFF0 | SPELL_ATTR0_CU_POSITIVE_EFF1 | SPELL_ATTR0_CU_POSITIVE_EFF2,
};
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType);

View File

@@ -2713,7 +2713,7 @@ void SpellMgr::LoadSpellCustomAttr()
uint32 customAttrTime = getMSTime();
uint32 count;
QueryResult result = WorldDatabase.Query("SELECT entry, attributes FROM spell_custom_attr");
QueryResult result = WorldDatabase.Query("SELECT spell_id, attributes FROM spell_custom_attr");
if (!result)
sLog->outString(">> Loaded 0 spell custom attributes from DB. DB table `spell_custom_attr` is empty.");
@@ -2729,7 +2729,7 @@ void SpellMgr::LoadSpellCustomAttr()
SpellInfo * spellInfo = _GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outString("Table `spell_custom_attr` has wrong spell (entry: %u), ignored.", spellId);
sLog->outString("Table `spell_custom_attr` has wrong spell (spell_id: %u), ignored.", spellId);
continue;
}
@@ -2742,7 +2742,22 @@ void SpellMgr::LoadSpellCustomAttr()
if ((attributes & (SPELL_ATTR0_CU_NEGATIVE_EFF0 << i)) != 0)
{
sLog->outString("Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i));
sLog->outErrorDb("Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i));
continue;
}
}
}
if ((attributes & SPELL_ATTR0_CU_POSITIVE) != 0)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effects[i].IsEffect())
continue;
if ((attributes & (SPELL_ATTR0_CU_POSITIVE_EFF0 << i)) != 0)
{
sLog->outErrorDb("Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_POSITIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i));
continue;
}
}
@@ -2753,7 +2768,6 @@ void SpellMgr::LoadSpellCustomAttr()
sLog->outString(">> Loaded %u spell custom attributes from DB in %u ms", count, GetMSTimeDiffToNow(customAttrTime));
}
// xinef: create talent spells set
for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
{