[9577] Implement SCRIPT_COMMAND_DESPAWN_SELF (self = creature in this context)

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-03-12 17:31:44 +01:00
parent dbbc45828a
commit 29b2c80449
4 changed files with 28 additions and 1 deletions

View file

@ -3506,6 +3506,27 @@ void Map::ScriptsProcess()
break;
}
case SCRIPT_COMMAND_DESPAWN_SELF:
{
if (!target && !source)
{
sLog.outError("SCRIPT_COMMAND_DESPAWN_SELF call for NULL object.");
break;
}
// only creature
if ((!target || target->GetTypeId() != TYPEID_UNIT) && (!source || source->GetTypeId() != TYPEID_UNIT))
{
sLog.outError("SCRIPT_COMMAND_DESPAWN_SELF call for non-creature (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
Creature* pCreature = target && target->GetTypeId() == TYPEID_UNIT ? (Creature*)target : (Creature*)source;
pCreature->ForcedDespawn(step.script->datalong);
break;
}
default:
sLog.outError("Unknown script command %u called.",step.script->command);
break;