use of provider.MapleData in project HeavenMS by ronancpl.
the class MapleItemInformationProvider method getItemLevelupStats.
public List<Pair<String, Integer>> getItemLevelupStats(int itemId, int level) {
List<Pair<String, Integer>> list = new LinkedList<>();
MapleData data = getItemData(itemId);
MapleData data1 = data.getChildByPath("info").getChildByPath("level");
if (data1 != null) {
MapleData data2 = data1.getChildByPath("info").getChildByPath(Integer.toString(level));
if (data2 != null) {
for (MapleData da : data2.getChildren()) {
if (Math.random() < 0.9) {
if (da.getName().startsWith("incDEXMin")) {
list.add(new Pair<>("incDEX", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incDEXMax")))));
} else if (da.getName().startsWith("incSTRMin")) {
list.add(new Pair<>("incSTR", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incSTRMax")))));
} else if (da.getName().startsWith("incINTMin")) {
list.add(new Pair<>("incINT", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incINTMax")))));
} else if (da.getName().startsWith("incLUKMin")) {
list.add(new Pair<>("incLUK", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incLUKMax")))));
} else if (da.getName().startsWith("incMHPMin")) {
list.add(new Pair<>("incMHP", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incMHPMax")))));
} else if (da.getName().startsWith("incMMPMin")) {
list.add(new Pair<>("incMMP", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incMMPMax")))));
} else if (da.getName().startsWith("incPADMin")) {
list.add(new Pair<>("incPAD", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incPADMax")))));
} else if (da.getName().startsWith("incMADMin")) {
list.add(new Pair<>("incMAD", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incMADMax")))));
} else if (da.getName().startsWith("incPDDMin")) {
list.add(new Pair<>("incPDD", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incPDDMax")))));
} else if (da.getName().startsWith("incMDDMin")) {
list.add(new Pair<>("incMDD", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incMDDMax")))));
} else if (da.getName().startsWith("incACCMin")) {
list.add(new Pair<>("incACC", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incACCMax")))));
} else if (da.getName().startsWith("incEVAMin")) {
list.add(new Pair<>("incEVA", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incEVAMax")))));
} else if (da.getName().startsWith("incSpeedMin")) {
list.add(new Pair<>("incSpeed", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incSpeedMax")))));
} else if (da.getName().startsWith("incJumpMin")) {
list.add(new Pair<>("incJump", Randomizer.rand(MapleDataTool.getInt(da), MapleDataTool.getInt(data2.getChildByPath("incJumpMax")))));
}
}
}
}
}
return list;
}
use of provider.MapleData in project HeavenMS by ronancpl.
the class MapleItemInformationProvider method getMsg.
public String getMsg(int itemId) {
if (msgCache.containsKey(itemId)) {
return msgCache.get(itemId);
}
MapleData strings = getStringData(itemId);
if (strings == null) {
return null;
}
String ret = MapleDataTool.getString("msg", strings, null);
msgCache.put(itemId, ret);
return ret;
}
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;
}
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;
}
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;
}
Aggregations