public NpcType NPCType(int id)
{
var entity = api.Entity.GetEntity(id);
if (entity.WarpPointer == 0) return NpcType.InanimateObject;
if (IsOfType(entity.SpawnFlags, (int)NpcType.Mob)) return NpcType.Mob;
if (IsOfType(entity.SpawnFlags, (int)NpcType.NPC)) return NpcType.NPC;
if (IsOfType(entity.SpawnFlags, (int)NpcType.PC)) return NpcType.PC;
if (IsOfType(entity.SpawnFlags, (int)NpcType.Self)) return NpcType.Self;
return NpcType.InanimateObject;
}