mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
fix/feat: (Core/PacketIO): updated sound and creature addon (#10813)
* fix\feat: (Core/PacketIO): updated sound and creature addon
updated SMSG_PLAY_SOUND, SMSG_PLAY_MUSIC and SMSG_PLAY_OBJECT_SOUND via tc cherry pick
https://github.com/TrinityCore/TrinityCore/pull/2363 and 0f1f7ef401 by @joschiwald and @ForesterDev
This so far a attempt to align atleast with sound with tc, and correct a potentional issue of hearing creature sounds that is not in visible range. I notice PlaySound was being defined in some weird dependency as it isnt with tc so I renamed it to Playsound. Notice a isLarge still being used in the creature addon when it was depreciated, so i removed that a that seem to of interfered with visibilitydistanceType.
Co-Authored-By: joschiwald <736792+joschiwald@users.noreply.github.com>
Co-Authored-By: ForesterDev <11771800+ForesterDev@users.noreply.github.com>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "GroupMgr.h"
|
||||
#include "Map.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Transport.h"
|
||||
@@ -374,14 +375,7 @@ void Battlefield::EndBattle(bool endByTimer)
|
||||
|
||||
void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
||||
{
|
||||
WorldPacket data;
|
||||
data.Initialize(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(SoundID);
|
||||
|
||||
for (int team = 0; team < PVP_TEAMS_COUNT; team++)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
BroadcastPacketToWar(WorldPackets::Misc::Playsound(SoundID).Write());
|
||||
}
|
||||
|
||||
bool Battlefield::HasPlayer(Player* player) const
|
||||
@@ -447,42 +441,34 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
}
|
||||
}
|
||||
|
||||
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
||||
void Battlefield::BroadcastPacketToZone(WorldPacket const* data) const
|
||||
{
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||
void Battlefield::BroadcastPacketToQueue(WorldPacket const* data) const
|
||||
{
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
|
||||
void Battlefield::BroadcastPacketToWar(WorldPacket const* data) const
|
||||
{
|
||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
||||
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToAllInZone(uint32 entry)
|
||||
void Battlefield::SendWarning(uint8 id, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
if (Creature* stalker = GetCreature(StalkerGuid))
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
|
||||
}
|
||||
|
||||
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||
{
|
||||
if (player)
|
||||
if (Unit* unit = ObjectAccessor::GetCreature(*player, StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player);
|
||||
sCreatureTextMgr->SendChat(stalker, id, target);
|
||||
}
|
||||
|
||||
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
|
||||
@@ -323,8 +323,7 @@ public:
|
||||
/// Called when a player enter in battlefield zone
|
||||
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||
|
||||
void SendWarningToAllInZone(uint32 entry);
|
||||
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||
void SendWarning(uint8 id, WorldObject const* target = nullptr);
|
||||
|
||||
void PlayerAcceptInviteToQueue(Player* player);
|
||||
void PlayerAcceptInviteToWar(Player* player);
|
||||
@@ -414,9 +413,9 @@ protected:
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
void BroadcastPacketToZone(WorldPacket const* data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket const* data) const;
|
||||
void BroadcastPacketToWar(WorldPacket const* data) const;
|
||||
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints.push_back(cp); }
|
||||
|
||||
@@ -278,7 +278,7 @@ void BattlefieldWG::OnBattleStart()
|
||||
// Initialize vehicle counter
|
||||
UpdateCounterVehicle(true);
|
||||
// Send start warning to all players
|
||||
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
|
||||
SendWarning(BATTLEFIELD_WG_TEXT_START);
|
||||
|
||||
// Xinef: reset tenacity counter
|
||||
m_tenacityStack = 0;
|
||||
@@ -476,9 +476,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
m_PlayersInWar[TEAM_HORDE].clear();
|
||||
|
||||
if (!endByTimer) // win alli/horde
|
||||
SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : (BATTLEFIELD_WG_TEXT_WIN_KEEP + 2));
|
||||
SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : (BATTLEFIELD_WG_TEXT_WIN_KEEP + 2));
|
||||
else // defend alli/horde
|
||||
SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : (BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 2));
|
||||
SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : (BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 2));
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
@@ -488,7 +488,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
void BattlefieldWG::OnStartGrouping()
|
||||
{
|
||||
if (!IsWarTime())
|
||||
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
|
||||
SendWarning(BATTLEFIELD_WG_TEXT_WILL_START);
|
||||
}
|
||||
|
||||
uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
|
||||
@@ -757,7 +757,7 @@ void BattlefieldWG::PromotePlayer(Player* killer)
|
||||
{
|
||||
killer->RemoveAura(SPELL_RECRUIT);
|
||||
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
||||
SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
|
||||
SendWarning(BATTLEFIELD_WG_TEXT_FIRSTRANK, killer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -770,7 +770,7 @@ void BattlefieldWG::PromotePlayer(Player* killer)
|
||||
{
|
||||
killer->RemoveAura(SPELL_CORPORAL);
|
||||
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
||||
SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
|
||||
SendWarning(BATTLEFIELD_WG_TEXT_SECONDRANK, killer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1170,7 +1170,7 @@ struct BfWGGameObjectBuilding
|
||||
|
||||
// Send warning message
|
||||
if (m_damagedText) // tower damage + name
|
||||
m_WG->SendWarningToAllInZone(m_damagedText);
|
||||
m_WG->SendWarning(m_damagedText);
|
||||
|
||||
for (GuidUnorderedSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
|
||||
if (Creature* creature = m_WG->GetCreature(*itr))
|
||||
@@ -1193,7 +1193,7 @@ struct BfWGGameObjectBuilding
|
||||
|
||||
// Warn players
|
||||
if (m_destroyedText)
|
||||
m_WG->SendWarningToAllInZone(m_destroyedText);
|
||||
m_WG->SendWarning(m_destroyedText);
|
||||
|
||||
switch (m_Type)
|
||||
{
|
||||
@@ -1467,7 +1467,7 @@ struct WGWorkshop
|
||||
{
|
||||
// Send warning message to all player to inform a faction attack to a workshop
|
||||
// alliance / horde attacking a workshop
|
||||
bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
bf->SendWarning(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
break;
|
||||
}
|
||||
case TEAM_ALLIANCE:
|
||||
@@ -1479,7 +1479,7 @@ struct WGWorkshop
|
||||
|
||||
// Warning message
|
||||
if (!init) // workshop taken - alliance
|
||||
bf->SendWarningToAllInZone(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
bf->SendWarning(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
@@ -673,9 +674,7 @@ void Battleground::SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject con
|
||||
|
||||
void Battleground::PlaySoundToAll(uint32 soundID)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildPlaySoundPacket(&data, soundID);
|
||||
SendPacketToAll(&data);
|
||||
SendPacketToAll(WorldPackets::Misc::Playsound(soundID).Write());
|
||||
}
|
||||
|
||||
void Battleground::CastSpellOnTeam(uint32 spellId, TeamId teamId)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "GameTime.h"
|
||||
#include "Map.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
@@ -212,12 +213,6 @@ void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Grou
|
||||
*data << uint64(0); // player guid
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
|
||||
{
|
||||
data->Initialize(SMSG_PLAY_SOUND, 4);
|
||||
*data << uint32(soundid);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid)
|
||||
{
|
||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
||||
|
||||
@@ -68,7 +68,6 @@ public:
|
||||
void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
|
||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated = false, BattlegroundTypeId forceBgTypeId = BATTLEGROUND_TYPE_NONE);
|
||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
|
||||
|
||||
/* Battlegrounds */
|
||||
|
||||
@@ -2563,12 +2563,6 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 3, 0);
|
||||
}
|
||||
|
||||
// Check if Creature is Large
|
||||
if (cainfo->isLarge)
|
||||
{
|
||||
SetVisibilityDistanceOverride(cainfo->visibilityDistanceType);
|
||||
}
|
||||
|
||||
SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote);
|
||||
|
||||
// Check if visibility distance different
|
||||
|
||||
@@ -433,7 +433,6 @@ struct CreatureAddon
|
||||
uint32 bytes1;
|
||||
uint32 bytes2;
|
||||
uint32 emote;
|
||||
bool isLarge;
|
||||
std::vector<uint32> auras;
|
||||
VisibilityDistanceType visibilityDistanceType;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "GridNotifiers.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "MovementPacketBuilder.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -2809,36 +2810,29 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
|
||||
void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= nullptr*/)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 4 + 8);
|
||||
data << uint32(sound_id);
|
||||
data << GetGUID();
|
||||
if (target)
|
||||
target->SendDirectMessage(&data);
|
||||
target->SendDirectMessage(WorldPackets::Misc::PlayObjectSound(GetGUID(), sound_id).Write());
|
||||
else
|
||||
SendMessageToSet(&data, true);
|
||||
SendMessageToSet(WorldPackets::Misc::PlayObjectSound(GetGUID(), sound_id).Write(), true);
|
||||
}
|
||||
|
||||
void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= nullptr*/)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(sound_id);
|
||||
if (target)
|
||||
target->SendDirectMessage(&data);
|
||||
target->SendDirectMessage(WorldPackets::Misc::Playsound(sound_id).Write());
|
||||
else
|
||||
SendMessageToSet(&data, true);
|
||||
SendMessageToSet(WorldPackets::Misc::Playsound(sound_id).Write(), true);
|
||||
}
|
||||
|
||||
void WorldObject::PlayDirectMusic(uint32 music_id, Player* target /*= nullptr*/)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(music_id);
|
||||
if (target)
|
||||
{
|
||||
target->SendDirectMessage(&data);
|
||||
target->SendDirectMessage(WorldPackets::Misc::PlayMusic(music_id).Write());
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToSet(&data, true);
|
||||
SendMessageToSet(WorldPackets::Misc::PlayMusic(music_id).Write(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ enum eScriptFlags
|
||||
SF_CASTSPELL_SEARCH_CREATURE = 4,
|
||||
SF_CASTSPELL_TRIGGERED = 0x1,
|
||||
|
||||
// PlaySound flags
|
||||
// Playsound flags
|
||||
SF_PLAYSOUND_TARGET_PLAYER = 0x1,
|
||||
SF_PLAYSOUND_DISTANCE_SOUND = 0x2,
|
||||
|
||||
@@ -309,7 +309,7 @@ struct ScriptInfo
|
||||
{
|
||||
uint32 SoundID; // datalong
|
||||
uint32 Flags; // datalong2
|
||||
} PlaySound;
|
||||
} Playsound;
|
||||
|
||||
struct // SCRIPT_COMMAND_CREATE_ITEM (17)
|
||||
{
|
||||
|
||||
@@ -3655,11 +3655,7 @@ void Map::SendZoneDynamicInfo(Player* player)
|
||||
return;
|
||||
|
||||
if (uint32 music = itr->second.MusicId)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(music);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
player->SendDirectMessage(WorldPackets::Misc::PlayMusic(music).Write());
|
||||
|
||||
if (WeatherState weatherId = itr->second.WeatherId)
|
||||
{
|
||||
@@ -3702,13 +3698,13 @@ void Map::SetZoneMusic(uint32 zoneId, uint32 musicId)
|
||||
Map::PlayerList const& players = GetPlayers();
|
||||
if (!players.IsEmpty())
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(musicId);
|
||||
WorldPackets::Misc::PlayMusic playMusic(musicId);
|
||||
playMusic.Write();
|
||||
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (Player* player = itr->GetSource())
|
||||
if (player->GetZoneId() == zoneId)
|
||||
player->SendDirectMessage(&data);
|
||||
player->SendDirectMessage(playMusic.GetRawPacket());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -721,9 +721,9 @@ void Map::ScriptsProcess()
|
||||
// Source must be WorldObject.
|
||||
if (WorldObject* object = _GetScriptWorldObject(source, true, step.script))
|
||||
{
|
||||
// PlaySound.Flags bitmask: 0/1=anyone/target
|
||||
// Playsound.Flags bitmask: 0/1=anyone/target
|
||||
Player* player = nullptr;
|
||||
if (step.script->PlaySound.Flags & SF_PLAYSOUND_TARGET_PLAYER)
|
||||
if (step.script->Playsound.Flags & SF_PLAYSOUND_TARGET_PLAYER)
|
||||
{
|
||||
// Target must be Player.
|
||||
player = _GetScriptPlayer(target, false, step.script);
|
||||
@@ -731,11 +731,11 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
}
|
||||
|
||||
// PlaySound.Flags bitmask: 0/2=without/with distance dependent
|
||||
if (step.script->PlaySound.Flags & SF_PLAYSOUND_DISTANCE_SOUND)
|
||||
object->PlayDistanceSound(step.script->PlaySound.SoundID, player);
|
||||
// Playsound.Flags bitmask: 0/2=without/with distance dependent
|
||||
if (step.script->Playsound.Flags & SF_PLAYSOUND_DISTANCE_SOUND)
|
||||
object->PlayDistanceSound(step.script->Playsound.SoundID, player);
|
||||
else
|
||||
object->PlayDirectSound(step.script->PlaySound.SoundID, player);
|
||||
object->PlayDirectSound(step.script->Playsound.SoundID, player);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -31,6 +31,28 @@ WorldPacket const* WorldPackets::Misc::Weather::Write()
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PlayMusic::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PlayObjectSound::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
_worldPacket << SourceObjectGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::Playsound::Write()
|
||||
{
|
||||
_worldPacket << SoundKitID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::RandomRollClient::Read()
|
||||
{
|
||||
_worldPacket >> Min;
|
||||
|
||||
@@ -41,6 +41,42 @@ namespace WorldPackets
|
||||
WeatherState WeatherID = WeatherState(0);
|
||||
};
|
||||
|
||||
class AC_GAME_API PlayMusic final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayMusic() : ServerPacket(SMSG_PLAY_MUSIC, 4) { }
|
||||
PlayMusic(uint32 soundKitID) : ServerPacket(SMSG_PLAY_MUSIC, 4), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SoundKitID = 0;
|
||||
};
|
||||
|
||||
class AC_GAME_API PlayObjectSound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PlayObjectSound() : ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8) { }
|
||||
PlayObjectSound(ObjectGuid const& sourceObjectGUID, uint32 soundKitID)
|
||||
: ServerPacket(SMSG_PLAY_OBJECT_SOUND, 4 + 8), SourceObjectGUID(sourceObjectGUID), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid SourceObjectGUID;
|
||||
uint32 SoundKitID = 0;
|
||||
|
||||
};
|
||||
|
||||
class AC_GAME_API Playsound final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
Playsound() : ServerPacket(SMSG_PLAY_SOUND, 4) { }
|
||||
Playsound(uint32 soundKitID) : ServerPacket(SMSG_PLAY_SOUND, 4), SoundKitID(soundKitID) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SoundKitID = 0;
|
||||
};
|
||||
|
||||
class RandomRollClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -6265,9 +6266,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(soundid);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
unitTarget->ToPlayer()->SendDirectMessage(WorldPackets::Misc::PlayMusic(soundid).Write());
|
||||
}
|
||||
|
||||
void Spell::EffectSpecCount(SpellEffIndex /*effIndex*/)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
class CreatureTextBuilder
|
||||
@@ -331,12 +332,10 @@ void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType,
|
||||
if (!sound || !source)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(sound);
|
||||
SendNonChatPacket(source, &data, msgType, target, range, teamId, gmOnly);
|
||||
SendNonChatPacket(source, WorldPackets::Misc::Playsound(sound).Write(), msgType, target, range, teamId, gmOnly);
|
||||
}
|
||||
|
||||
void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, WorldObject const* target, CreatureTextRange range, TeamId teamId, bool gmOnly) const
|
||||
void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* data, ChatMsg msgType, WorldObject const* target, CreatureTextRange range, TeamId teamId, bool gmOnly) const
|
||||
{
|
||||
float dist = GetRangeForChatType(msgType);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ private:
|
||||
CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup);
|
||||
void SetRepeatId(Creature* source, uint8 textGroup, uint8 id);
|
||||
|
||||
void SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, WorldObject const* target, CreatureTextRange range, TeamId teamId, bool gmOnly) const;
|
||||
void SendNonChatPacket(WorldObject* source, WorldPacket const* data, ChatMsg msgType, WorldObject const* target, CreatureTextRange range, TeamId teamId, bool gmOnly) const;
|
||||
float GetRangeForChatType(ChatMsg msgType) const;
|
||||
|
||||
CreatureTextMap mTextMap;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "LFG.h"
|
||||
#include "Language.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "MovementGenerator.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -2891,9 +2892,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId);
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
sWorld->SendGlobalMessage(WorldPackets::Misc::Playsound(soundId).Write());
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
|
||||
return true;
|
||||
|
||||
@@ -1932,10 +1932,10 @@ public:
|
||||
else
|
||||
return;
|
||||
|
||||
PlaySound(soundId);
|
||||
Playsound(soundId);
|
||||
}
|
||||
|
||||
void PlaySound(uint32 soundId)
|
||||
void Playsound(uint32 soundId)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId);
|
||||
@@ -2046,10 +2046,10 @@ public:
|
||||
else
|
||||
return;
|
||||
|
||||
PlaySound(soundId);
|
||||
Playsound(soundId);
|
||||
}
|
||||
|
||||
void PlaySound(uint32 soundId)
|
||||
void Playsound(uint32 soundId)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId);
|
||||
@@ -2080,7 +2080,7 @@ public:
|
||||
NextStep(2000);
|
||||
break;
|
||||
case 2:
|
||||
PlaySound(GAR_2);
|
||||
Playsound(GAR_2);
|
||||
NextStep(6500);
|
||||
break;
|
||||
case 3:
|
||||
@@ -2092,7 +2092,7 @@ public:
|
||||
NextStep(2500);
|
||||
break;
|
||||
case 5:
|
||||
PlaySound(YS_V1_2);
|
||||
Playsound(YS_V1_2);
|
||||
NextStep(2500);
|
||||
break;
|
||||
case 6:
|
||||
@@ -2166,10 +2166,10 @@ public:
|
||||
else
|
||||
return;
|
||||
|
||||
PlaySound(soundId);
|
||||
Playsound(soundId);
|
||||
}
|
||||
|
||||
void PlaySound(uint32 soundId)
|
||||
void Playsound(uint32 soundId)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId);
|
||||
|
||||
Reference in New Issue
Block a user