[10506] Implement 5 new SCRIPT_COMMAND_*

All commands can only have creature as the affected by command
*_SET_ACTIVEOBJECT - switch activeObject state on/off
*_SET_FACTION - changes faction
*_MORPH_TO_ENTRY_OR_MODEL - changes model to model from creature_template entry or model id explicit
*_MOUNT_TO_ENTRY_OR_MODEL - mounts on model from creature_template entry or model id explicit
*_SET_RUN - switch walkmode on/off

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-09-19 19:26:56 +02:00
parent 19d028d099
commit a1fd19b6b3
5 changed files with 549 additions and 88 deletions

View file

@ -89,90 +89,120 @@ spell_scripts
## Each command has different parameters, and are as follows:
-- --------------------------
0 SCRIPT_COMMAND_TALK source = WorldObject, target = any/none
* datalong (see enum ChatType for supported CHAT_TYPE_'s)
* datalong2 = creature entry (searching for a buddy, closest to source)
* datalong3 = creature search radius
* data_flags = flag_target_player_as_source = 0x01
flag_original_source_as_target = 0x02
flag_buddy_as_target = 0x04
* dataint = text entry from db_script_string -table. dataint2-dataint4 optionally, for random selection of text
0 SCRIPT_COMMAND_TALK source = WorldObject, target = any/none
* datalong (see enum ChatType for supported CHAT_TYPE_'s)
* datalong2 = creature entry (searching for a buddy, closest to source)
* datalong3 = creature search radius
* data_flags = flag_target_player_as_source = 0x01
flag_original_source_as_target = 0x02
flag_buddy_as_target = 0x04
* dataint = text entry from db_script_string -table. dataint2-dataint4 optionally, for random selection of text
1 SCRIPT_COMMAND_EMOTE source = unit
* datalong = emote_id
1 SCRIPT_COMMAND_EMOTE source = unit
* datalong = emote_id
2 SCRIPT_COMMAND_FIELD_SET source = any
* datalong = field_id
* datalong2 = field value
2 SCRIPT_COMMAND_FIELD_SET source = any
* datalong = field_id
* datalong2 = field value
3 SCRIPT_COMMAND_MOVE_TO source = Creature
* datalong2 = travel time
* x/y/z
3 SCRIPT_COMMAND_MOVE_TO source = Creature
* datalong2 = travel time
* x/y/z
4 SCRIPT_COMMAND_FLAG_SET source = any
* datalong = field_id
* datalong2 = bitmask
4 SCRIPT_COMMAND_FLAG_SET source = any
* datalong = field_id
* datalong2 = bitmask
5 SCRIPT_COMMAND_FLAG_REMOVE source = any
* datalong = field_id
* datalong2 = bitmask
5 SCRIPT_COMMAND_FLAG_REMOVE source = any
* datalong = field_id
* datalong2 = bitmask
6 SCRIPT_COMMAND_TELEPORT_TO source or target with Player
* datalong = map_id
* x/y/z
6 SCRIPT_COMMAND_TELEPORT_TO source or target with Player
* datalong = map_id
* x/y/z
7 SCRIPT_COMMAND_QUEST_EXPLORED one from source or target must be Player, another GO/Creature
* datalong = quest_id
* datalong2 = distance or 0
7 SCRIPT_COMMAND_QUEST_EXPLORED one from source or target must be Player, another GO/Creature
* datalong = quest_id
* datalong2 = distance or 0
8 SCRIPT_COMMAND_KILL_CREDIT source or target with Player
* datalong = creature entry
* datalong2 = bool (0=personal credit, 1=group credit)
8 SCRIPT_COMMAND_KILL_CREDIT source or target with Player
* datalong = creature entry
* datalong2 = bool (0=personal credit, 1=group credit)
9 SCRIPT_COMMAND_RESPAWN_GAMEOBJECT source = any (summoner)
* datalong=db_guid
* datalong2 = despawn_delay
9 SCRIPT_COMMAND_RESPAWN_GAMEOBJECT source = any (summoner)
* datalong=db_guid
* datalong2 = despawn_delay
10 SCRIPT_COMMAND_TEMP_SUMMON_CREATURE source = any (summoner)
* datalong = creature entry
* datalong2 = despawn_delay
10 SCRIPT_COMMAND_TEMP_SUMMON_CREATURE source = any (summoner)
* datalong = creature entry
* datalong2 = despawn_delay
11 SCRIPT_COMMAND_OPEN_DOOR source = unit
* datalong = db_guid
* datalong2 = reset_delay
11 SCRIPT_COMMAND_OPEN_DOOR source = unit
* datalong = db_guid
* datalong2 = reset_delay
12 SCRIPT_COMMAND_CLOSE_DOOR source = unit
* datalong = db_guid
* datalong2 = reset_delay
12 SCRIPT_COMMAND_CLOSE_DOOR source = unit
* datalong = db_guid
* datalong2 = reset_delay
13 SCRIPT_COMMAND_ACTIVATE_OBJECT source = unit, target=GO
13 SCRIPT_COMMAND_ACTIVATE_OBJECT source = unit, target=GO
14 SCRIPT_COMMAND_REMOVE_AURA source (datalong2!=0) or target (datalong==0) unit
* datalong = spell_id
* datalong2 = bool source is target of action
14 SCRIPT_COMMAND_REMOVE_AURA source (datalong2!=0) or target (datalong==0) unit
* datalong = spell_id
* datalong2 = bool source is target of action
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
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
16 SCRIPT_COMMAND_PLAY_SOUND 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)
16 SCRIPT_COMMAND_PLAY_SOUND 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)
17 SCRIPT_COMMAND_CREATE_ITEM source or target must be player
* datalong = item entry
* datalong2 = amount
17 SCRIPT_COMMAND_CREATE_ITEM source or target must be player
* datalong = item entry
* datalong2 = amount
18 SCRIPT_COMMAND_DESPAWN_SELF source or target must be creature
* datalong = despawn delay
19 SCRIPT_COMMAND_PLAY_MOVIE target can only be a player
* datalog = movie id
20 SCRIPT_COMMAND_MOVEMENT source or target must be creature
* datalong = MovementType (0:idle, 1:random or 2:waypoint)
* datalong2 = creature entry (searching for a buddy, closest to source)
* datalong3 = creature search radius
21 SCRIPT_COMMAND_SET_ACTIVEOBJECT source=worldobject, target=creature
* datalong=bool 0=off, 1=on
* datalong2=creature entry
* datalong3=search radius
22 SCRIPT_COMMAND_SET_FACTION source=worldobject, target=creature
* datalong=factionId OR 0 to restore original faction from creature_template
* datalong2=creature entry
* datalong3=search radius
23 SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL source=worldobject, target=creature
* datalong=creature entry/modelid (depend on data_flags) OR 0 to demorph
* datalong2=creature entry
* datalong3=search radius
* dataflags= 0x01 to use datalong value as modelid explicit
24 SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL source=worldobject, target=creature
* datalong=creature entry/modelid (depend on data_flags) OR 0 to dismount
* datalong2=creature entry
* datalong3=search radius
* dataflags= 0x01 to use datalong value as modelid explicit
25 SCRIPT_COMMAND_SET_RUN source=worldobject, target=creature
* datalong= bool 0=off, 1=on
* datalong2=creature entry
* datalong3=search radius
18 SCRIPT_COMMAND_DESPAWN_SELF source or target must be creature
* datalong = despawn delay
19 SCRIPT_COMMAND_PLAY_MOVIE target can only be a player
* datalog = movie id
20 SCRIPT_COMMAND_MOVEMENT source or target must be creature
* datalong = MovementType (0:idle, 1:random or 2:waypoint)
* datalong2 = creature entry (searching for a buddy, closest to source)
* datalong3 = creature search radius

View file

@ -2327,7 +2327,7 @@ void Map::ScriptsProcess()
break;
}
((Creature *)source)->HandleEmote(step.script->emote.emoteId);
((Creature*)source)->HandleEmote(step.script->emote.emoteId);
break;
case SCRIPT_COMMAND_FIELD_SET:
if (!source)
@ -2951,6 +2951,266 @@ void Map::ScriptsProcess()
break;
}
case SCRIPT_COMMAND_SET_ACTIVEOBJECT:
{
if (!source)
{
sLog.outError("SCRIPT_COMMAND_SET_ACTIVEOBJECT (script id %u) call for NULL source.", step.script->id);
break;
}
if (!source->isType(TYPEMASK_WORLDOBJECT))
{
sLog.outError("SCRIPT_COMMAND_SET_ACTIVEOBJECT (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
break;
}
WorldObject* pSource = (WorldObject*)source;
Creature* pOwner = NULL;
// No buddy defined, so try use source (or target if source is not creature)
if (!step.script->activeObject.creatureEntry)
{
if (pSource->GetTypeId() != TYPEID_UNIT)
{
// we can't be non-creature, so see if target is creature
if (target && target->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)target;
}
else if (pSource->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)pSource;
}
else // If step has a buddy entry defined, search for it
{
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->activeObject.creatureEntry, true, step.script->activeObject.searchRadius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pOwner, u_check);
Cell::VisitGridObjects(pSource, searcher, step.script->activeObject.searchRadius);
}
if (!pOwner)
{
sLog.outError("SCRIPT_COMMAND_SET_ACTIVEOBJECT (script id %u) call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
pOwner->SetActiveObjectState(step.script->activeObject.activate);
break;
}
case SCRIPT_COMMAND_SET_FACTION:
{
if (!source)
{
sLog.outError("SCRIPT_COMMAND_SET_FACTION (script id %u) call for NULL source.", step.script->id);
break;
}
if (!source->isType(TYPEMASK_WORLDOBJECT))
{
sLog.outError("SCRIPT_COMMAND_SET_FACTION (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
break;
}
WorldObject* pSource = (WorldObject*)source;
Creature* pOwner = NULL;
// No buddy defined, so try use source (or target if source is not creature)
if (!step.script->faction.creatureEntry)
{
if (pSource->GetTypeId() != TYPEID_UNIT)
{
// we can't be non-creature, so see if target is creature
if (target && target->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)target;
}
else if (pSource->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)pSource;
}
else // If step has a buddy entry defined, search for it
{
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->faction.creatureEntry, true, step.script->faction.searchRadius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pOwner, u_check);
Cell::VisitGridObjects(pSource, searcher, step.script->faction.searchRadius);
}
if (!pOwner)
{
sLog.outError("SCRIPT_COMMAND_SET_FACTION (script id %u) call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
if (step.script->faction.factionId)
pOwner->setFaction(step.script->faction.factionId);
else
pOwner->setFaction(pOwner->GetCreatureInfo()->faction_A);
break;
}
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL:
{
if (!source)
{
sLog.outError("SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (script id %u) call for NULL source.", step.script->id);
break;
}
if (!source->isType(TYPEMASK_WORLDOBJECT))
{
sLog.outError("SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
break;
}
WorldObject* pSource = (WorldObject*)source;
Creature* pOwner = NULL;
// No buddy defined, so try use source (or target if source is not creature)
if (!step.script->morph.creatureEntry)
{
if (pSource->GetTypeId() != TYPEID_UNIT)
{
// we can't be non-creature, so see if target is creature
if (target && target->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)target;
}
else if (pSource->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)pSource;
}
else // If step has a buddy entry defined, search for it
{
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->morph.creatureEntry, true, step.script->morph.searchRadius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pOwner, u_check);
Cell::VisitGridObjects(pSource, searcher, step.script->morph.searchRadius);
}
if (!pOwner)
{
sLog.outError("SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (script id %u) call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
if (!step.script->morph.creatureOrModelEntry)
pOwner->DeMorph();
else if (step.script->morph.flags & 0x01)
pOwner->SetDisplayId(step.script->morph.creatureOrModelEntry);
else
{
CreatureInfo const* ci = GetCreatureTemplateStore(step.script->morph.creatureOrModelEntry);
uint32 display_id = Creature::ChooseDisplayId(ci);
pOwner->SetDisplayId(display_id);
}
break;
}
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL:
{
if (!source)
{
sLog.outError("SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (script id %u) call for NULL source.", step.script->id);
break;
}
if (!source->isType(TYPEMASK_WORLDOBJECT))
{
sLog.outError("SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
break;
}
WorldObject* pSource = (WorldObject*)source;
Creature* pOwner = NULL;
// No buddy defined, so try use source (or target if source is not creature)
if (!step.script->mount.creatureEntry)
{
if (pSource->GetTypeId() != TYPEID_UNIT)
{
// we can't be non-creature, so see if target is creature
if (target && target->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)target;
}
else if (pSource->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)pSource;
}
else // If step has a buddy entry defined, search for it
{
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->mount.creatureEntry, true, step.script->mount.searchRadius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pOwner, u_check);
Cell::VisitGridObjects(pSource, searcher, step.script->mount.searchRadius);
}
if (!pOwner)
{
sLog.outError("SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (script id %u) call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
if (!step.script->mount.creatureOrModelEntry)
pOwner->Unmount();
else if (step.script->mount.flags & 0x01)
pOwner->Mount(step.script->mount.creatureOrModelEntry);
else
{
CreatureInfo const* ci = GetCreatureTemplateStore(step.script->mount.creatureOrModelEntry);
uint32 display_id = Creature::ChooseDisplayId(ci);
pOwner->Mount(display_id);
}
break;
}
case SCRIPT_COMMAND_SET_RUN:
{
if (!source)
{
sLog.outError("SCRIPT_COMMAND_SET_RUN (script id %u) call for NULL source.", step.script->id);
break;
}
if (!source->isType(TYPEMASK_WORLDOBJECT))
{
sLog.outError("SCRIPT_COMMAND_SET_RUN (script id %u) call for unsupported non-worldobject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
break;
}
WorldObject* pSource = (WorldObject*)source;
Creature* pOwner = NULL;
// No buddy defined, so try use source (or target if source is not creature)
if (!step.script->run.creatureEntry)
{
if (pSource->GetTypeId() != TYPEID_UNIT)
{
// we can't be non-creature, so see if target is creature
if (target && target->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)target;
}
else if (pSource->GetTypeId() == TYPEID_UNIT)
pOwner = (Creature*)pSource;
}
else // If step has a buddy entry defined, search for it
{
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->run.creatureEntry, true, step.script->run.searchRadius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pOwner, u_check);
Cell::VisitGridObjects(pSource, searcher, step.script->run.searchRadius);
}
if (!pOwner)
{
sLog.outError("SCRIPT_COMMAND_SET_RUN (script id %u) call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", step.script->id, source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
if (step.script->run.run)
pOwner->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
else
pOwner->AddSplineFlag(SPLINEFLAG_WALKMODE);
break;
}
default:
sLog.outError("Unknown SCRIPT_COMMAND_ %u called for script id %u.",step.script->command, step.script->id);
break;

View file

@ -4690,6 +4690,121 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
continue;
}
break;
}
case SCRIPT_COMMAND_SET_ACTIVEOBJECT:
{
if (tmp.activeObject.creatureEntry && !GetCreatureTemplate(tmp.activeObject.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_ACTIVEOBJECT for script id %u, but this creature_template does not exist.", tablename, tmp.activeObject.creatureEntry, tmp.id);
continue;
}
if (tmp.activeObject.creatureEntry && !tmp.activeObject.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_ACTIVEOBJECT for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.activeObject.creatureEntry, tmp.id, tmp.activeObject.searchRadius);
continue;
}
break;
}
case SCRIPT_COMMAND_SET_FACTION:
{
if (tmp.faction.factionId && !sFactionStore.LookupEntry(tmp.faction.factionId))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_FACTION for script id %u, but this faction does not exist.", tablename, tmp.faction.factionId, tmp.id);
continue;
}
if (tmp.faction.creatureEntry && !GetCreatureTemplate(tmp.faction.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_FACTION for script id %u, but this creature_template does not exist.", tablename, tmp.faction.creatureEntry, tmp.id);
continue;
}
if (tmp.faction.creatureEntry && !tmp.faction.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_FACTION for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.faction.creatureEntry, tmp.id, tmp.faction.searchRadius);
continue;
}
break;
}
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL:
{
if (tmp.morph.flags & 0x01)
{
if (tmp.morph.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.morph.creatureOrModelEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.morph.creatureOrModelEntry, tmp.id);
continue;
}
}
else
{
if (tmp.morph.creatureOrModelEntry && !GetCreatureTemplate(tmp.morph.creatureOrModelEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but this creature_template does not exist.", tablename, tmp.morph.creatureOrModelEntry, tmp.id);
continue;
}
}
if (tmp.morph.creatureEntry && !GetCreatureTemplate(tmp.morph.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but this creature_template does not exist.", tablename, tmp.morph.creatureEntry, tmp.id);
continue;
}
if (tmp.morph.creatureEntry && !tmp.morph.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.morph.creatureEntry, tmp.id, tmp.morph.searchRadius);
continue;
}
break;
}
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL:
{
if (tmp.mount.flags & 0x01)
{
if (tmp.mount.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.mount.creatureOrModelEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.mount.creatureOrModelEntry, tmp.id);
continue;
}
}
else
{
if (tmp.mount.creatureOrModelEntry && !GetCreatureTemplate(tmp.mount.creatureOrModelEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but this creature_template does not exist.", tablename, tmp.mount.creatureOrModelEntry, tmp.id);
continue;
}
}
if (tmp.mount.creatureEntry && !GetCreatureTemplate(tmp.mount.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but this creature_template does not exist.", tablename, tmp.mount.creatureEntry, tmp.id);
continue;
}
if (tmp.mount.creatureEntry && !tmp.mount.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.mount.creatureEntry, tmp.id, tmp.mount.searchRadius);
continue;
}
break;
}
case SCRIPT_COMMAND_SET_RUN:
{
if (tmp.run.creatureEntry && !GetCreatureTemplate(tmp.run.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_RUN for script id %u, but this creature_template does not exist.", tablename, tmp.run.creatureEntry, tmp.id);
continue;
}
if (tmp.run.creatureEntry && !tmp.run.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_SET_RUN for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.run.creatureEntry, tmp.id, tmp.run.searchRadius);
continue;
}
break;
}
}

View file

@ -71,36 +71,53 @@ typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
enum eScriptCommand
{
SCRIPT_COMMAND_TALK = 0, // source = WorldObject, target = any/none, datalong (see enum ChatType for supported CHAT_TYPE_'s)
SCRIPT_COMMAND_TALK = 0, // source = WorldObject, target = any/none, datalong (see enum ChatType for supported CHAT_TYPE_'s)
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
// data_flags = flag_target_player_as_source = 0x01
// flag_original_source_as_target = 0x02
// flag_buddy_as_target = 0x04
// dataint = text entry from db_script_string -table. dataint2-4 optional for random selected text.
SCRIPT_COMMAND_EMOTE = 1, // source = unit, datalong = emote_id
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value
SCRIPT_COMMAND_MOVE_TO = 3, // source = Creature, datalong2 = time, x/y/z
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, datalong = map_id, x/y/z
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, datalong2 = bool (0=personal credit, 1=group credit)
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any (summoner), datalong=db_guid, datalong2=despawn_delay
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any (summoner), datalong=creature entry, datalong2=despawn_delay
SCRIPT_COMMAND_OPEN_DOOR = 11, // source = unit, datalong=db_guid, datalong2=reset_delay
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_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
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
SCRIPT_COMMAND_MOVEMENT = 20, // source or target must be creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
SCRIPT_COMMAND_EMOTE = 1, // source = unit, datalong = emote_id
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value
SCRIPT_COMMAND_MOVE_TO = 3, // source = Creature, datalong2 = time, x/y/z
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, datalong = map_id, x/y/z
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, datalong2 = bool (0=personal credit, 1=group credit)
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any (summoner), datalong=db_guid, datalong2=despawn_delay
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any (summoner), datalong=creature entry, datalong2=despawn_delay
SCRIPT_COMMAND_OPEN_DOOR = 11, // source = unit, datalong=db_guid, datalong2=reset_delay
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_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
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
SCRIPT_COMMAND_MOVEMENT = 20, // source or target must be creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21, // source=any, target=creature
// datalong=bool 0=off, 1=on
// datalong2=creature entry, datalong3=search radius
SCRIPT_COMMAND_SET_FACTION = 22, // source=any, target=creature
// datalong=factionId,
// datalong2=creature entry, datalong3=search radius
SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23, // source=any, target=creature
// datalong=creature entry/modelid (depend on data_flags)
// datalong2=creature entry, datalong3=search radius
// dataflags= 0x01 to use datalong value as modelid explicit
SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24, // source=any, target=creature
// datalong=creature entry/modelid (depend on data_flags)
// datalong2=creature entry, datalong3=search radius
// dataflags= 0x01 to use datalong value as modelid explicit
SCRIPT_COMMAND_SET_RUN = 25, // source=any, target=creature
// datalong= bool 0=off, 1=on
// datalong2=creature entry, datalong3=search radius
};
#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK
#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK
struct ScriptInfo
{
@ -233,6 +250,45 @@ struct ScriptInfo
uint32 searchRadius; // datalong3
} movement;
struct // SCRIPT_COMMAND_SET_ACTIVEOBJECT (21)
{
uint32 activate; // datalong
uint32 creatureEntry; // datalong2
uint32 searchRadius; // datalong3
} activeObject;
struct // SCRIPT_COMMAND_SET_FACTION (22)
{
uint32 factionId; // datalong
uint32 creatureEntry; // datalong2
uint32 searchRadius; // datalong3
} faction;
struct // SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (23)
{
uint32 creatureOrModelEntry; // datalong
uint32 creatureEntry; // datalong2
uint32 searchRadius; // datalong3
uint32 empty1; // datalong4
uint32 flags; // data_flags
} morph;
struct // SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (24)
{
uint32 creatureOrModelEntry; // datalong
uint32 creatureEntry; // datalong2
uint32 searchRadius; // datalong3
uint32 empty1; // datalong4
uint32 flags; // data_flags
} mount;
struct // SCRIPT_COMMAND_SET_RUN (25)
{
uint32 run; // datalong
uint32 creatureEntry; // datalong2
uint32 searchRadius; // datalong3
} run;
struct
{
uint32 data[9];

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10505"
#define REVISION_NR "10506"
#endif // __REVISION_NR_H__