Core/CreatureTextMgr: Converted chat types to use values found in sniff, without any need for conversions
This commit is contained in:
@@ -170,7 +170,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
else if (IsPlayer((*itr)))
|
||||
{
|
||||
Unit* templastInvoker = GetLastInvoker();
|
||||
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_TYPE_END, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer());
|
||||
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer());
|
||||
}
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
|
||||
(*itr)->GetName(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
|
||||
@@ -206,7 +206,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (IsCreature((*itr)))
|
||||
{
|
||||
sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_TYPE_SAY, 0, TextRange(e.action.sound.range), Team(0), false);
|
||||
sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_MSG_MONSTER_SAY, 0, TextRange(e.action.sound.range), Team(0), false);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: source: %s (GuidLow: %u), sound: %u, range: %u",
|
||||
(*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void CreatureTextMgr::LoadCreatureTexts()
|
||||
temp.group = fields[1].GetUInt8();
|
||||
temp.id = fields[2].GetUInt8();
|
||||
temp.text = fields[3].GetString();
|
||||
temp.type = ChatType(fields[4].GetUInt8());
|
||||
temp.type = ChatMsg(fields[4].GetUInt8());
|
||||
temp.lang = Language(fields[5].GetUInt8());
|
||||
temp.probability = fields[6].GetFloat();
|
||||
temp.emote = Emote(fields[7].GetUInt32());
|
||||
@@ -68,10 +68,10 @@ void CreatureTextMgr::LoadCreatureTexts()
|
||||
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
|
||||
temp.lang = LANG_UNIVERSAL;
|
||||
}
|
||||
if (temp.type >= CHAT_TYPE_ZONE_YELL)//CHAT_TYPE_ZONE_YELL and more will be used later
|
||||
if (temp.type >= MAX_CHAT_MSG_TYPE)
|
||||
{
|
||||
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
|
||||
temp.type = CHAT_TYPE_SAY;
|
||||
temp.type = CHAT_MSG_SAY;
|
||||
}
|
||||
if (temp.emote)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ void CreatureTextMgr::LoadCreatureTexts()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid, ChatType msgtype, Language language, TextRange range, uint32 sound, Team team, bool gmOnly, Player* srcPlr)
|
||||
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
|
||||
{
|
||||
if (!source)
|
||||
return 0;
|
||||
@@ -174,7 +174,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
|
||||
pos = offset;
|
||||
CreatureTextGroup::const_iterator iter = tempGroup.begin() + pos;
|
||||
|
||||
ChatType finalType = (msgtype == CHAT_TYPE_END) ? (*iter).type : msgtype;
|
||||
ChatMsg finalType = (msgType == CHAT_MSG_ADDON) ? (*iter).type : msgType;
|
||||
Language finalLang = (language == LANG_ADDON) ? (*iter).lang : language;
|
||||
uint32 finalSound = sound ? sound : (*iter).sound;
|
||||
|
||||
@@ -191,14 +191,15 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
|
||||
return (*iter).duration;
|
||||
}
|
||||
|
||||
void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly)
|
||||
void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly)
|
||||
{
|
||||
if (!sound || !source)
|
||||
return;
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(sound);
|
||||
SendChatPacket(&data, source, msgtype, whisperGuid, range, team, gmOnly);
|
||||
SendChatPacket(&data, source, msgType, whisperGuid, range, team, gmOnly);
|
||||
}
|
||||
|
||||
void CreatureTextMgr::SendEmote(Unit* source, uint32 emote)
|
||||
{
|
||||
if (!source) return;
|
||||
@@ -245,7 +246,7 @@ CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 te
|
||||
return ids;
|
||||
}
|
||||
|
||||
void CreatureTextMgr::SendChatString(WorldObject* source, char const* text, ChatType msgtype, Language language, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const
|
||||
void CreatureTextMgr::SendChatString(WorldObject* source, char const* text, ChatMsg msgtype /*= CHAT_MSG_MONSTER_SAY*/, Language language /*= LANG_UNIVERSAL*/, uint64 whisperGuid /*= 0*/, TextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const
|
||||
{
|
||||
if (!source)
|
||||
return;
|
||||
@@ -255,52 +256,37 @@ void CreatureTextMgr::SendChatString(WorldObject* source, char const* text, Chat
|
||||
SendChatPacket(&data, source, msgtype, whisperGuid, range, team, gmOnly);//send our packet
|
||||
}
|
||||
|
||||
void CreatureTextMgr::BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatType msgtype, char const* text, Language language, uint64 whisperGuid) const
|
||||
void CreatureTextMgr::BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const
|
||||
{
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
ChatMsg sendType = CHAT_MSG_MONSTER_SAY;
|
||||
switch (msgtype)
|
||||
switch (msgType)
|
||||
{
|
||||
case CHAT_TYPE_YELL:
|
||||
sendType = CHAT_MSG_MONSTER_YELL;
|
||||
break;
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
sendType = CHAT_MSG_MONSTER_EMOTE;
|
||||
break;
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
sendType = CHAT_MSG_RAID_BOSS_EMOTE;
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
if (whisperGuid)
|
||||
sendType = CHAT_MSG_MONSTER_WHISPER;
|
||||
else
|
||||
case CHAT_MSG_MONSTER_WHISPER:
|
||||
if (!whisperGuid)
|
||||
{
|
||||
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case CHAT_TYPE_BOSS_WHISPER:
|
||||
if (whisperGuid)
|
||||
sendType = CHAT_MSG_RAID_BOSS_WHISPER;
|
||||
else
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
if (!whisperGuid)
|
||||
{
|
||||
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_BOSS_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case CHAT_TYPE_SAY://default type
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*data << (uint8)sendType;
|
||||
*data << (uint32)language;
|
||||
*data << (uint64)source->GetGUID();
|
||||
*data << (uint32)0; // 2.1.0
|
||||
*data << (uint32)(strlen(source->GetName())+1);
|
||||
*data << uint8(msgType);
|
||||
*data << uint32(language);
|
||||
*data << uint64(source->GetGUID());
|
||||
*data << uint32(0); // 2.1.0
|
||||
*data << uint32(strlen(source->GetName()) + 1);
|
||||
*data << source->GetName();
|
||||
*data << (uint64)whisperGuid; // Unit Target
|
||||
*data << uint64(whisperGuid); // Unit Target
|
||||
if (whisperGuid && !IS_PLAYER_GUID(whisperGuid)) //can only whisper players
|
||||
{
|
||||
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent WHISPER msg to Non-Player target. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
|
||||
@@ -308,41 +294,40 @@ void CreatureTextMgr::BuildMonsterChat(WorldPacket *data, WorldObject* source, C
|
||||
// *data << (uint32)1; // target name length
|
||||
// *data << (uint8)0; // target name
|
||||
}
|
||||
*data << (uint32)(strlen(text)+1);
|
||||
*data << uint32(strlen(text) + 1);
|
||||
*data << text;
|
||||
*data << (uint8)0; // ChatTag
|
||||
*data << uint8(0); // ChatTag
|
||||
}
|
||||
|
||||
void CreatureTextMgr::SendChatPacket(WorldPacket *data, WorldObject* source, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const
|
||||
void CreatureTextMgr::SendChatPacket(WorldPacket *data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const
|
||||
{
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
float dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY);
|
||||
|
||||
switch (msgtype)
|
||||
switch (msgType)
|
||||
{
|
||||
case CHAT_TYPE_YELL:
|
||||
case CHAT_MSG_YELL:
|
||||
dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL);
|
||||
break;
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
case CHAT_MSG_MONSTER_EMOTE:
|
||||
case CHAT_MSG_RAID_BOSS_EMOTE:
|
||||
dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
case CHAT_TYPE_BOSS_WHISPER:
|
||||
case CHAT_MSG_MONSTER_WHISPER:
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
{
|
||||
if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
|
||||
{
|
||||
if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
|
||||
{
|
||||
Player *player = sObjectMgr->GetPlayer(whisperGuid);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
player->GetSession()->SendPacket(data);
|
||||
Player *player = sObjectMgr->GetPlayer(whisperGuid);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
}
|
||||
player->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case CHAT_TYPE_SAY://default dist
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ struct CreatureTextEntry
|
||||
uint8 group;
|
||||
uint8 id;
|
||||
std::string text;
|
||||
ChatType type;
|
||||
ChatMsg type;
|
||||
Language lang;
|
||||
float probability;
|
||||
Emote emote;
|
||||
@@ -62,18 +62,18 @@ class CreatureTextMgr
|
||||
void LoadCreatureTexts();
|
||||
CreatureTextMap const& GetTextMap() const { return mTextMap; }
|
||||
|
||||
void SendSound(Creature* source, uint32 sound, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly);
|
||||
void SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly);
|
||||
void SendEmote(Unit* source, uint32 emote);
|
||||
|
||||
//if sent, returns the 'duration' of the text else 0 if error
|
||||
uint32 SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid = 0, ChatType msgtype = CHAT_TYPE_END, Language language = LANG_ADDON, TextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
|
||||
void SendChatString(WorldObject* source, char const* text, ChatType msgtype = CHAT_TYPE_SAY, Language language = LANG_UNIVERSAL, uint64 whisperGuid = 0, TextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
|
||||
uint32 SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid = 0, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, TextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
|
||||
void SendChatString(WorldObject* source, char const* text, ChatMsg msgtype = CHAT_MSG_MONSTER_SAY, Language language = LANG_UNIVERSAL, uint64 whisperGuid = 0, TextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
|
||||
bool TextExist(uint32 sourceEntry, uint8 textGroup);
|
||||
private:
|
||||
CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup);
|
||||
void SetRepeatId(Creature* source, uint8 textGroup, uint8 id);
|
||||
void BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatType msgtype, char const* text, Language language, uint64 whisperGuid) const;
|
||||
void SendChatPacket(WorldPacket *data, WorldObject* source, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const;
|
||||
void BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const;
|
||||
void SendChatPacket(WorldPacket *data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const;
|
||||
|
||||
CreatureTextMap mTextMap;
|
||||
CreatureTextRepeatMap mTextRepeatMap;
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
|
||||
if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos))
|
||||
if (!instance->GetPlayers().isEmpty())
|
||||
if (Player* plr = instance->GetPlayers().getFirst()->getSource())
|
||||
sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, plr->GetGUID(), CHAT_TYPE_END, LANG_ADDON, TEXT_RANGE_MAP);
|
||||
sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, plr->GetGUID(), CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
|
||||
}
|
||||
DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user