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
@@ -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:
@@ -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);
@@ -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