[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

@ -1620,20 +1620,14 @@ bool Map::ScriptsStart(ScriptMapMapName const& scripts, uint32 id, Object* sourc
///- Schedule script execution for all scripts in the script map
ScriptMap const *s2 = &(s->second);
bool immedScript = false;
for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter)
{
ScriptAction sa(scripts.first, this, sourceGuid, targetGuid, ownerGuid, &iter->second);
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + iter->first), sa));
if (iter->first == 0)
immedScript = true;
sScriptMgr.IncreaseScheduledScriptsCount();
}
///- If one of the effects should be immediate, launch the script execution
if (immedScript)
ScriptsProcess();
return true;
}
@ -1652,10 +1646,6 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + delay), sa));
sScriptMgr.IncreaseScheduledScriptsCount();
///- If effects should be immediate, launch the script execution
if(delay == 0)
ScriptsProcess();
}
/// Process queued scripts