* Load npc configuration from csv file npc.csv
*/
private void loadNPCs() {
npcCache = new HashMap<Integer, CSVDatastoreDAO.CSVNpc>();
try {
CSVReader reader = new CSVReader(new InputStreamReader(
CSVDatastoreDAO.class.getResourceAsStream("/db/npc.csv")), 1/*skip header*/, new CSVParser('\t','"','\\'));
String[] line = reader.readNext();
while (line != null) {
if (line.length > 2) {
CSVNpc n = new CSVNpc();
n.id = Integer.valueOf(line[0]);
n.idTemplate = Integer.valueOf(line[1]);
n.name = line[2];
if (line.length > 3)
n.gamemodel = line[3];
npcCache.put(n.idTemplate, n);
}
line = reader.readNext();
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Failed to load /db/npc.csv", e);
}
}