Jump to content

[10956][Patch] Cast triggered with SCRIPT_COMMAND_CAST_SPELL


Recommended Posts

Posted

What bug does the patch fix? What features does the patch add?

- Add a possibility to cast spells as triggered in DB scripts (corresponds datalong & 0x04)

For which repository revision was the patch created?

10951

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

no

Who has been writing this patch? Please include either forum user names or email addresses.

me

I especially intend to use it for spell 31116, in a button-GO script.

(Unfortunately I have no proof that this spell is still used with wotlk version in karazhan)

But as we want to do more stuff with DB-script, I am sure a trigger possibility is a fair thing.

diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index b92e12f..bf6b71c 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -157,7 +157,7 @@ spell_scripts

15 SCRIPT_COMMAND_CAST_SPELL                source/target cast spell at target/source
                                            * datalong = spell id
-                                            * datalong2 = 0: s->t 1: s->s 2: t->t 3: t->s
+                                            * datalong2 = 0: s->t 1: s->s 2: t->t 3: t->s 4: cast triggered

16 SCRIPT_COMMAND_PLAY_SOUND                source = any object, target=any/player
                                            * datalong = sound_id
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 2231ef0..5a48b58 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -2397,7 +2397,7 @@ void Map::ScriptsProcess()
                Unit* spellSource = (Unit*)cmdSource;

                //TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast
-                spellSource->CastSpell(spellTarget, step.script->castSpell.spellId, false);
+                spellSource->CastSpell(spellTarget, step.script->castSpell.spellId, step.script->castSpell.flags & 0x04);

                break;
            }
diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp
index 05ae4d4..893e044 100644
--- a/src/game/ScriptMgr.cpp
+++ b/src/game/ScriptMgr.cpp
@@ -332,7 +332,7 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename)
                        tablename, tmp.castSpell.spellId, tmp.id);
                    continue;
                }
-                if (tmp.castSpell.flags & ~0x3)             // 2 bits
+                if (tmp.castSpell.flags & ~0x7)             // 3 bits
                {
                    sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
                        tablename, tmp.castSpell.flags, tmp.id);
diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h
index cb6fd97..1ed3543 100644
--- a/src/game/ScriptMgr.h
+++ b/src/game/ScriptMgr.h
@@ -61,7 +61,7 @@ enum eScriptCommand
    SCRIPT_COMMAND_CLOSE_DOOR               = 12,           // source = unit, datalong=db_guid, datalong2=reset_delay
    SCRIPT_COMMAND_ACTIVATE_OBJECT          = 13,           // source = unit, target=GO
    SCRIPT_COMMAND_REMOVE_AURA              = 14,           // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id
-    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
+    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: cast triggered
    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)
    SCRIPT_COMMAND_CREATE_ITEM              = 17,           // source or target must be player, datalong = item entry, datalong2 = amount
    SCRIPT_COMMAND_DESPAWN_SELF             = 18,           // source or target must be creature, datalong = despawn delay

  • 1 month later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use