Core/SmartAI: added SMART_ACTION_SIMPLE_TALK, param1: textID, uses the 'Targets' to say the text,

NOTE: textID is relative to the current target's entry OR if target is a player, text is used with source creature's entry

--HG--
branch : trunk
This commit is contained in:
Rat
2010-11-05 19:38:43 +01:00
parent 7956bc8c44
commit be25e38144
5 changed files with 29 additions and 11 deletions
+5 -4
View File
@@ -108,7 +108,7 @@ void CreatureTextMgr::LoadCreatureTexts()
sLog.outString(">> Loaded %u Creature Texts for %u Creatures.", TextCount, CreatureCount);
}
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid, ChatType msgtype, Language language, TextRange range, uint32 sound, Team team, bool gmOnly)
uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid, ChatType msgtype, Language language, TextRange range, uint32 sound, Team team, bool gmOnly, Player* srcPlr)
{
if (!source)
return 0;
@@ -186,9 +186,9 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
SendSound(source, finalSound, finalType, whisperGuid, range, team, gmOnly);
if ((*iter).emote)
SendEmote(source, (*iter).emote);
SendEmote(srcPlr ? srcPlr->ToUnit() : source, (*iter).emote);
SendChatString(source, (*iter).text.c_str(), finalType, finalLang, whisperGuid, range, team, gmOnly);
SendChatString(srcPlr ? srcPlr->ToUnit() : source, (*iter).text.c_str(), finalType, finalLang, whisperGuid, range, team, gmOnly);
if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f))
SetRepeatId(source, textGroup, (*iter).id);
@@ -203,8 +203,9 @@ void CreatureTextMgr::SendSound(Creature* source,uint32 sound, ChatType msgtype,
data << uint32(sound);
SendChatPacket(&data, source, msgtype, whisperGuid, range, team, gmOnly);
}
void CreatureTextMgr::SendEmote(Creature* source, uint32 emote)
void CreatureTextMgr::SendEmote(Unit* source, uint32 emote)
{
if (!source) return;
source->HandleEmoteCommand(emote);
}
+2 -2
View File
@@ -63,10 +63,10 @@ class CreatureTextMgr
CreatureTextMap const& GetTextMap() const { return mTextMap; }
void SendSound(Creature* source,uint32 sound, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly);
void SendEmote(Creature* source, uint32 emote);
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);
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;
bool TextExist(uint32 sourceEntry, uint8 textGroup);
private: