Search in sources :

Example 31 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class ItemRequirement method processData.

@Override
public void processData(MapleData data) {
    for (MapleData itemEntry : data.getChildren()) {
        int itemId = MapleDataTool.getInt(itemEntry.getChildByPath("id"));
        int count = MapleDataTool.getInt(itemEntry.getChildByPath("count"), 0);
        items.put(itemId, count);
    }
}
Also used : MapleData(provider.MapleData)

Example 32 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MobRequirement method processData.

/**
 * @param data
 */
@Override
public void processData(MapleData data) {
    for (MapleData questEntry : data.getChildren()) {
        int mobID = MapleDataTool.getInt(questEntry.getChildByPath("id"));
        int countReq = MapleDataTool.getInt(questEntry.getChildByPath("count"));
        mobs.put(mobID, countReq);
    }
}
Also used : MapleData(provider.MapleData)

Example 33 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class WZIMGEntry method getChildByPath.

@Override
public MapleData getChildByPath(String path) {
    String[] segments = path.split("/");
    if (segments[0].equals("..")) {
        return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
    }
    MapleData ret = this;
    for (int x = 0; x < segments.length; x++) {
        boolean foundChild = false;
        for (MapleData child : ret.getChildren()) {
            if (child.getName().equals(segments[x])) {
                ret = child;
                foundChild = true;
                break;
            }
        }
        if (!foundChild) {
            return null;
        }
    }
    return ret;
}
Also used : MapleData(provider.MapleData)

Example 34 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class XMLDomMapleData method getChildren.

@Override
public List<MapleData> getChildren() {
    List<MapleData> ret = new ArrayList<MapleData>();
    NodeList childNodes = node.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node childNode = childNodes.item(i);
        if (childNode.getNodeType() == Node.ELEMENT_NODE) {
            XMLDomMapleData child = new XMLDomMapleData(childNode);
            child.imageDataDir = new File(imageDataDir, getName());
            ret.add(child);
        }
    }
    return ret;
}
Also used : MapleData(provider.MapleData) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) ArrayList(java.util.ArrayList) File(java.io.File) Point(java.awt.Point)

Example 35 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getAllItems.

public List<Pair<Integer, String>> getAllItems() {
    if (!itemNameCache.isEmpty()) {
        return itemNameCache;
    }
    List<Pair<Integer, String>> itemPairs = new ArrayList<>();
    MapleData itemsData;
    itemsData = stringData.getData("Cash.img");
    for (MapleData itemFolder : itemsData.getChildren()) {
        itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
    }
    itemsData = stringData.getData("Consume.img");
    for (MapleData itemFolder : itemsData.getChildren()) {
        itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
    }
    itemsData = stringData.getData("Eqp.img").getChildByPath("Eqp");
    for (MapleData eqpType : itemsData.getChildren()) {
        for (MapleData itemFolder : eqpType.getChildren()) {
            itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
        }
    }
    itemsData = stringData.getData("Etc.img").getChildByPath("Etc");
    for (MapleData itemFolder : itemsData.getChildren()) {
        itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
    }
    itemsData = stringData.getData("Ins.img");
    for (MapleData itemFolder : itemsData.getChildren()) {
        itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
    }
    itemsData = stringData.getData("Pet.img");
    for (MapleData itemFolder : itemsData.getChildren()) {
        itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
    }
    return itemPairs;
}
Also used : MapleData(provider.MapleData) ArrayList(java.util.ArrayList) Pair(tools.Pair)

Aggregations

MapleData (provider.MapleData)90 ArrayList (java.util.ArrayList)19 Pair (tools.Pair)11 File (java.io.File)8 Point (java.awt.Point)7 LinkedList (java.util.LinkedList)6 MapleDataDirectoryEntry (provider.MapleDataDirectoryEntry)6 MapleDataFileEntry (provider.MapleDataFileEntry)6 LinkedHashMap (java.util.LinkedHashMap)5 SQLException (java.sql.SQLException)4 MapleDataProvider (provider.MapleDataProvider)4 Skill (client.Skill)2 IOException (java.io.IOException)2 Node (org.w3c.dom.Node)2 NodeList (org.w3c.dom.NodeList)2 AbstractLoadedMapleLife (server.life.AbstractLoadedMapleLife)2 MapleCharacter (client.MapleCharacter)1 Item (client.inventory.Item)1 MonsterStatus (client.status.MonsterStatus)1 Rectangle (java.awt.Rectangle)1