mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[7518] Implement new script command SCRIPT_COMMAND_PLAY_SOUND (look in World.h for args)
* Also rewrite use SMSG_PLAY_OBJECT_SOUND/SMSG_PLAY_SOUND Now WorldObject have 2 function for sound level dependent from distance (PlayDistanceSound) and for not depednet (PlayDirectSound) * Old Player::PlaySound function removed and uses need to be updated to WorldObject functions Note: function called for _source_ of sound in different from old function. * chat command .debug ps removed and .debug playsound can used for bother packects test: if no selection used SMSG_PLAY_SOUND, if selection exist including self then SMSG_PLAY_OBJECT_SOUND.
This commit is contained in:
parent
b14bf188c5
commit
ab2bdc3e69
13 changed files with 100 additions and 50 deletions
|
|
@ -213,13 +213,41 @@ bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugPlaySound2Command(const char* args)
|
||||
//Play sound
|
||||
bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
// USAGE: .debug playsound #soundid
|
||||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||
if( !*args )
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 soundid = atoi(args);
|
||||
m_session->GetPlayer()->PlaySound(soundid, false);
|
||||
uint32 dwSoundId = atoi((char*)args);
|
||||
|
||||
if(!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
{
|
||||
PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
if(!unit)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_session->GetPlayer()->GetSelection())
|
||||
unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
|
||||
else
|
||||
unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
|
||||
|
||||
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue