diff options
| author | joschiwald <joschiwald.trinity@gmail.com> | 2014-09-13 20:41:31 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-09-13 20:41:31 +0200 |
| commit | 59baaeec48fdd92d8b4067152772e5806be9ff53 (patch) | |
| tree | b4031184f1e16cfb9f87b8c8f5ec5ba5c7ba1f70 /src/server/game/Entities/Object | |
| parent | 11bb300c6977f32d5240a698a12e258dc121a513 (diff) | |
Core/Chat: cleanup MonsterText methods
Diffstat (limited to 'src/server/game/Entities/Object')
| -rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 167 | ||||
| -rw-r--r-- | src/server/game/Entities/Object/Object.h | 12 |
2 files changed, 0 insertions, 179 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 1f3c9a2e8c7..e402836f4c2 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1879,16 +1879,6 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const return true; } -void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) -{ - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << Sound; - if (OnlySelf && GetTypeId() == TYPEID_PLAYER) - this->ToPlayer()->GetSession()->SendPacket(&data); - else - SendMessageToSet(&data, true); // ToSelf ignored in this case -} - void Object::ForceValuesUpdateAtIndex(uint32 i) { _changesMask.SetBit(i); @@ -1899,163 +1889,6 @@ void Object::ForceValuesUpdateAtIndex(uint32 i) } } -namespace Trinity -{ - class MonsterChatBuilder - { - public: - MonsterChatBuilder(WorldObject const* obj, ChatMsg msgtype, int32 textId, uint32 language, WorldObject const* target) - : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(Language(language)), i_target(target) { } - void operator()(WorldPacket& data, LocaleConstant loc_idx) - { - if (BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(i_textId)) - { - uint8 gender = GENDER_MALE; - if (Unit const* unit = i_object->ToUnit()) - gender = unit->getGender(); - - std::string text = broadcastText->GetText(loc_idx, gender); - ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx); - } - else - TC_LOG_ERROR("entities.unit", "MonsterChatBuilder: `broadcast_text` id %i missing", i_textId); - } - - private: - WorldObject const* i_object; - ChatMsg i_msgtype; - int32 i_textId; - Language i_language; - WorldObject const* i_target; - }; - - class MonsterCustomChatBuilder - { - public: - MonsterCustomChatBuilder(WorldObject const* obj, ChatMsg msgtype, const char* text, uint32 language, WorldObject const* target) - : i_object(obj), i_msgtype(msgtype), i_text(text), i_language(Language(language)), i_target(target) - {} - void operator()(WorldPacket& data, LocaleConstant loc_idx) - { - ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, i_text, 0, "", loc_idx); - } - - private: - WorldObject const* i_object; - ChatMsg i_msgtype; - const char* i_text; - Language i_language; - WorldObject const* i_target; - }; -} // namespace Trinity - -void WorldObject::MonsterSay(const char* text, uint32 language, WorldObject const* target) -{ - CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); - - Cell cell(p); - cell.SetNoCreate(); - - Trinity::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, text, language, target); - Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do); - TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); -} - -void WorldObject::MonsterSay(int32 textId, uint32 language, WorldObject const* target) -{ - CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); - - Cell cell(p); - cell.SetNoCreate(); - - Trinity::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, textId, language, target); - Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do); - TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); -} - -void WorldObject::MonsterYell(const char* text, uint32 language, WorldObject const* target) -{ - CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); - - Cell cell(p); - cell.SetNoCreate(); - - Trinity::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, text, language, target); - Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do); - TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL)); -} - -void WorldObject::MonsterYell(int32 textId, uint32 language, WorldObject const* target) -{ - CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); - - Cell cell(p); - cell.SetNoCreate(); - - Trinity::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, textId, language, target); - Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do); - TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL)); -} - -void WorldObject::MonsterTextEmote(const char* text, WorldObject const* target, bool IsBossEmote) -{ - WorldPacket data; - ChatHandler::BuildChatPacket(data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, - this, target, text); - SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true); -} - -void WorldObject::MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote) -{ - CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY()); - - Cell cell(p); - cell.SetNoCreate(); - - Trinity::MonsterChatBuilder say_build(this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, target); - Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), say_do); - TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); -} - -void WorldObject::MonsterWhisper(const char* text, Player const* target, bool IsBossWhisper) -{ - if (!target) - return; - - LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex(); - WorldPacket data; - ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text, 0, "", loc_idx); - target->GetSession()->SendPacket(&data); -} - -void WorldObject::MonsterWhisper(int32 textId, Player const* target, bool IsBossWhisper) -{ - if (!target) - return; - - uint8 gender = GENDER_MALE; - if (Unit const* unit = ToUnit()) - gender = unit->getGender(); - - LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex(); - BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(textId); - std::string text = broadcastText->GetText(loc_idx, gender); - WorldPacket data; - ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text.c_str(), 0, "", loc_idx); - - target->GetSession()->SendPacket(&data); -} - void Unit::BuildHeartBeatMsg(WorldPacket* data) const { data->Initialize(MSG_MOVE_HEARTBEAT, 32); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 85381c1dfd9..652a4d4b71f 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -652,15 +652,6 @@ class WorldObject : public Object, public WorldLocation virtual uint8 getLevelForTarget(WorldObject const* /*target*/) const { return 1; } - void MonsterSay(const char* text, uint32 language, WorldObject const* target); - void MonsterYell(const char* text, uint32 language, WorldObject const* target); - void MonsterTextEmote(const char* text, WorldObject const* target, bool IsBossEmote = false); - void MonsterWhisper(const char* text, Player const* target, bool IsBossWhisper = false); - void MonsterSay(int32 textId, uint32 language, WorldObject const* target); - void MonsterYell(int32 textId, uint32 language, WorldObject const* target); - void MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote = false); - void MonsterWhisper(int32 textId, Player const* target, bool IsBossWhisper = false); - void PlayDistanceSound(uint32 sound_id, Player* target = NULL); void PlayDirectSound(uint32 sound_id, Player* target = NULL); @@ -683,9 +674,6 @@ class WorldObject : public Object, public WorldLocation FlaggedValuesArray32<int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES> m_serverSideVisibility; FlaggedValuesArray32<int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES> m_serverSideVisibilityDetect; - // Low Level Packets - void SendPlaySound(uint32 Sound, bool OnlySelf); - virtual void SetMap(Map* map); virtual void ResetMap(); Map* GetMap() const { ASSERT(m_currMap); return m_currMap; } |
