Scripts: Implement SCRIPT_FLAG_COMMAND_ADDITIONAL for SCRIPT_COMMAND_CAST_SPELL to pass nullptr target

killerwife 4 months ago
parent 7fb0362471
commit 98c85db6b2

@ -243,6 +243,7 @@ Defining a buddy could be done in several way:
* datalong = spell id
* datalong2 = TriggerCastFlags
* dataint1-dataint4 optional. If some of these are set to a spell id, a random spell out of datalong, datint1, ..,dataintX is cast.
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: do not pass target to spellcast
16 SCRIPT_COMMAND_PLAY_SOUND source = any object, target=any/player
* datalong = sound_id

@ -2120,7 +2120,9 @@ bool ScriptAction::ExecuteDbscriptCommand(WorldObject* pSource, WorldObject* pTa
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId);
if (spellInfo->HasAttribute(SPELL_ATTR_EX_EXCLUDE_CASTER) && pTarget == pSource)
pTarget = nullptr; // TODO: Add mechanism to opt not sending target
pTarget = nullptr;
if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
pTarget = nullptr;
// TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast
if (pSource && pSource->IsGameObject())