📄 mapleiteminformationprovider.java
字号:
return null;
for (MapleData data : info.getChildren()) {
if (data.getName().startsWith("inc")) {
ret.put(data.getName().substring(3), MapleDataTool.getIntConvert(data));
}
}
ret.put("tuc", MapleDataTool.getInt("tuc", info, 0));
ret.put("reqLevel", MapleDataTool.getInt("reqLevel", info, 0));
ret.put("cursed", MapleDataTool.getInt("cursed", info, 0));
ret.put("success", MapleDataTool.getInt("success", info, 0));
equipStatsCache.put(itemId, ret);
return ret;
}
public MapleWeaponType getWeaponType (int itemId) {
int cat = itemId / 10000;
cat = cat % 100;
switch (cat) {
case 30:
return MapleWeaponType.SWORD1H;
case 31:
return MapleWeaponType.AXE1H;
case 32:
return MapleWeaponType.BLUNT1H;
case 33:
return MapleWeaponType.DAGGER;
case 37:
return MapleWeaponType.WAND;
case 38:
return MapleWeaponType.STAFF;
case 40:
return MapleWeaponType.SWORD2H;
case 41:
return MapleWeaponType.AXE2H;
case 42:
return MapleWeaponType.BLUNT2H;
case 43:
return MapleWeaponType.SPEAR;
case 44:
return MapleWeaponType.POLE_ARM;
case 45:
return MapleWeaponType.BOW;
case 47:
return MapleWeaponType.CLAW;
case 46:
return MapleWeaponType.CROSSBOW;
}
return MapleWeaponType.NOT_A_WEAPON;
}
public boolean isShield(int itemId) {
int cat = itemId / 10000;
cat = cat % 100;;
return cat == 9;
}
public boolean isEquip (int itemId) {
return itemId / 1000000 == 1;
}
public IItem scrollEquipWithId(IItem equip, int scrollId) {
if (equip instanceof Equip) {
Equip nEquip = (Equip) equip;
Map<String, Integer> stats = this.getEquipStats(scrollId);
if (nEquip.getUpgradeSlots() > 0 && Math.ceil(Math.random() * 100.0) <= stats.get("success")) {
for (Entry<String, Integer> stat : stats.entrySet()) {
if (stat.getKey().equals("STR"))
nEquip.setStr((short) (nEquip.getStr() + stat.getValue().intValue()));
else if (stat.getKey().equals("DEX"))
nEquip.setDex((short) (nEquip.getDex() + stat.getValue().intValue()));
else if (stat.getKey().equals("INT"))
nEquip.setInt((short) (nEquip.getInt() + stat.getValue().intValue()));
else if (stat.getKey().equals("LUK"))
nEquip.setLuk((short) (nEquip.getLuk() + stat.getValue().intValue()));
else if (stat.getKey().equals("PAD"))
nEquip.setWatk((short) (nEquip.getWatk() + stat.getValue().intValue()));
else if (stat.getKey().equals("PDD"))
nEquip.setWdef((short) (nEquip.getWdef() + stat.getValue().intValue()));
else if (stat.getKey().equals("MAD"))
nEquip.setMatk((short) (nEquip.getMatk() + stat.getValue().intValue()));
else if (stat.getKey().equals("MDD"))
nEquip.setMdef((short) (nEquip.getMdef() + stat.getValue().intValue()));
else if (stat.getKey().equals("ACC"))
nEquip.setAcc((short) (nEquip.getAcc() + stat.getValue().intValue()));
else if (stat.getKey().equals("EVA"))
nEquip.setAvoid((short) (nEquip.getAvoid() + stat.getValue().intValue()));
else if (stat.getKey().equals("Speed"))
nEquip.setSpeed((short) (nEquip.getSpeed() + stat.getValue().intValue()));
else if (stat.getKey().equals("Jump"))
nEquip.setJump((short) (nEquip.getJump() + stat.getValue().intValue()));
else if (stat.getKey().equals("MHP"))
nEquip.setHp((short) (nEquip.getHp() + stat.getValue().intValue()));
else if (stat.getKey().equals("MMP"))
nEquip.setMp((short) (nEquip.getMp() + stat.getValue().intValue()));
else if (stat.getKey().equals("afterImage")) {
}
}
nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1));
nEquip.setLevel((byte) (nEquip.getLevel() + 1));
} else {
nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1));
if (Math.ceil(1.0 + Math.random() * 100.0) < stats.get("cursed")) {
// DESTROY :) (O.O!)
return null;
}
}
}
return equip;
}
public IItem getEquipById(int equipId) {
if (equipCache.containsKey(equipId))
return equipCache.get(equipId).copy();
Equip nEquip = new Equip(equipId, (byte) 0);
nEquip.setQuantity((short) 1);
Map<String, Integer> stats = this.getEquipStats(equipId);
if (stats != null) {
for (Entry<String, Integer> stat : stats.entrySet()) {
if (stat.getKey().equals("STR"))
nEquip.setStr((short) stat.getValue().intValue());
else if (stat.getKey().equals("DEX"))
nEquip.setDex((short) stat.getValue().intValue());
else if (stat.getKey().equals("INT"))
nEquip.setInt((short) stat.getValue().intValue());
else if (stat.getKey().equals("LUK"))
nEquip.setLuk((short) stat.getValue().intValue());
else if (stat.getKey().equals("PAD"))
nEquip.setWatk((short) stat.getValue().intValue());
else if (stat.getKey().equals("PDD"))
nEquip.setWdef((short) stat.getValue().intValue());
else if (stat.getKey().equals("MAD"))
nEquip.setMatk((short) stat.getValue().intValue());
else if (stat.getKey().equals("MDD"))
nEquip.setMdef((short) stat.getValue().intValue());
else if (stat.getKey().equals("ACC"))
nEquip.setAcc((short) stat.getValue().intValue());
else if (stat.getKey().equals("EVA"))
nEquip.setAvoid((short) stat.getValue().intValue());
else if (stat.getKey().equals("Speed"))
nEquip.setSpeed((short) stat.getValue().intValue());
else if (stat.getKey().equals("Jump"))
nEquip.setJump((short) stat.getValue().intValue());
else if (stat.getKey().equals("MHP"))
nEquip.setHp((short) stat.getValue().intValue());
else if (stat.getKey().equals("MMP"))
nEquip.setMp((short) stat.getValue().intValue());
else if (stat.getKey().equals("tuc"))
nEquip.setUpgradeSlots((byte) stat.getValue().intValue());
else if (stat.getKey().equals("afterImage")) {
}
}
}
equipCache.put(equipId, nEquip);
return nEquip.copy();
}
public Equip randomizeStats(Equip equip) {
equip.setStr((short) ((equip.getStr() - Math.min(Math.ceil(equip.getStr() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getStr() * 0.1) * 2, 10) + 1))));
equip.setDex((short) ((equip.getDex() - Math.min(Math.ceil(equip.getDex() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getDex() * 0.1) * 2, 10) + 1))));
equip.setInt((short) ((equip.getInt() - Math.min(Math.ceil(equip.getInt() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getInt() * 0.1) * 2, 10) + 1))));
equip.setLuk((short) ((equip.getLuk() - Math.min(Math.ceil(equip.getLuk() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getLuk() * 0.1) * 2, 10) + 1))));
equip.setMatk((short) ((equip.getMatk() - Math.min(Math.ceil(equip.getMatk() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getMatk() * 0.1) * 2, 10) + 1))));
equip.setWatk((short) ((equip.getWatk() - Math.min(Math.ceil(equip.getWatk() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getWatk() * 0.1) * 2, 10) + 1))));
equip.setAcc((short) ((equip.getAcc() - Math.min(Math.ceil(equip.getAcc() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getAcc() * 0.1) * 2, 10) + 1))));
equip.setAvoid((short) ((equip.getAvoid() - Math.min(Math.ceil(equip.getAvoid() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getAvoid() * 0.1) * 2, 10) + 1))));
equip.setJump((short) ((equip.getJump() - Math.min(Math.ceil(equip.getJump() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getJump() * 0.1) * 2, 10) + 1))));
equip.setSpeed((short) ((equip.getSpeed() - Math.min(Math.ceil(equip.getSpeed() * 0.1), 5)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getSpeed() * 0.1) * 2, 10) + 1))));
equip.setWdef((short) ((equip.getWdef() - Math.min(Math.ceil(equip.getWdef() * 0.1), 10)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getWdef() * 0.1) * 2, 20) + 1))));
equip.setMdef((short) ((equip.getMdef() - Math.min(Math.ceil(equip.getMdef() * 0.1), 10)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getMdef() * 0.1) * 2, 20) + 1))));
equip.setMp((short) ((equip.getMp() - Math.min(Math.ceil(equip.getMp() * 0.1), 10)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getMp() * 0.1) * 2, 20) + 1))));
equip.setHp((short) ((equip.getHp() - Math.min(Math.ceil(equip.getHp() * 0.1), 10)) +
Math.floor(Math.random() * (Math.min(Math.ceil(equip.getHp() * 0.1) * 2, 20) + 1))));
return equip;
}
public MapleStatEffect getItemEffect(int itemId) {
MapleStatEffect ret = itemEffects.get(Integer.valueOf(itemId));
if (ret == null) {
MapleData item = getItemData(itemId);
if (item == null)
return null;
MapleData spec = item.getChildByPath("spec");
ret = MapleStatEffect.loadItemEffectFromData(spec, itemId);
itemEffects.put(Integer.valueOf(itemId), ret);
}
return ret;
}
public boolean isThrowingStar(int itemId) {
return itemId >= 2070000 && itemId < 2080000;
}
public boolean isOverall(int itemId) {
return itemId >= 1050000 && itemId < 1060000;
}
public boolean isArrowForCrossBow(int itemId) {
return itemId >= 2061000 && itemId < 2062000;
}
public boolean isArrowForBow(int itemId) {
return itemId >= 2060000 && itemId < 2061000;
}
public boolean isTwoHanded(int itemId) {
switch (getWeaponType(itemId)) {
case AXE2H:
return true;
case BLUNT2H:
return true;
case BOW:
return true;
case CLAW:
return true;
case CROSSBOW:
return true;
case POLE_ARM:
return true;
case SPEAR:
return true;
case SWORD2H:
return true;
default:
return false;
}
}
public int getWatkForProjectile(int itemId) {
Integer atk = projectileWatkCache.get(itemId);
if (atk != null) {
return atk.intValue();
}
MapleData data = getItemData(itemId);
atk = Integer.valueOf(MapleDataTool.getInt("info/incPAD", data, 0));
projectileWatkCache.put(itemId, atk);
return atk.intValue();
}
public boolean canScroll (int scrollid, int itemid) {
int scrollCategoryQualifier = (scrollid / 100) % 100;
int itemCategoryQualifier = (itemid / 10000) % 100;
return scrollCategoryQualifier == itemCategoryQualifier;
}
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;
}
public String getDesc(int itemId) {
if (descCache.containsKey(itemId))
return descCache.get(itemId);
MapleData strings = getStringData(itemId);
if (strings == null) return null;
String ret = MapleDataTool.getString("desc", strings, null);
descCache.put(itemId, ret);
return ret;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -