return classId;
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata)
{
CharSelectInfoPackage charInfopackage = null;
try
{
int objectId = chardata.getInt("obj_Id");
int classid = chardata.getInt("class_id");
int[] baseClassId = new int[]
{
classid,
chardata.getInt("default_class_id")
};
boolean useBaseClass = chardata.getInt("type") == SubClassType.BASE_CLASS.ordinal();
if (!useBaseClass)
{
baseClassId = restoreBaseClassId(objectId);
}
Race race = ClassId.VALUES[baseClassId[1]].getRace();
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(chardata.getInt("level"));
charInfopackage.setMaxHp(chardata.getInt("maxHp"));
charInfopackage.setCurrentHp(chardata.getDouble("curHp"));
charInfopackage.setMaxMp(chardata.getInt("maxMp"));
charInfopackage.setCurrentMp(chardata.getDouble("curMp"));
charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
charInfopackage.setPk(chardata.getInt("pkkills"));
charInfopackage.setPvP(chardata.getInt("pvpkills"));
charInfopackage.setFace(chardata.getInt("face"));
charInfopackage.setHairStyle(chardata.getInt("hairstyle"));
charInfopackage.setHairColor(chardata.getInt("haircolor"));
charInfopackage.setSex(chardata.getInt("sex"));
charInfopackage.setExp(chardata.getLong("exp"));
charInfopackage.setSp(chardata.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(race.ordinal());
charInfopackage.setClassId(classid);
charInfopackage.setBaseClassId(baseClassId[0]);
long deletetime = chardata.getLong("deletetime");
int deletedays = 0;
if (Config.DELETE_DAYS > 0)
if (deletetime > 0)
{
deletetime = (int) (System.currentTimeMillis() / 1000 - deletetime);
deletedays = (int) (deletetime / 3600 / 24);
if (deletedays >= Config.DELETE_DAYS)
{
CharacterDAO.getInstance().deleteCharByObjId(objectId);
return null;
}
deletetime = Config.DELETE_DAYS * 3600 * 24 - deletetime;
}
else
deletetime = 0;
charInfopackage.setDeleteTimer((int) deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess") * 1000L);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));
if (charInfopackage.getAccessLevel() < 0 && !AutoBan.isBanned(objectId))
charInfopackage.setAccessLevel(0);
}
catch (Exception e)
{
_log.error("", e);
}