diff options
author | Neo2003 <none@none> | 2008-10-05 11:38:24 -0500 |
---|---|---|
committer | Neo2003 <none@none> | 2008-10-05 11:38:24 -0500 |
commit | 1fc73ff41b0b113ee0cbc072f8ed81a2c572924c (patch) | |
tree | e2921caa16730e21b3e7988c2bbb1a12f8fce2b1 /src | |
parent | 9245de813869b8c386b651204678d1a1b4d84ea7 (diff) |
[svn] * PlaySound changed to SendPlaySound, moved to WorldObject and used everywhere instead of hard-coding packet
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 5 | ||||
-rw-r--r-- | src/bindings/scripts/include/sc_creature.cpp | 6 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp | 16 | ||||
-rw-r--r-- | src/game/Object.cpp | 10 | ||||
-rw-r--r-- | src/game/Object.h | 3 | ||||
-rw-r--r-- | src/game/Player.cpp | 10 | ||||
-rw-r--r-- | src/game/Player.h | 2 | ||||
-rw-r--r-- | src/game/debugcmds.cpp | 2 |
8 files changed, 24 insertions, 30 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 4dff1b7c374..e382b62e2e3 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1853,10 +1853,7 @@ void ProcessScriptText(uint32 id, WorldObject* pSource, Unit* target) { if(GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) { - WorldPacket data(4); - data.SetOpcode(SMSG_PLAY_SOUND); - data << uint32((*i).second.SoundId); - pSource->SendMessageToSet(&data,false); + pSource->SendPlaySound((*i).second.SoundId, false); } else error_log("TSCR: ProcessScriptText id %u tried to process invalid soundid %u.",id,(*i).second.SoundId); diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 2663f4585b5..9910eafc5b2 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -5,7 +5,6 @@ #include "precompiled.h"
#include "Item.h"
#include "Spell.h"
-#include "WorldPacket.h"
// Spell summary for ScriptedAI::SelectSpell
struct TSpellSummary {
@@ -202,10 +201,7 @@ void ScriptedAI::DoPlaySoundToSet(Unit* unit, uint32 sound) return;
}
- WorldPacket data(4);
- data.SetOpcode(SMSG_PLAY_SOUND);
- data << uint32(sound);
- unit->SendMessageToSet(&data,false);
+ unit->SendPlaySound(sound, false);
}
Creature* ScriptedAI::DoSpawnCreature(uint32 id, float x, float y, float z, float angle, uint32 type, uint32 despawntime)
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp index 17d159451f4..805dc187bbb 100644 --- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp @@ -583,14 +583,14 @@ struct MANGOS_DLL_DECL cthunAI : public Scripted_NoMovementAI //Play random sound to the zone
switch (rand()%8)
{
- case 0: (*i)->PlaySound(RND_WISPER_1, true); break;
- case 1: (*i)->PlaySound(RND_WISPER_2, true); break;
- case 2: (*i)->PlaySound(RND_WISPER_3, true); break;
- case 3: (*i)->PlaySound(RND_WISPER_4, true); break;
- case 4: (*i)->PlaySound(RND_WISPER_5, true); break;
- case 5: (*i)->PlaySound(RND_WISPER_6, true); break;
- case 6: (*i)->PlaySound(RND_WISPER_7, true); break;
- case 7: (*i)->PlaySound(RND_WISPER_8, true); break;
+ case 0: (*i)->SendPlaySound(RND_WISPER_1, true); break;
+ case 1: (*i)->SendPlaySound(RND_WISPER_2, true); break;
+ case 2: (*i)->SendPlaySound(RND_WISPER_3, true); break;
+ case 3: (*i)->SendPlaySound(RND_WISPER_4, true); break;
+ case 4: (*i)->SendPlaySound(RND_WISPER_5, true); break;
+ case 5: (*i)->SendPlaySound(RND_WISPER_6, true); break;
+ case 6: (*i)->SendPlaySound(RND_WISPER_7, true); break;
+ case 7: (*i)->SendPlaySound(RND_WISPER_8, true); break;
}
}
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index b3e61e102d3..fd6411afc07 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1166,6 +1166,16 @@ void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossW player->GetSession()->SendPacket(&data); } +void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) +{ + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << Sound; + if (OnlySelf && GetTypeId() == TYPEID_PLAYER ) + ((Player*)this)->GetSession()->SendPacket( &data ); + else + SendMessageToSet( &data, true ); // ToSelf ignored in this case +} + namespace MaNGOS { class MessageChatLocaleCacheDo diff --git a/src/game/Object.h b/src/game/Object.h index c870e9452c9..f8b18941aa3 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -437,6 +437,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object // low level function for visibility change code, must be define in all main world object subclasses virtual bool isVisibleForInState(Player const* u, bool inVisibleList) const = 0; + // Low Level Packets + void SendPlaySound(uint32 Sound, bool OnlySelf); + Map * GetMap() const; Map const* GetBaseMap() const; Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ff0e032b0e7..1d032265a80 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15380,16 +15380,6 @@ void Player::SendAutoRepeatCancel() GetSession()->SendPacket( &data );
}
-void Player::PlaySound(uint32 Sound, bool OnlySelf)
-{
- WorldPacket data(SMSG_PLAY_SOUND, 4);
- data << Sound;
- if (OnlySelf)
- GetSession()->SendPacket( &data );
- else
- SendMessageToSet( &data, true );
-}
-
void Player::SendExplorationExperience(uint32 Area, uint32 Experience)
{
WorldPacket data( SMSG_EXPLORATION_EXPERIENCE, 8 );
diff --git a/src/game/Player.h b/src/game/Player.h index c809c63453c..9a4362c04ba 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1592,8 +1592,6 @@ class MANGOS_DLL_SPEC Player : public Unit void SendDelayResponse(const uint32);
void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP);
- //Low Level Packets
- void PlaySound(uint32 Sound, bool OnlySelf);
//notifiers
void SendAttackSwingCantAttack();
void SendAttackSwingCancelAttack();
diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index deb044be7b3..555ddc84d1f 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -216,7 +216,7 @@ bool ChatHandler::HandlePlaySound2Command(const char* args) return false; uint32 soundid = atoi(args); - m_session->GetPlayer()->PlaySound(soundid, false); + m_session->GetPlayer()->SendPlaySound(soundid, false); return true; } |