diff options
Diffstat (limited to 'src/server/game/Texts/CreatureTextMgr.cpp')
-rw-r--r-- | src/server/game/Texts/CreatureTextMgr.cpp | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 77a886af3e5..9d2c7d6769f 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -15,15 +15,17 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "DatabaseEnv.h" -#include "ObjectMgr.h" -#include "Cell.h" +#include "CreatureTextMgr.h" +#include "CreatureTextMgrImpl.h" #include "CellImpl.h" #include "Chat.h" -#include "GridNotifiers.h" +#include "Common.h" +#include "DatabaseEnv.h" +#include "DBCStores.h" #include "GridNotifiersImpl.h" -#include "CreatureTextMgr.h" +#include "Log.h" +#include "ObjectMgr.h" +#include "World.h" class CreatureTextBuilder { @@ -224,7 +226,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject } CreatureTextGroup const& textGroupContainer = itr->second; //has all texts in the group - CreatureTextRepeatIds repeatGroup = GetRepeatGroup(source, textGroup);//has all textIDs from the group that were already said + CreatureTextRepeatIds repeatGroup = source->GetTextRepeatGroup(textGroup);//has all textIDs from the group that were already said CreatureTextGroup tempGroup;//will use this to talk after sorting repeatGroup for (CreatureTextGroup::const_iterator giter = textGroupContainer.begin(); giter != textGroupContainer.end(); ++giter) @@ -270,7 +272,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly); } - SetRepeatId(source, textGroup, iter->id); + source->SetTextRepeatId(textGroup, iter->id); return iter->duration; } @@ -327,7 +329,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER) return; - whisperTarget->ToPlayer()->GetSession()->SendPacket(data); + whisperTarget->ToPlayer()->SendDirectMessage(data); return; } break; @@ -344,7 +346,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->GetSource()->GetAreaId() == areaId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_ZONE: @@ -353,7 +355,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (itr->GetSource()->GetZoneId() == zoneId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_MAP: @@ -361,7 +363,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, Map::PlayerList const& players = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if ((!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster())) - itr->GetSource()->GetSession()->SendPacket(data); + itr->GetSource()->SendDirectMessage(data); return; } case TEXT_RANGE_WORLD: @@ -369,8 +371,8 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, SessionMap const& smap = sWorld->GetAllSessions(); for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) if (Player* player = iter->second->GetPlayer()) - if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster())) - player->GetSession()->SendPacket(data); + if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster())) + player->SendDirectMessage(data); return; } case TEXT_RANGE_NORMAL: @@ -390,21 +392,6 @@ void CreatureTextMgr::SendEmote(Unit* source, uint32 emote) source->HandleEmoteCommand(emote); } -void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) -{ - if (!source) - return; - - source->SetTextRepeatId(textGroup, id); -} - -CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) -{ - ASSERT(source);//should never happen - - return source->GetTextRepeatGroup(textGroup); -} - bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) { if (!sourceEntry) |