Search in sources :

Example 21 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method noCancelMouse.

public boolean noCancelMouse(int itemId) {
    if (noCancelMouseCache.containsKey(itemId)) {
        return noCancelMouseCache.get(itemId);
    }
    MapleData item = getItemData(itemId);
    if (item == null) {
        noCancelMouseCache.put(itemId, false);
        return false;
    }
    boolean blockMouse = MapleDataTool.getIntConvert("info/noCancelMouse", item, 0) == 1;
    noCancelMouseCache.put(itemId, blockMouse);
    return blockMouse;
}
Also used : MapleData(provider.MapleData)

Example 22 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getQuestIdFromItem.

public int getQuestIdFromItem(int itemId) {
    MapleData data = getItemData(itemId);
    int questItem = MapleDataTool.getIntConvert("info/quest", data, 0);
    return questItem;
}
Also used : MapleData(provider.MapleData)

Example 23 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getEquipStats.

public Map<String, Integer> getEquipStats(int itemId) {
    if (equipStatsCache.containsKey(itemId)) {
        return equipStatsCache.get(itemId);
    }
    Map<String, Integer> ret = new LinkedHashMap<>();
    MapleData item = getItemData(itemId);
    if (item == null) {
        return null;
    }
    MapleData info = item.getChildByPath("info");
    if (info == null) {
        return null;
    }
    for (MapleData data : info.getChildren()) {
        if (data.getName().startsWith("inc")) {
            ret.put(data.getName().substring(3), MapleDataTool.getIntConvert(data));
        }
    /*else if (data.getName().startsWith("req"))
             ret.put(data.getName(), MapleDataTool.getInt(data.getName(), info, 0));*/
    }
    ret.put("reqJob", MapleDataTool.getInt("reqJob", info, 0));
    ret.put("reqLevel", MapleDataTool.getInt("reqLevel", info, 0));
    ret.put("reqDEX", MapleDataTool.getInt("reqDEX", info, 0));
    ret.put("reqSTR", MapleDataTool.getInt("reqSTR", info, 0));
    ret.put("reqINT", MapleDataTool.getInt("reqINT", info, 0));
    ret.put("reqLUK", MapleDataTool.getInt("reqLUK", info, 0));
    ret.put("reqPOP", MapleDataTool.getInt("reqPOP", info, 0));
    ret.put("cash", MapleDataTool.getInt("cash", info, 0));
    ret.put("tuc", MapleDataTool.getInt("tuc", info, 0));
    ret.put("cursed", MapleDataTool.getInt("cursed", info, 0));
    ret.put("success", MapleDataTool.getInt("success", info, 0));
    ret.put("fs", MapleDataTool.getInt("fs", info, 0));
    equipStatsCache.put(itemId, ret);
    return ret;
}
Also used : MapleData(provider.MapleData) LinkedHashMap(java.util.LinkedHashMap)

Example 24 with MapleData

use of provider.MapleData 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 25 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getEquipmentSlot.

protected String getEquipmentSlot(int itemId) {
    if (equipmentSlotCache.containsKey(itemId)) {
        return equipmentSlotCache.get(itemId);
    }
    String ret = "";
    MapleData item = getItemData(itemId);
    if (item == null) {
        return null;
    }
    MapleData info = item.getChildByPath("info");
    if (info == null) {
        return null;
    }
    ret = MapleDataTool.getString("islot", info, "");
    equipmentSlotCache.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