Created
April 13, 2012 16:12
-
-
Save Ramusik/2378004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h | |
index bd6aea7..0400b18 100644 | |
--- a/src/game/SharedDefines.h | |
+++ b/src/game/SharedDefines.h | |
@@ -702,7 +702,7 @@ enum SpellEffects | |
SPELL_EFFECT_APPLY_AREA_AURA_FRIEND = 128, | |
SPELL_EFFECT_APPLY_AREA_AURA_ENEMY = 129, | |
SPELL_EFFECT_REDIRECT_THREAT = 130, | |
- SPELL_EFFECT_131 = 131, | |
+ SPELL_EFFECT_PLAY_SOUND = 131, | |
SPELL_EFFECT_PLAY_MUSIC = 132, | |
SPELL_EFFECT_UNLEARN_SPECIALIZATION = 133, | |
SPELL_EFFECT_KILL_CREDIT_GROUP = 134, | |
diff --git a/src/game/Spell.h b/src/game/Spell.h | |
index 7b1f638..a22a9cf 100644 | |
--- a/src/game/Spell.h | |
+++ b/src/game/Spell.h | |
@@ -347,6 +347,7 @@ class Spell | |
void EffectTeachTaxiNode(SpellEffectIndex eff_idx); | |
void EffectTitanGrip(SpellEffectIndex eff_idx); | |
void EffectEnchantItemPrismatic(SpellEffectIndex eff_idx); | |
+ void EffectPlaySound(SpellEffectIndex eff_idx); | |
void EffectPlayMusic(SpellEffectIndex eff_idx); | |
void EffectSpecCount(SpellEffectIndex eff_idx); | |
void EffectActivateSpec(SpellEffectIndex eff_idx); | |
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp | |
index 74d53ad..69719c6 100644 | |
--- a/src/game/SpellEffects.cpp | |
+++ b/src/game/SpellEffects.cpp | |
@@ -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]; | |
+ uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx]; | |
+ if (!sSoundEntriesStore.LookupEntry(soundId)) | |
+ { | |
+ 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; | |
- 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("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); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment