npcDat.set("name", name);
npcDat.set("baseHpMax", hp);
npcDat.set("basePDef", pdef);
npcDat.set("baseMDef", mdef);
L2CharTemplate template = new L2CharTemplate(npcDat);
L2DoorInstance door = new L2DoorInstance(IdFactory.getInstance().getNextId(), template, id, name, unlockable, showHp);
_staticItems.put(id, door);
L2Territory pos = new L2Territory(id);
door.setGeoPos(pos);
pos.add(ax, ay, minz, maxz);
pos.add(bx, by, minz, maxz);
pos.add(cx, cy, minz, maxz);
pos.add(dx, dy, minz, maxz);
door.getTemplate().collisionHeight = maxz - minz & 0xfff0;
door.getTemplate().collisionRadius = Math.max(50, Math.min(posx - pos.getXmin(), posy - pos.getYmin()));
door.setXYZInvisible(posx, posy, minz + 32);
door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp(), true);
door.setOpen(false);
door.level = level;
door.key = key;
// Дверь/стена может быть атакована только осадным оружием
door.setSiegeWeaponOlnyAttackable(siege_weapon);
door.setGeodata(geodata);
door.spawnMe(door.getLoc());
if(Config.debugDoor)
{
if(door.getTemplate().collisionRadius > 200)
{
System.out.println("DoorId: " + id + ", collision: " + door.getTemplate().collisionRadius + ", posx: " + posx + ", posy: " + posy + ", xMin: " + pos.getXmin() + ", yMin: " + pos.getYmin());
}
if(pos.getXmin() == pos.getXmax())
{
_log.warning("door " + id + " has zero size");
}