aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Texts/CreatureTextMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Texts/CreatureTextMgr.cpp')
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 6da4f6fdade..1cff81c171d 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -24,7 +24,6 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CreatureTextMgr.h"
-#include "Group.h"
class CreatureTextBuilder
{
@@ -91,7 +90,6 @@ void CreatureTextMgr::LoadCreatureTexts()
}
uint32 textCount = 0;
- uint32 creatureCount = 0;
do
{
@@ -109,25 +107,26 @@ void CreatureTextMgr::LoadCreatureTexts()
temp.duration = fields[8].GetUInt32();
temp.sound = fields[9].GetUInt32();
temp.BroadcastTextId = fields[10].GetUInt32();
+ temp.TextRange = CreatureTextRange(fields[11].GetUInt8());
if (temp.sound)
{
if (!sSoundEntriesStore.LookupEntry(temp.sound))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if (!GetLanguageDescByID(temp.lang))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
@@ -135,7 +134,7 @@ void CreatureTextMgr::LoadCreatureTexts()
{
if (!sEmotesStore.LookupEntry(temp.emote))
{
- TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
@@ -149,9 +148,11 @@ void CreatureTextMgr::LoadCreatureTexts()
}
}
- // entry not yet added, add empty TextHolder (list of groups)
- if (mTextMap.find(temp.entry) == mTextMap.end())
- ++creatureCount;
+ if (temp.TextRange > TEXT_RANGE_WORLD)
+ {
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);
+ temp.TextRange = TEXT_RANGE_NORMAL;
+ }
// add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
@@ -160,7 +161,7 @@ void CreatureTextMgr::LoadCreatureTexts()
}
while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for " SZFMTD " creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));
}
void CreatureTextMgr::LoadCreatureTextLocales()
@@ -193,7 +194,7 @@ void CreatureTextMgr::LoadCreatureTextLocales()
}
-uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= NULL*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
+uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= nullptr*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= nullptr*/)
{
if (!source)
return 0;
@@ -274,6 +275,9 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
Language finalLang = (language == LANG_ADDON) ? iter->lang : language;
uint32 finalSound = sound ? sound : iter->sound;
+ if (range == TEXT_RANGE_NORMAL)
+ range = iter->TextRange;
+
if (finalSound)
SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly);
@@ -335,6 +339,18 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
{
switch (msgType)
{
+ case CHAT_MSG_MONSTER_PARTY:
+ {
+ if (!whisperTarget)
+ return;
+
+ if (Player const* whisperPlayer = whisperTarget->ToPlayer())
+ {
+ if (Group const* group = whisperPlayer->GetGroup())
+ group->BroadcastWorker([data](Player* player) { player->SendDirectMessage(data); });
+ }
+ return;
+ }
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
{
@@ -348,18 +364,6 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
}
break;
}
- case CHAT_MSG_MONSTER_PARTY:
- if (!whisperTarget)
- return;
-
- if (Player const* player = whisperTarget->ToPlayer())
- {
- if (Group* group = const_cast<Group*>(player->GetGroup()))
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* member = itr->GetSource())
- member->GetSession()->SendPacket(data);
- }
- return;
default:
break;
}