public NPC Spawn(int raceId, int regionId, int x, int y, bool active, bool effect)
{
// Create NPC
var npc = new NPC(raceId);
// Warp to spawn point
if (!npc.Warp(regionId, x, y))
{
Log.Error("Failed to spawn '{0}'s, region '{1}' doesn't exist.", raceId, regionId);
return null;
}
// Save spawn location
npc.SpawnLocation = new Location(regionId, x, y);
// Activate AI at least once
if (npc.AI != null && active)
npc.AI.Activate(0);
// Spawn effect
if (effect)
Send.SpawnEffect(SpawnEffect.Monster, npc.RegionId, x, y, npc, npc);
return npc;
}
}