mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
[svn] * PlaySound changed to SendPlaySound, moved to WorldObject and used everywhere instead of hard-coding packet
--HG-- branch : trunk
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user