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;
}
use of provider.MapleData in project HeavenMS by ronancpl.
the class MapleItemInformationProvider method getAllItems.
// public MapleInventoryType getInventoryType(int itemId) {
// if (inventoryTypeCache.containsKey(itemId)) {
// return inventoryTypeCache.get(itemId);
// }
// MapleInventoryType ret;
// 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 = MapleInventoryType.getByWZName(topDir.getName());
// inventoryTypeCache.put(itemId, ret);
// return ret;
// } else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
// ret = MapleInventoryType.getByWZName(topDir.getName());
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
// }
// }
// root = equipData.getRoot();
// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
// for (MapleDataFileEntry iFile : topDir.getFiles()) {
// if (iFile.getName().equals(idStr + ".img")) {
// ret = MapleInventoryType.EQUIP;
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
// }
// }
// ret = MapleInventoryType.UNDEFINED;
// inventoryTypeCache.put(itemId, ret);
// return ret;
// }
public List<Pair<Integer, String>> getAllItems() {
if (!itemNameCache.isEmpty()) {
return itemNameCache;
}
List<Pair<Integer, String>> itemPairs = new ArrayList<>();
MapleData itemsData;
itemsData = stringData.getData("Cash.img");
for (MapleData itemFolder : itemsData.getChildren()) {
itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
}
itemsData = stringData.getData("Consume.img");
for (MapleData itemFolder : itemsData.getChildren()) {
itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
}
itemsData = stringData.getData("Eqp.img").getChildByPath("Eqp");
for (MapleData eqpType : itemsData.getChildren()) {
for (MapleData itemFolder : eqpType.getChildren()) {
itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
}
}
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")));
}
itemsData = stringData.getData("Ins.img");
for (MapleData itemFolder : itemsData.getChildren()) {
itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME")));
}
itemsData = stringData.getData("Pet.img");
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 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 (ItemConstants.isPet(itemId)) {
theData = petStringData;
} else {
return null;
}
if (cat.equalsIgnoreCase("null")) {
return theData.getChildByPath(String.valueOf(itemId));
} else {
return theData.getChildByPath(cat + "/" + itemId);
}
}
use of provider.MapleData in project HeavenMS by ronancpl.
the class MapleItemInformationProvider method getSummonMobs.
public int[][] getSummonMobs(int itemId) {
MapleData data = getItemData(itemId);
int theInt = data.getChildByPath("mob").getChildren().size();
int[][] mobs2spawn = new int[theInt][2];
for (int x = 0; x < theInt; x++) {
mobs2spawn[x][0] = MapleDataTool.getIntConvert("mob/" + x + "/id", data);
mobs2spawn[x][1] = MapleDataTool.getIntConvert("mob/" + x + "/prob", data);
}
return mobs2spawn;
}
use of provider.MapleData in project HeavenMS by ronancpl.
the class MapleItemInformationProvider method getSlotMax.
public short getSlotMax(MapleClient c, int itemId) {
Short slotMax = slotMaxCache.get(itemId);
if (slotMax != null) {
return (short) (slotMax + getExtraSlotMaxFromPlayer(c, itemId));
}
short ret = 0;
MapleData item = getItemData(itemId);
if (item != null) {
MapleData smEntry = item.getChildByPath("info/slotMax");
if (smEntry == null) {
if (ItemConstants.getInventoryType(itemId).getType() == MapleInventoryType.EQUIP.getType()) {
ret = 1;
} else {
ret = 100;
}
} else {
ret = (short) MapleDataTool.getInt(smEntry);
}
}
slotMaxCache.put(itemId, ret);
return (short) (ret + getExtraSlotMaxFromPlayer(c, itemId));
}
Aggregations