Search in sources :

Example 26 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method isPickupRestricted.

public boolean isPickupRestricted(int itemId) {
    if (pickupRestrictionCache.containsKey(itemId)) {
        return pickupRestrictionCache.get(itemId);
    }
    MapleData data = getItemData(itemId);
    boolean bRestricted = MapleDataTool.getIntConvert("info/only", data, 0) == 1;
    pickupRestrictionCache.put(itemId, bRestricted);
    return bRestricted;
}
Also used : MapleData(provider.MapleData)

Example 27 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 28 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleItemInformationProvider method petsCanConsume.

public List<Integer> petsCanConsume(int itemId) {
    List<Integer> ret = new ArrayList<>();
    MapleData data = getItemData(itemId);
    int curPetId;
    for (int i = 0; i < data.getChildren().size(); i++) {
        curPetId = MapleDataTool.getInt("spec/" + Integer.toString(i), data, 0);
        if (curPetId == 0) {
            break;
        }
        ret.add(Integer.valueOf(curPetId));
    }
    return ret;
}
Also used : MapleData(provider.MapleData) ArrayList(java.util.ArrayList)

Example 29 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class NPCConversationManager method maxMastery.

public void maxMastery() {
    for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) {
        try {
            Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName()));
            getPlayer().changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1);
        } catch (NumberFormatException nfe) {
            nfe.printStackTrace();
            break;
        } catch (NullPointerException npe) {
            npe.printStackTrace();
            continue;
        }
    }
}
Also used : Skill(client.Skill) MapleData(provider.MapleData) File(java.io.File)

Example 30 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class SkillAction method processData.

@Override
public void processData(MapleData data) {
    for (MapleData sEntry : data) {
        byte skillLevel = 0;
        int skillid = MapleDataTool.getInt(sEntry.getChildByPath("id"));
        MapleData skillLevelData = sEntry.getChildByPath("skillLevel");
        if (skillLevelData != null)
            skillLevel = (byte) MapleDataTool.getInt(skillLevelData);
        int masterLevel = MapleDataTool.getInt(sEntry.getChildByPath("masterLevel"));
        List<Integer> jobs = new ArrayList<>();
        MapleData applicableJobs = sEntry.getChildByPath("job");
        if (applicableJobs != null) {
            for (MapleData applicableJob : applicableJobs.getChildren()) {
                jobs.add(MapleDataTool.getInt(applicableJob));
            }
        }
        skillData.put(skillid, new SkillData(skillid, skillLevel, masterLevel, jobs));
    }
}
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