Search in sources :

Example 1 with MapleDataFileEntry

use of provider.MapleDataFileEntry in project HeavenMS by ronancpl.

the class SkillFactory method loadAllSkills.

public static void loadAllSkills() {
    final MapleDataDirectoryEntry root = datasource.getRoot();
    int skillid;
    for (MapleDataFileEntry topDir : root.getFiles()) {
        // Loop thru jobs
        if (topDir.getName().length() <= 8) {
            for (MapleData data : datasource.getData(topDir.getName())) {
                // Loop thru each jobs
                if (data.getName().equals("skill")) {
                    for (MapleData data2 : data) {
                        // Loop thru each jobs
                        if (data2 != null) {
                            skillid = Integer.parseInt(data2.getName());
                            skills.put(skillid, loadFromData(skillid, data2));
                        }
                    }
                }
            }
        }
    }
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 2 with MapleDataFileEntry

use of provider.MapleDataFileEntry in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getItemData.

private MapleData getItemData(int itemId) {
    MapleData ret = null;
    String idStr = "0" + String.valueOf(itemId);
    MapleDataDirectoryEntry root = itemData.getRoot();
    for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
        for (MapleDataFileEntry iFile : topDir.getFiles()) {
            if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
                ret = itemData.getData(topDir.getName() + "/" + iFile.getName());
                if (ret == null) {
                    return null;
                }
                ret = ret.getChildByPath(idStr);
                return ret;
            } else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
                return itemData.getData(topDir.getName() + "/" + iFile.getName());
            }
        }
    }
    root = equipData.getRoot();
    for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
        for (MapleDataFileEntry iFile : topDir.getFiles()) {
            if (iFile.getName().equals(idStr + ".img")) {
                return equipData.getData(topDir.getName() + "/" + iFile.getName());
            }
        }
    }
    return ret;
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 3 with MapleDataFileEntry

use of provider.MapleDataFileEntry in project HeavenMS by ronancpl.

the class DataTool method populateBossList.

private static void populateBossList() {
    bosses = new HashSet<>();
    MapleDataDirectoryEntry mob_data = data.getRoot();
    for (MapleDataFileEntry mdfe : mob_data.getFiles()) {
        MapleData boss_candidate = data.getData(mdfe.getName());
        MapleData monsterInfoData = boss_candidate.getChildByPath("info");
        int mid = Integer.valueOf(boss_candidate.getName().replaceAll("[^0-9]", ""));
        boolean boss = MapleDataTool.getIntConvert("boss", monsterInfoData, 0) > 0 || mid == 8810018 || mid == 9410066;
        if (boss) {
            bosses.add(mid);
        }
    }
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 4 with MapleDataFileEntry

use of provider.MapleDataFileEntry in project HeavenMS by ronancpl.

the class WZFile method getOffsets.

private void getOffsets(MapleDataDirectoryEntry dir) {
    for (MapleDataFileEntry file : dir.getFiles()) {
        file.setOffset(cOffset);
        cOffset += file.getSize();
    }
    for (MapleDataDirectoryEntry sdir : dir.getSubdirectories()) {
        getOffsets(sdir);
    }
}
Also used : MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 5 with MapleDataFileEntry

use of provider.MapleDataFileEntry in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getItemData.

private MapleData getItemData(int itemId) {
    MapleData ret = null;
    String idStr = "0" + String.valueOf(itemId);
    MapleDataDirectoryEntry root = itemData.getRoot();
    for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
        for (MapleDataFileEntry iFile : topDir.getFiles()) {
            if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
                ret = itemData.getData(topDir.getName() + "/" + iFile.getName());
                if (ret == null) {
                    return null;
                }
                ret = ret.getChildByPath(idStr);
                return ret;
            } else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
                return itemData.getData(topDir.getName() + "/" + iFile.getName());
            }
        }
    }
    root = equipData.getRoot();
    for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
        for (MapleDataFileEntry iFile : topDir.getFiles()) {
            if (iFile.getName().equals(idStr + ".img")) {
                return equipData.getData(topDir.getName() + "/" + iFile.getName());
            }
        }
    }
    return ret;
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Aggregations

MapleDataDirectoryEntry (provider.MapleDataDirectoryEntry)7 MapleDataFileEntry (provider.MapleDataFileEntry)7 MapleData (provider.MapleData)6 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Pair (tools.Pair)1