[11959] Implement spell effect 131 - SPELL_EFFECT_PLAY_SOUND

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
stfx 2012-04-13 17:51:58 +02:00 committed by Schmoozerd
parent 9fd41d0508
commit 067942a978
4 changed files with 25 additions and 10 deletions

View file

@ -191,7 +191,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectApplyAreaAura, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
&Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
&Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
&Spell::EffectUnused, //131 SPELL_EFFECT_131 used in some test spells
&Spell::EffectPlaySound, //131 SPELL_EFFECT_PLAY_SOUND sound id in misc value (SoundEntries.dbc)
&Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
&Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization
&Spell::EffectKillCreditGroup, //134 SPELL_EFFECT_KILL_CREDIT_GROUP misc value is creature entry
@ -9355,21 +9355,35 @@ void Spell::EffectRenamePet(SpellEffectIndex /*eff_idx*/)
unitTarget->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
}
void Spell::EffectPlayMusic(SpellEffectIndex eff_idx)
void Spell::EffectPlaySound(SpellEffectIndex eff_idx)
{
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
uint32 soundid = m_spellInfo->EffectMiscValue[eff_idx];
if (!sSoundEntriesStore.LookupEntry(soundid))
uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx];
if (!sSoundEntriesStore.LookupEntry(soundId))
{
sLog.outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.",soundid,m_spellInfo->Id);
sLog.outError("EffectPlaySound: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id);
return;
}
unitTarget->PlayDirectSound(soundId, (Player*)unitTarget);
}
void Spell::EffectPlayMusic(SpellEffectIndex eff_idx)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx];
if (!sSoundEntriesStore.LookupEntry(soundId))
{
sLog.outError("EffectPlayMusic: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id);
return;
}
WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(soundid);
data << uint32(soundId);
((Player*)unitTarget)->GetSession()->SendPacket(&data);
}