Core/Spells: Don't allow players to cast client-side hidden spells directly
This commit is contained in:
@@ -402,7 +402,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
|||||||
spellInfo = actualSpellInfo;
|
spellInfo = actualSpellInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spell* spell = new Spell(mover, spellInfo, false);
|
Spell* spell = new Spell(mover, spellInfo, false, 0, false, true);
|
||||||
spell->m_cast_count = castCount; // set count of casts
|
spell->m_cast_count = castCount; // set count of casts
|
||||||
spell->prepare(&targets);
|
spell->prepare(&targets);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ void SpellCastTargets::OutDebug() const
|
|||||||
sLog->outString("elevation: %f", m_elevation);
|
sLog->outString("elevation: %f", m_elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, bool skipCheck):
|
Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, bool skipCheck, bool castedClientside):
|
||||||
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, Caster)),
|
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, Caster)),
|
||||||
m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
||||||
{
|
{
|
||||||
@@ -502,6 +502,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
|||||||
|
|
||||||
m_spellState = SPELL_STATE_NULL;
|
m_spellState = SPELL_STATE_NULL;
|
||||||
|
|
||||||
|
m_castedClientside = castedClientside;
|
||||||
m_IsTriggeredSpell = bool(triggered || (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED));
|
m_IsTriggeredSpell = bool(triggered || (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED));
|
||||||
m_CastItem = NULL;
|
m_CastItem = NULL;
|
||||||
|
|
||||||
@@ -4651,6 +4652,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
|
if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
|
||||||
return SPELL_FAILED_SPELL_UNAVAILABLE;
|
return SPELL_FAILED_SPELL_UNAVAILABLE;
|
||||||
|
|
||||||
|
if (m_castedClientside && m_spellInfo->Attributes & SPELL_ATTR0_HIDDEN_CLIENTSIDE && m_caster->GetTypeId() == TYPEID_PLAYER && !m_CastItem)
|
||||||
|
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
|
||||||
|
|
||||||
// Check global cooldown
|
// Check global cooldown
|
||||||
if (strict && !m_IsTriggeredSpell && HasGlobalCooldown())
|
if (strict && !m_IsTriggeredSpell && HasGlobalCooldown())
|
||||||
return SPELL_FAILED_NOT_READY;
|
return SPELL_FAILED_NOT_READY;
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ class Spell
|
|||||||
|
|
||||||
typedef std::set<Aura*> UsedSpellMods;
|
typedef std::set<Aura*> UsedSpellMods;
|
||||||
|
|
||||||
Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false);
|
Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false, bool castedClientside = false);
|
||||||
~Spell();
|
~Spell();
|
||||||
|
|
||||||
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
|
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
|
||||||
@@ -683,6 +683,7 @@ class Spell
|
|||||||
uint32 m_timer;
|
uint32 m_timer;
|
||||||
|
|
||||||
bool m_IsTriggeredSpell;
|
bool m_IsTriggeredSpell;
|
||||||
|
bool m_castedClientside;
|
||||||
|
|
||||||
// if need this can be replaced by Aura copy
|
// if need this can be replaced by Aura copy
|
||||||
// we can't store original aura link to prevent access to deleted auras
|
// we can't store original aura link to prevent access to deleted auras
|
||||||
|
|||||||
Reference in New Issue
Block a user