Search in sources :

Example 81 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getStringData.

private MapleData getStringData(int itemId) {
    String cat = "null";
    MapleData theData;
    if (itemId >= 5010000) {
        theData = cashStringData;
    } else if (itemId >= 2000000 && itemId < 3000000) {
        theData = consumeStringData;
    } else if ((itemId >= 1010000 && itemId < 1040000) || (itemId >= 1122000 && itemId < 1123000) || (itemId >= 1132000 && itemId < 1133000) || (itemId >= 1142000 && itemId < 1143000)) {
        theData = eqpStringData;
        cat = "Eqp/Accessory";
    } else if (itemId >= 1000000 && itemId < 1010000) {
        theData = eqpStringData;
        cat = "Eqp/Cap";
    } else if (itemId >= 1102000 && itemId < 1103000) {
        theData = eqpStringData;
        cat = "Eqp/Cape";
    } else if (itemId >= 1040000 && itemId < 1050000) {
        theData = eqpStringData;
        cat = "Eqp/Coat";
    } else if (itemId >= 20000 && itemId < 22000) {
        theData = eqpStringData;
        cat = "Eqp/Face";
    } else if (itemId >= 1080000 && itemId < 1090000) {
        theData = eqpStringData;
        cat = "Eqp/Glove";
    } else if (itemId >= 30000 && itemId < 35000) {
        theData = eqpStringData;
        cat = "Eqp/Hair";
    } else if (itemId >= 1050000 && itemId < 1060000) {
        theData = eqpStringData;
        cat = "Eqp/Longcoat";
    } else if (itemId >= 1060000 && itemId < 1070000) {
        theData = eqpStringData;
        cat = "Eqp/Pants";
    } else if (itemId >= 1802000 && itemId < 1842000) {
        theData = eqpStringData;
        cat = "Eqp/PetEquip";
    } else if (itemId >= 1112000 && itemId < 1120000) {
        theData = eqpStringData;
        cat = "Eqp/Ring";
    } else if (itemId >= 1092000 && itemId < 1100000) {
        theData = eqpStringData;
        cat = "Eqp/Shield";
    } else if (itemId >= 1070000 && itemId < 1080000) {
        theData = eqpStringData;
        cat = "Eqp/Shoes";
    } else if (itemId >= 1900000 && itemId < 2000000) {
        theData = eqpStringData;
        cat = "Eqp/Taming";
    } else if (itemId >= 1300000 && itemId < 1800000) {
        theData = eqpStringData;
        cat = "Eqp/Weapon";
    } else if (itemId >= 4000000 && itemId < 5000000) {
        theData = etcStringData;
        cat = "Etc";
    } else if (itemId >= 3000000 && itemId < 4000000) {
        theData = insStringData;
    } else if (itemId / 1000 == 5000) {
        theData = petStringData;
    } else {
        return null;
    }
    if (cat.equalsIgnoreCase("null")) {
        return theData.getChildByPath(String.valueOf(itemId));
    } else {
        return theData.getChildByPath(cat + "/" + itemId);
    }
}
Also used : MapleData(provider.MapleData)

Example 82 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getSkillStats.

public Map<String, Integer> getSkillStats(int itemId, double playerJob) {
    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));
        }
    }
    ret.put("masterLevel", MapleDataTool.getInt("masterLevel", info, 0));
    ret.put("reqSkillLevel", MapleDataTool.getInt("reqSkillLevel", info, 0));
    ret.put("success", MapleDataTool.getInt("success", info, 0));
    MapleData skill = info.getChildByPath("skill");
    int curskill;
    for (int i = 0; i < skill.getChildren().size(); i++) {
        curskill = MapleDataTool.getInt(Integer.toString(i), skill, 0);
        if (curskill == 0) {
            break;
        }
        if (curskill / 10000 == playerJob) {
            ret.put("skillid", curskill);
            break;
        }
    }
    if (ret.get("skillid") == null) {
        ret.put("skillid", 0);
    }
    return ret;
}
Also used : MapleData(provider.MapleData) LinkedHashMap(java.util.LinkedHashMap)

Example 83 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getAllEtcItems.

public List<Pair<Integer, String>> getAllEtcItems() {
    if (!itemNameCache.isEmpty()) {
        return itemNameCache;
    }
    List<Pair<Integer, String>> itemPairs = new ArrayList<>();
    MapleData itemsData;
    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")));
    }
    return itemPairs;
}
Also used : MapleData(provider.MapleData) ArrayList(java.util.ArrayList) Pair(tools.Pair)

Example 84 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)

Example 85 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method getScrollReqs.

public List<Integer> getScrollReqs(int itemId) {
    List<Integer> ret = new ArrayList<>();
    MapleData data = getItemData(itemId);
    data = data.getChildByPath("req");
    if (data == null) {
        return ret;
    }
    for (MapleData req : data.getChildren()) {
        ret.add(MapleDataTool.getInt(req));
    }
    return ret;
}
Also used : MapleData(provider.MapleData) ArrayList(java.util.ArrayList)

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