public void addFile(MapleDataFileEntry fileEntry) { files.add(fileEntry); entries.put(fileEntry.getName(), fileEntry); }
public static void dumpSkills() { StringBuilder sb = new StringBuilder(); MapleDataProvider prov = MapleDataProviderFactory.getDataProvider("Skill.wz"); MapleDataDirectoryEntry root = prov.getRoot(); start = System.currentTimeMillis(); for (MapleDataFileEntry data : root.getFiles()) { if (data.getName().length() > 8) { continue; } System.out.println("Exporting job " + data.getName().replaceAll(".img", "")); for (MapleData sub : prov.getData(data.getName())) { if (!sub.getName().equals("skill")) { continue; } for (MapleData sub2 : sub.getChildren()) { for (MapleData sub3 : sub2.getChildren()) { boolean found = false; for (String s : opt) { if (s.equals(sub3.getName())) { found = true; } } if (!found) { System.out.println("New information type found: " + sub3.getName()); } for (MapleData sub4 : sub3.getChildren()) { String tab = ""; String name = sub3.getName() + "/" + sub4.getName(); name += ":"; for (int i = 4; i > name.length() / 8; i--) { tab += "\t"; } String info = ""; try { if (sub4.getData() instanceof String || sub4.getData() instanceof Integer) { info = MapleDataTool.getString(sub4, "0"); for (char c : info.toCharArray()) { if (Character.isAlphabetic(c) && name.contains("common")) { if (!b.contains(c)) { a.add(new Pair<>(Integer.parseInt(sub2.getName()), c)); b.add(c); } } } } else if (sub4.getData() instanceof Point) { info = MapleDataTool.getPoint(sub4).toString(); } else if (sub4.getData() instanceof MapleCanvas) { // info = MapleDataTool.getImage(sub4).toString(); info = "image"; } } catch (NumberFormatException ex) { System.out.println("0"); if (!exceptions.contains(ex)) { exceptions.add(ex); } continue; } if (!info.isEmpty()) { sb.append(name).append(tab); sb.append(info).append("\r\n"); } } } if (!sb.toString().isEmpty()) { try { if (saveSkillFile(Integer.parseInt(sub2.getName()), sb)) { saveReadme(); } } catch (NumberFormatException ex) { if (!exceptions.contains(ex)) { exceptions.add(ex); } System.out.println("Failed to get information of " + sub2.getName()); } sb = new StringBuilder(); } } } } end = System.currentTimeMillis(); long total = end - start; long minutes = (total / (60 * 1000)); long seconds = (total % (60 * 1000) / 1000); long milliseconds = (total % 1000); System.out.println( "Total time: " + minutes + " minute(s), " + seconds + " second(s), " + milliseconds + " millisecond(s)."); }