aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp23
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h9
3 files changed, 31 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 7bd2e6357ad..10bed1a0709 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1113,6 +1113,29 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
(*itr)->ToUnit()->RemoveFlag(UNIT_NPC_FLAGS, e.action.unitFlag.flag);
break;
}
+ case SMART_ACTION_CROSS_CAST:
+ {
+ ObjectList* casters = GetTargets(CreateEvent(SMART_EVENT_UPDATE_IC,0,0,0,0,0,SMART_ACTION_NONE,0,0,0,0,0,0,(SMARTAI_TARGETS)e.action.cast.targetType,e.action.cast.targetParam1,e.action.cast.targetParam2,e.action.cast.targetParam3,0), unit);
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets || !casters) return;
+ for (ObjectList::const_iterator itr = casters->begin(); itr != casters->end(); itr++)
+ {
+ if (IsUnit((*itr)))
+ {
+ if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
+ (*itr)->ToUnit()->InterruptNonMeleeSpells(false);
+
+ for (ObjectList::const_iterator it = targets->begin(); it != targets->end(); it++)
+ {
+ if (IsUnit((*it)))
+ {
+ (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell,(e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
+ }
+ }
+ }
+ }
+ break;
+ }
default:
sLog.outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index cf2a4d8c340..037ca5ceeac 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -753,6 +753,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_REMOVE_NPC_FLAG:
case SMART_ACTION_TALK:
case SMART_ACTION_SIMPLE_TALK:
+ case SMART_ACTION_CROSS_CAST:
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 eade255a1f5..0af6e4997d3 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -432,8 +432,9 @@ enum SMART_ACTION
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_INVOKER_CAST = 85, // spellID, castFlags, if avaliable, last used invoker will cast spellId with castFlags on targets
-
- SMART_ACTION_END = 86,
+ SMART_ACTION_CROSS_CAST = 86, // spellID, castFlags, CasterTargetType, CasterTarget param1, CasterTarget param2, CasterTarget param3, ( + the origonal target fields as Destination target), CasterTargets will cast spellID on all Targets (use with caution if targeting multiple * multiple units)
+
+ SMART_ACTION_END = 87,
};
struct SmartAction
@@ -495,6 +496,10 @@ struct SmartAction
{
uint32 spell;
uint32 flags;
+ uint32 targetType;
+ uint32 targetParam1;
+ uint32 targetParam2;
+ uint32 targetParam3;
} cast;
struct