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;
}
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;
}
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;
}
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;
}
}
}
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));
}
}
Aggregations