[11823] Add SCRIPT_COMMAND_MODIFY_NPC_FLAG to change NPC flags by db-script

Note that the npc flags will be restored when the npc respawns

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-01-03 15:12:05 +01:00 committed by Schmoozerd
parent 1606bb2e45
commit 46e604a089
5 changed files with 100 additions and 8 deletions

View file

@ -578,6 +578,21 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename)
}
break;
}
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS:
{
if (tmp.npcFlag.creatureEntry && !ObjectMgr::GetCreatureTemplate(tmp.npcFlag.creatureEntry))
{
sLog.outErrorDb("Table `%s` has datalong3 = %u in SCRIPT_COMMAND_MODIFY_NPC_FLAGS for script id %u, but this creature_template does not exist.", tablename, tmp.run.creatureEntry, tmp.id);
continue;
}
if (tmp.npcFlag.creatureEntry && !tmp.npcFlag.searchRadius)
{
sLog.outErrorDb("Table `%s` has datalong3 = %u in SCRIPT_COMMAND_MODIFY_NPC_FLAGS for script id %u, but search radius is too small (datalong4 = %u).", tablename, tmp.run.creatureEntry, tmp.id, tmp.run.searchRadius);
continue;
}
break;
}
}
if (scripts.find(tmp.id) == scripts.end())