diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Corpse.h | 1 | ||||
-rw-r--r-- | src/game/Creature.h | 1 | ||||
-rw-r--r-- | src/game/DynamicObject.h | 1 | ||||
-rw-r--r-- | src/game/GameObject.h | 1 | ||||
-rw-r--r-- | src/game/Map.h | 16 | ||||
-rw-r--r-- | src/game/Object.cpp | 7 | ||||
-rw-r--r-- | src/game/Object.h | 1 |
7 files changed, 28 insertions, 0 deletions
diff --git a/src/game/Corpse.h b/src/game/Corpse.h index 4b0c6e7007c..da3511abfbb 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -86,6 +86,7 @@ class Corpse : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } GridReference<Corpse> &GetGridRef() { return m_gridRef; } private: diff --git a/src/game/Creature.h b/src/game/Creature.h index d733ccd98b7..55923179967 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -553,6 +553,7 @@ class TRINITY_DLL_SPEC Creature : public Unit void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } // overwrite WorldObject function for proper name localization const char* GetNameForLocaleIdx(int32 locale_idx) const; diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index ccf9d47a455..714b639e552 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -54,6 +54,7 @@ class DynamicObject : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } GridReference<DynamicObject> &GetGridRef() { return m_gridRef; } protected: diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 3b08fdf7139..3d2d3c2de57 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -451,6 +451,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); } + void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } // overwrite WorldObject function for proper name localization const char* GetNameForLocaleIdx(int32 locale_idx) const; diff --git a/src/game/Map.h b/src/game/Map.h index 83cb1009669..77ddd7258a3 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -396,6 +396,22 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O void SendToPlayers(WorldPacket const* data) const; + template<class Do> + void BroadcastWorker(Do& _do) const + { + for(MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) + _do(itr->getSource()); + } + + template<class Do> + void BroadcastWorker(Do& _do, uint32 zoneid) const + { + for(MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) + if(itr->getSource()->GetZoneId()==zoneid) + _do(itr->getSource()); + } + + typedef MapRefManager PlayerList; PlayerList const& GetPlayers() const { return m_mapRefManager; } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 03c10e12cfb..2907c043602 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1516,6 +1516,13 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) cell_lock->Visit(cell_lock, message, *GetMap()); } +void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid) +{ + MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid); + MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build); + GetMap()->BroadcastWorker(say_do,GetZoneId()); +} + void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) { CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); diff --git a/src/game/Object.h b/src/game/Object.h index 0609b407dc5..8b8efda6fd4 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -485,6 +485,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object void MonsterYell(int32 textId, uint32 language, uint64 TargetGuid); void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); + void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid); void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; void PlayDistanceSound(uint32 sound_id, Player* target = NULL); |