public void saveToDB() {
        Connection con = DatabaseConnection.getConnection();
        try {

            if (getNPCFromWZ() == null) {
                destroy(true);
                return;
            }
            destroy();
            PreparedStatement ps = con.prepareStatement("INSERT INTO playernpcs(name, hair, face, skin, x, y, map, charid, scriptid, foothold, dir, gender, pets, job, elf, faceMarking, ears, tail) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
            int k = 0;
            ps.setString(++k, getName());
            ps.setInt(++k, getHair());
            ps.setInt(++k, getFace());
            ps.setInt(++k, getSkinColor());
            ps.setInt(++k, getTruePosition().x);
            ps.setInt(++k, getTruePosition().y);
            ps.setInt(++k, getMapId());
            ps.setInt(++k, getCharId());
            ps.setInt(++k, getId());
            ps.setInt(++k, getFh());
            ps.setInt(++k, getF());
            ps.setInt(++k, getGender());
            String[] pet = {"0", "0", "0"};
            for (int i = 0; i < 3; i++) {
                if (pets[i] > 0) {
                    pet[i] = String.valueOf(pets[i]);
                }
            }
            ps.setString(++k, pet[0] + "," + pet[1] + "," + pet[2]);
            ps.setShort(++k, getJob());
            ps.setInt(++k, getElf());
            ps.setInt(++k, getFaceMarking());
            ps.setInt(++k, getEars());
            ps.setInt(++k, getTail());
            ps.executeUpdate();
            ps.close();

            ps = con.prepareStatement("INSERT INTO playernpcs_equip(npcid, charid, equipid, equippos) VALUES (?, ?, ?, ?)");
            ps.setInt(1, getId());
            ps.setInt(2, getCharId());
            for (Entry<Byte, Integer> equip : equips.entrySet()) {
                ps.setInt(3, equip.getValue());
                ps.setInt(4, equip.getKey());
                ps.executeUpdate();
            }
            ps.close();
        } catch (SQLException se) {
        }
    }