[11990] More db-script command changes

* Allow SCRIPT_COMMAND_KILL_CREDIT to give the kill of an involved npc.
  This is marked by datalong (creature-entry) == 0
* Remove immediate execution of commands. This will prevent infinite loops when db-scripts trigger db-scripts which are executed immediately
* Add check for SCRIPT_COMMAND_PLAY_SOUND
* Add check to catch an invalid command

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-05-09 22:35:00 +02:00
parent 419ba5fc28
commit 414d432d24
6 changed files with 109 additions and 91 deletions

View file

@ -48,14 +48,14 @@ enum ScriptCommand // resSource, resTar
// dataint = text entry from db_script_string -table. dataint2-4 optional for random selected texts.
SCRIPT_COMMAND_EMOTE = 1, // resSource = Unit, resTarget = Unit/none
// datalong1 = emote_id
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong3 = field_id, datalong2 = value
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value
SCRIPT_COMMAND_MOVE_TO = 3, // resSource = Creature, datalong2 = travel_speed*100, x/y/z
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position
SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong3 = field_id, datalong2 = bitmask
SCRIPT_COMMAND_FLAG_REMOVE = 5, // source = any, datalong3 = field_id, datalong2 = bitmask
SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong = field_id, datalong2 = bitmask
SCRIPT_COMMAND_FLAG_REMOVE = 5, // source = any, datalong = field_id, datalong2 = bitmask
SCRIPT_COMMAND_TELEPORT_TO = 6, // source or target with Player, datalong2 = map_id, x/y/z
SCRIPT_COMMAND_QUEST_EXPLORED = 7, // one from source or target must be Player, another GO/Creature, datalong3=quest_id, datalong2=distance or 0
SCRIPT_COMMAND_KILL_CREDIT = 8, // source or target with Player, datalong3 = creature entry, datalong2 = bool (0=personal credit, 1=group credit)
SCRIPT_COMMAND_QUEST_EXPLORED = 7, // one from source or target must be Player, another GO/Creature, datalong=quest_id, datalong2=distance or 0
SCRIPT_COMMAND_KILL_CREDIT = 8, // source or target with Player, datalong = creature entry (or 0 for target-entry), datalong2 = bool (0=personal credit, 1=group credit)
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any, datalong=db_guid, datalong2=despawn_delay
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any, datalong=creature entry, datalong2=despawn_delay
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active
@ -67,7 +67,7 @@ enum ScriptCommand // resSource, resTar
// datalong=spellid
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = cast triggered
SCRIPT_COMMAND_PLAY_SOUND = 16, // resSource = WorldObject, 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, datalong3 = item entry, datalong2 = amount
SCRIPT_COMMAND_CREATE_ITEM = 17, // source or target must be player, datalong = item entry, datalong2 = amount
SCRIPT_COMMAND_DESPAWN_SELF = 18, // resSource = Creature, datalong = despawn delay
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
SCRIPT_COMMAND_MOVEMENT = 20, // resSource = Creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)