mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Added possibility to cast spells with triggered flag using SCRIPT_COMMAND_CAST_SPELL, original patch by Az@zel
Fixed SCRIPT_COMMAND_CAST_SPELL for casting on creatures with selected entry --HG-- branch : trunk
This commit is contained in:
@@ -4709,13 +4709,13 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(tmp.datalong))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
|
||||
tablename,tmp.datalong,tmp.id);
|
||||
continue;
|
||||
}
|
||||
if (tmp.datalong2 & ~0x1) // 1 bits (0,1)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
|
||||
tablename,tmp.datalong2,tmp.id);
|
||||
continue;
|
||||
}
|
||||
@@ -4725,16 +4725,22 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(tmp.datalong))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
tablename,tmp.datalong,tmp.id);
|
||||
continue;
|
||||
}
|
||||
if (tmp.datalong2 & ~0x3) // 2 bits
|
||||
if (tmp.datalong2 > 4) // targeting type
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
sLog.outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
tablename,tmp.datalong2,tmp.id);
|
||||
continue;
|
||||
}
|
||||
if (tmp.dataint & ~0x1) // 1 bit (0,1)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||
tablename,tmp.dataint,tmp.id);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -3583,7 +3583,7 @@ void Map::ScriptsProcess()
|
||||
uSource = dynamic_cast<Unit*>(target);
|
||||
uTarget = dynamic_cast<Unit*>(source);
|
||||
break;
|
||||
case 4: // creature
|
||||
case 4: // source -> creature with entry
|
||||
uSource = dynamic_cast<Unit*>(source);
|
||||
uTarget = GetClosestCreatureWithEntry(uSource, step.script->dataint, step.script->x);
|
||||
break;
|
||||
@@ -3601,7 +3601,8 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
}
|
||||
|
||||
uSource->CastSpell(uTarget, step.script->datalong, false);
|
||||
bool triggered = step.script->dataint & 0x1;
|
||||
uSource->CastSpell(uTarget, step.script->datalong, triggered);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ enum WorldStates
|
||||
#define SCRIPT_COMMAND_CLOSE_DOOR 12 // source = unit, datalong=db_guid, datalong2=reset_delay
|
||||
#define SCRIPT_COMMAND_ACTIVATE_OBJECT 13 // source = unit, target=GO
|
||||
#define SCRIPT_COMMAND_REMOVE_AURA 14 // source (datalong2 != 0) or target (datalong == 0) unit, datalong = spell_id
|
||||
#define SCRIPT_COMMAND_CAST_SPELL 15 // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s
|
||||
#define SCRIPT_COMMAND_CAST_SPELL 15 // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s 4: s->creature with entry; dataint & 1 = triggered flag
|
||||
#define SCRIPT_COMMAND_PLAY_SOUND 16 // source = any object, target=any/player, datalong (sound_id), datalong2 (bitmask: 0/1=anyone/target, 0/2=with distance dependent, so 1|2 = 3 is target with distance dependent)
|
||||
#define SCRIPT_COMMAND_CREATE_ITEM 17 // source or target must be player, datalong = item entry, datalong2 = amount
|
||||
#define SCRIPT_COMMAND_DESPAWN_SELF 18 // source or target must be creature, datalong = despawn delay
|
||||
|
||||
Reference in New Issue
Block a user