[7577] Implement YellToZone for different world object types.

This commit is contained in:
VladimirMangos 2009-03-29 01:06:31 +03:00
parent 5dd3ce31bc
commit 24f1cf4b83
8 changed files with 29 additions and 1 deletions

View file

@ -84,6 +84,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; }

View file

@ -528,6 +528,7 @@ class MANGOS_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;

View file

@ -52,6 +52,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; }

View file

@ -448,6 +448,7 @@ class MANGOS_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;

View file

@ -389,6 +389,22 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
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; }

View file

@ -1309,6 +1309,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 = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());

View file

@ -456,6 +456,7 @@ class MANGOS_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);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7576"
#define REVISION_NR "7577"
#endif // __REVISION_NR_H__