return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata, ResultSet charclass)
{
CharSelectInfoPackage charInfopackage = null;
try
{
int objectId = chardata.getInt("obj_Id");
int classid = charclass.getInt("class_id");
boolean female = chardata.getInt("sex") == 1;
L2PlayerTemplate templ = CharTemplateTable.getInstance().getTemplate(classid, female);
if(templ == null)
{
_log.log(Level.WARNING, "restoreChar fail | templ == null | objectId: " + objectId + " | classid: " + classid + " | female: " + female);
return null;
}
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(charclass.getInt("level"));
charInfopackage.setMaxHp(charclass.getInt("maxHp"));
charInfopackage.setCurrentHp(charclass.getDouble("curHp"));
charInfopackage.setMaxMp(charclass.getInt("maxMp"));
charInfopackage.setCurrentMp(charclass.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(female ? 1 : 0);
charInfopackage.setExp(charclass.getLong("exp"));
charInfopackage.setSp(charclass.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(templ.race.ordinal());
charInfopackage.setClassId(classid);
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)
{
PlayerManager.deleteFromClan(objectId, charInfopackage.getClanId());
PlayerManager.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.log(Level.INFO, "", e);