aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp19
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp5
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h3
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp9
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.h4
5 files changed, 29 insertions, 11 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index b0b061f1044..2933f8b4109 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -143,7 +143,24 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
mTextGUID = IsPlayer(unit)? unit->GetGUID() : NULL;//invoker, used for $vars in texts
mUseTextTimer = true;
sCreatureTextMgr.SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
- return;
+ break;
+ }
+ case SMART_ACTION_SIMPLE_TALK:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (targets)
+ {
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
+ {
+ if (IsCreature((*itr)))
+ {
+ sCreatureTextMgr.SendChat((*itr)->ToCreature(), uint8(e.action.talk.textGroupID));
+ } else if (IsPlayer((*itr)))
+ {
+ sCreatureTextMgr.SendChat(me, uint8(e.action.talk.textGroupID),NULL,CHAT_TYPE_END,LANG_ADDON,TEXT_RANGE_NORMAL,NULL,TEAM_OTHER,false, (*itr)->ToPlayer());
+ }
+ }
+ }
break;
}
case SMART_ACTION_PLAY_EMOTE:
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 50604dcaf35..98ae02677c2 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -488,9 +488,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
switch (e.GetActionType())
{
- case SMART_ACTION_TALK:
- //if (!IsTextValid(e, e.action.talk.textGroupID)) return false;//can use other creatures texts too!
- break;
case SMART_ACTION_SET_FACTION:
if (e.action.faction.factionID && !sFactionStore.LookupEntry(e.action.faction.factionID))
{
@@ -752,6 +749,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_SET_NPC_FLAG:
case SMART_ACTION_ADD_NPC_FLAG:
case SMART_ACTION_REMOVE_NPC_FLAG:
+ case SMART_ACTION_TALK:
+ case SMART_ACTION_SIMPLE_TALK:
break;
default:
sLog.outErrorDb("SmartAIMgr: Not handled action_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index ef007321f58..0d056c7076c 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -430,8 +430,9 @@ enum SMART_ACTION
SMART_ACTION_SET_NPC_FLAG = 81, // Flags
SMART_ACTION_ADD_NPC_FLAG = 82, // Flags
SMART_ACTION_REMOVE_NPC_FLAG = 83, // Flags
+ SMART_ACTION_SIMPLE_TALK = 84, // groupID, can be used to make players say groupID, Text_over event is not triggered, whisper can not be used (Target units will say the text)
- SMART_ACTION_END = 84,
+ SMART_ACTION_END = 85,
};
struct SmartAction
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index a23be060a49..1445e5bed32 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -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);
}
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index f367ea7d3e0..2738c8dff59 100755
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -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: