fix(Core/Spell): Implement SPELL_ATTR0_CU_DONT_BREAK_STEALTH (#3056)

* Implement the ability to add SPELL_ATTR0_CU_DONT_BREAK_STEALTH on spells from DB

Co-authored-by: Shadowball Gengar <shadowballgengar60@gmail>
This commit is contained in:
gengarshadowball
2020-06-19 11:00:21 +01:00
committed by GitHub
parent 34077115a5
commit 0b35a24053
7 changed files with 95 additions and 37 deletions

View File

@@ -0,0 +1,43 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1590187354352733700');
DELETE FROM `spell_custom_attr` WHERE `entry` IN (99, 1735, 5729, 9490, 9497, 9898, 26998, 48559, 48560, 1130,1725,3600,14323,14324,14325,32375,32592,35009,39897,42650,43263,43264,53338,59667,58831,58832,58833,58834,58838,64695,29858,32835,10576,12323,23600,38256,43530,52744);
INSERT INTO `spell_custom_attr` (`entry`, `attributes`) VALUES
(1130, 64), -- Hunter spell 1130, Hunter's Mark Rank 1
(1725, 64), -- Rogue spell 1725, Distract
(3600, 64), -- Greater Earthbind Totem spell 3600, Earthbind
(5729, 64), -- Stoneclaw totem effect
(14323, 64), -- Hunter spell 14323, Hunter's Mark Rank 2
(14324, 64), -- Hunter spell 14324, Hunter's Mark Rank 3
(14325, 64), -- Hunter spell 14325, Hunter's Mark Rank 4
(32375, 64), -- Priest Discipline spell 32375, Mass Dispel
(32592, 64), -- Priest Discipline spell 32592, Mass Dispel
(35009, 64), -- Triggered by Mage Invisibility (Level 68), spells 66 & 67765
(39897, 64), -- Priest Discipline spell 39897, Mass Dispel
(42650, 64), -- Death Knight Unholy spell 42650, Army of the Dead
(43263, 64), -- Ghoul level 66 spell 43263, Ghoul Taunt
(43264, 64), -- Periodic Taunt, Trigger for Ghoul Taunt
(53338, 64), -- Hunter spell 53338, Hunter's Mark Rank 5
(58831, 64), -- Mirror Image, spawns left Mirror Image NPC
(58832, 64), -- Mirror Image, Triggers 58831,58833,58834
(58833, 64), -- Mirror Image, spawns center Mirror Image NPC
(58834, 64), -- Mirror Image, spawns right Mirror Image NPC
(58838, 64), -- Inherit Master's Threat List
(64695, 64), -- Earthgrab (Xinef fix for Totem)
(59667, 64), -- Intervine trigger
(29858, 64), -- Soulshatter from warlock
(32835, 64),
(10576, 64), -- Piercing Howls
(12323, 64),
(23600, 64),
(38256, 64),
(43530, 64),
(52744, 64),
(99, 64), -- Druid Demoralizing roars (spellInfo->SpellFamilyFlags[0] & 0x8)
(1735, 64),
(9490, 64),
(9497, 64),
(9898, 64),
(26998, 64),
(48559, 64),
(48560, 64);

View File

@@ -197,7 +197,7 @@ namespace ArenaSpectator
if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR))
return false;
if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
return true;
for(uint8 i=EFFECT_0; i<MAX_SPELL_EFFECTS; ++i)

View File

@@ -4591,7 +4591,7 @@ void Unit::RemoveAurasByShapeShift()
{
Aura const* aura = iter->second->GetBase();
if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
(!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || (aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x20))))
(!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH) || (aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x20))))
{
RemoveAura(iter);
continue;

View File

@@ -2851,9 +2851,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
{
if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(effectUnit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
{
m_caster->CombatStart(effectUnit, !(m_spellInfo->AttributesEx3& SPELL_ATTR3_NO_INITIAL_AGGRO));
m_caster->CombatStart(effectUnit, !(m_spellInfo->AttributesEx3& SPELL_ATTR3_NO_INITIAL_AGGRO));
if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC)
if (!effectUnit->IsStandState())
effectUnit->SetStandState(UNIT_STAND_STATE_STAND);
}
@@ -3010,8 +3009,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
unit->IncrDiminishing(m_diminishGroup);
}
// Xinef: Stealth remove, added UGLY hack for mass dispel... cant find any other solution, ugly hack for Storm, Earth and Fire talent
if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && m_spellInfo->SpellIconID != 2267 && unit->IsControlledByPlayer() && (!m_caster->IsTotem() || m_spellInfo->Id == 64695) && /*Intervene Trigger*/ m_spellInfo->Id != 59667)
if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH))
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
if (aura_effmask)

View File

@@ -167,7 +167,7 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
SPELL_ATTR0_CU_NO_INITIAL_THREAT = 0x00000010,
SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
SPELL_ATTR0_CU_AURA_CC = 0x00000040,
SPELL_ATTR0_CU_DONT_BREAK_STEALTH = 0x00000040,
SPELL_ATTR0_CU_NONE3 = 0x00000080, // UNUSED
SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
SPELL_ATTR0_CU_CHARGE = 0x00000200,

View File

@@ -2710,6 +2710,49 @@ void SpellMgr::LoadSpellSpecificAndAuraState()
void SpellMgr::LoadSpellCustomAttr()
{
uint32 oldMSTime = getMSTime();
uint32 customAttrTime = getMSTime();
uint32 count;
QueryResult result = WorldDatabase.Query("SELECT entry, attributes FROM spell_custom_attr");
if (!result)
sLog->outString(">> Loaded 0 spell custom attributes from DB. DB table `spell_custom_attr` is empty.");
else
{
for (count = 0; result->NextRow(); ++count)
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
uint32 attributes = fields[1].GetUInt32();
SpellInfo * spellInfo = _GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outString("Table `spell_custom_attr` has wrong spell (entry: %u), ignored.", spellId);
continue;
}
if ((attributes & SPELL_ATTR0_CU_NEGATIVE) != 0)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effects[i].IsEffect())
continue;
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));
continue;
}
}
}
spellInfo->AttributesCu |= attributes;
}
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)
@@ -2739,14 +2782,6 @@ void SpellMgr::LoadSpellCustomAttr()
{
switch (spellInfo->Effects[j].ApplyAuraName)
{
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_MOD_CONFUSE:
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_AOE_CHARM:
case SPELL_AURA_MOD_FEAR:
case SPELL_AURA_MOD_STUN:
spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
@@ -2857,7 +2892,7 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY)
continue;
default:
if (spellInfo->Effects[j].CalcValue() || ((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)))
if (spellInfo->Effects[j].CalcValue() || ((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)))
if (spellInfo->Id != 69649 && spellInfo->Id != 71056 && spellInfo->Id != 71057 && spellInfo->Id != 71058 && spellInfo->Id != 73061 && spellInfo->Id != 73062 && spellInfo->Id != 73063 && spellInfo->Id != 73064) // Sindragosa Frost Breath
if (spellInfo->SpellFamilyName != SPELLFAMILY_MAGE || !(spellInfo->SpellFamilyFlags[0] & 0x20)) // frostbolt
if (spellInfo->Id != 55095) // frost fever
@@ -3172,27 +3207,6 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->Effects[EFFECT_0].MiscValue = 127;
break;
}
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_WARRIOR:
// Shout / Piercing Howl
if (spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
break;
case SPELLFAMILY_DRUID:
// Roar
if (spellInfo->SpellFamilyFlags[0] & 0x8)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
break;
case SPELLFAMILY_GENERIC:
// Stoneclaw Totem effect
if(spellInfo->Id == 5729)
spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC;
break;
default:
break;
}
}
// Xinef: addition for binary spells, ommit spells triggering other spells

View File

@@ -691,6 +691,9 @@ class SpellMgr
// Talent Additional Set
bool IsAdditionalTalentSpell(uint32 spellId) const;
private:
SpellInfo* _GetSpellInfo(uint32 spellId) { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }
// Modifiers
public: