Core/Spells: Don't allow players to cast client-side hidden spells directly

This commit is contained in:
Shocker
2011-06-23 23:43:49 +03:00
parent c33dbded94
commit 5ddf90c5fe
3 changed files with 8 additions and 3 deletions

View File

@@ -402,7 +402,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
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->prepare(&targets);
}

View File

@@ -439,7 +439,7 @@ void SpellCastTargets::OutDebug() const
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_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_castedClientside = castedClientside;
m_IsTriggeredSpell = bool(triggered || (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED));
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))
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
if (strict && !m_IsTriggeredSpell && HasGlobalCooldown())
return SPELL_FAILED_NOT_READY;

View File

@@ -386,7 +386,7 @@ class Spell
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();
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
@@ -683,6 +683,7 @@ class Spell
uint32 m_timer;
bool m_IsTriggeredSpell;
bool m_castedClientside;
// if need this can be replaced by Aura copy
// we can't store original aura link to prevent access to deleted auras