Search in sources :

Example 71 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class QuestAction method processData.

@Override
public void processData(MapleData data) {
    for (MapleData qEntry : data) {
        int questid = MapleDataTool.getInt(qEntry.getChildByPath("id"));
        int stat = MapleDataTool.getInt(qEntry.getChildByPath("state"));
        quests.put(questid, stat);
    }
}
Also used : MapleData(provider.MapleData)

Example 72 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class InfoExRequirement method processData.

@Override
public void processData(MapleData data) {
    // Because we have to...
    for (MapleData infoEx : data.getChildren()) {
        MapleData value = infoEx.getChildByPath("value");
        infoExpected.add(MapleDataTool.getString(value, ""));
    }
}
Also used : MapleData(provider.MapleData)

Example 73 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class WZFile method getData.

@Override
public synchronized MapleData getData(String path) {
    try {
        WZIMGFile imgFile = getImgFile(path);
        if (imgFile == null) {
            return null;
        }
        MapleData ret = imgFile.getRoot();
        return ret;
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : MapleData(provider.MapleData) IOException(java.io.IOException)

Example 74 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class XMLDomMapleData 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));
    }
    Node myNode = node;
    for (int x = 0; x < segments.length; x++) {
        NodeList childNodes = myNode.getChildNodes();
        boolean foundChild = false;
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node childNode = childNodes.item(i);
            if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getAttributes().getNamedItem("name").getNodeValue().equals(segments[x])) {
                myNode = childNode;
                foundChild = true;
                break;
            }
        }
        if (!foundChild) {
            return null;
        }
    }
    XMLDomMapleData ret = new XMLDomMapleData(myNode);
    ret.imageDataDir = new File(imageDataDir, getName() + "/" + path).getParentFile();
    return ret;
}
Also used : MapleData(provider.MapleData) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) File(java.io.File) Point(java.awt.Point)

Example 75 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getName.

public String getName(int itemId) {
    if (nameCache.containsKey(itemId)) {
        return nameCache.get(itemId);
    }
    MapleData strings = getStringData(itemId);
    if (strings == null) {
        return null;
    }
    String ret = MapleDataTool.getString("name", strings, null);
    nameCache.put(itemId, ret);
    return ret;
}
Also used : MapleData(provider.MapleData)

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