Revised skillbook drops. New drop chances are related to the holder's level and boss flag. Adjusted party bonus EXP gains. The level difference calculation now only takes into account party members that participated in the action. Implemented Party Search in the source. Refactored command classes initialization to take place when booting up the server. Implemented support for conditional buffs (e.g. card buffs that takes place only in certain areas). Implemented topological sorting when updating buffs to the player, this allows a better vision of buff streaks to the player (buff-applying the original way assumes stat override client-side, to circumvent that this algorithm makes up for the best-fit scenario). Fixed Arans not taking Dojo's attack speed buff properly. Fixed pets being improperly removed from the DB after performing certain inventory actions.
146 lines
4.6 KiB
Java
146 lines
4.6 KiB
Java
/*
|
|
This file is part of the OdinMS Maple Story Server
|
|
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
Matthias Butz <matze@odinms.de>
|
|
Jan Christian Meyer <vimes@odinms.de>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation version 3 as published by
|
|
the Free Software Foundation. You may not use, modify or distribute
|
|
this program under any other version of the GNU Affero General Public
|
|
License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package provider;
|
|
|
|
import java.awt.Point;
|
|
import java.awt.image.BufferedImage;
|
|
import provider.wz.MapleDataType;
|
|
|
|
public class MapleDataTool {
|
|
public static String getString(MapleData data) {
|
|
return ((String) data.getData());
|
|
}
|
|
|
|
public static String getString(MapleData data, String def) {
|
|
if (data == null || data.getData() == null) {
|
|
return def;
|
|
} else {
|
|
return ((String) data.getData());
|
|
}
|
|
}
|
|
|
|
public static String getString(String path, MapleData data) {
|
|
return getString(data.getChildByPath(path));
|
|
}
|
|
|
|
public static String getString(String path, MapleData data, String def) {
|
|
return getString(data.getChildByPath(path), def);
|
|
}
|
|
|
|
public static double getDouble(MapleData data) {
|
|
return ((Double) data.getData()).doubleValue();
|
|
}
|
|
|
|
public static float getFloat(MapleData data) {
|
|
return ((Float) data.getData()).floatValue();
|
|
}
|
|
|
|
public static int getInt(MapleData data) {
|
|
if (data == null || data.getData() == null) {
|
|
return 0;// DEF?
|
|
}
|
|
return ((Integer) data.getData()).intValue();
|
|
}
|
|
|
|
public static int getInt(String path, MapleData data) {
|
|
return getInt(data.getChildByPath(path));
|
|
}
|
|
|
|
public static int getIntConvert(MapleData data) {
|
|
if (data.getType() == MapleDataType.STRING) {
|
|
return Integer.parseInt(getString(data));
|
|
} else {
|
|
return getInt(data);
|
|
}
|
|
}
|
|
|
|
public static int getIntConvert(String path, MapleData data) {
|
|
MapleData d = data.getChildByPath(path);
|
|
if (d.getType() == MapleDataType.STRING) {
|
|
return Integer.parseInt(getString(d));
|
|
} else {
|
|
return getInt(d);
|
|
}
|
|
}
|
|
|
|
public static int getInt(MapleData data, int def) {
|
|
if (data == null || data.getData() == null) {
|
|
return def;
|
|
} else if (data.getType() == MapleDataType.STRING) {
|
|
return Integer.parseInt(getString(data));
|
|
} else {
|
|
return ((Integer) data.getData()).intValue();
|
|
}
|
|
}
|
|
|
|
public static int getInt(String path, MapleData data, int def) {
|
|
return getInt(data.getChildByPath(path), def);
|
|
}
|
|
|
|
public static int getIntConvert(String path, MapleData data, int def) {
|
|
MapleData d = data.getChildByPath(path);
|
|
if (d == null) {
|
|
return def;
|
|
}
|
|
if (d.getType() == MapleDataType.STRING) {
|
|
try {
|
|
return Integer.parseInt(getString(d));
|
|
} catch (NumberFormatException nfe) {
|
|
nfe.printStackTrace();
|
|
return def;
|
|
}
|
|
} else {
|
|
return getInt(d, def);
|
|
}
|
|
}
|
|
|
|
public static BufferedImage getImage(MapleData data) {
|
|
return ((MapleCanvas) data.getData()).getImage();
|
|
}
|
|
|
|
public static Point getPoint(MapleData data) {
|
|
return ((Point) data.getData());
|
|
}
|
|
|
|
public static Point getPoint(String path, MapleData data) {
|
|
return getPoint(data.getChildByPath(path));
|
|
}
|
|
|
|
public static Point getPoint(String path, MapleData data, Point def) {
|
|
final MapleData pointData = data.getChildByPath(path);
|
|
if (pointData == null) {
|
|
return def;
|
|
}
|
|
return getPoint(pointData);
|
|
}
|
|
|
|
public static String getFullDataPath(MapleData data) {
|
|
String path = "";
|
|
MapleDataEntity myData = data;
|
|
while (myData != null) {
|
|
path = myData.getName() + "/" + path;
|
|
myData = myData.getParent();
|
|
}
|
|
return path.substring(0, path.length() - 1);
|
|
}
|
|
}
|