Search in sources :

Example 86 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 87 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getMeso.

public int getMeso(int itemId) {
    if (getMesoCache.containsKey(itemId)) {
        return getMesoCache.get(itemId);
    }
    MapleData item = getItemData(itemId);
    if (item == null) {
        return -1;
    }
    int pEntry;
    MapleData pData = item.getChildByPath("info/meso");
    if (pData == null) {
        return -1;
    }
    pEntry = MapleDataTool.getInt(pData);
    getMesoCache.put(itemId, pEntry);
    return pEntry;
}
Also used : MapleData(provider.MapleData)

Example 88 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 89 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 90 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getPrice.

public double getPrice(int itemId) {
    if (priceCache.containsKey(itemId)) {
        return priceCache.get(itemId);
    }
    MapleData item = getItemData(itemId);
    if (item == null) {
        return -1;
    }
    double pEntry;
    MapleData pData = item.getChildByPath("info/unitPrice");
    if (pData != null) {
        try {
            pEntry = MapleDataTool.getDouble(pData);
        } catch (Exception e) {
            pEntry = (double) MapleDataTool.getInt(pData);
        }
    } else {
        pData = item.getChildByPath("info/price");
        if (pData == null) {
            return -1;
        }
        try {
            pEntry = (double) MapleDataTool.getInt(pData);
        } catch (Exception e) {
            priceCache.put(itemId, 0.0);
            return 0;
        }
    }
    priceCache.put(itemId, pEntry);
    return pEntry;
}
Also used : MapleData(provider.MapleData) SQLException(java.sql.SQLException)

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