Sort rankings by time of last EXP gain (#352)
* Sort rankings by time of last EXP gain * Fix prepared values order
This commit is contained in:
@@ -314,6 +314,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private int banishMap = -1;
|
||||
private int banishSp = -1;
|
||||
private long banishTime = 0;
|
||||
private long lastExpGainTime;
|
||||
|
||||
private MapleCharacter() {
|
||||
super.setListener(new AbstractCharacterListener() {
|
||||
@@ -2917,7 +2918,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
if(leftover > 0) gainExpInternal(leftover, equip, party, false, inChat, white);
|
||||
if(leftover > 0) {
|
||||
gainExpInternal(leftover, equip, party, false, inChat, white);
|
||||
} else {
|
||||
lastExpGainTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6411,6 +6416,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ret.mgc = new MapleGuildCharacter(ret);
|
||||
int buddyCapacity = rs.getInt("buddyCapacity");
|
||||
ret.buddylist = new BuddyList(buddyCapacity);
|
||||
ret.lastExpGainTime = rs.getTimestamp("lastExpGainTime").getTime();
|
||||
|
||||
ret.getInventory(MapleInventoryType.EQUIP).setSlotLimit(rs.getByte("equipslots"));
|
||||
ret.getInventory(MapleInventoryType.USE).setSlotLimit(rs.getByte("useslots"));
|
||||
@@ -7643,7 +7649,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||
con.setAutoCommit(false);
|
||||
PreparedStatement ps;
|
||||
ps = con.prepareStatement("UPDATE characters SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, exp = ?, gachaexp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, meso = ?, hpMpUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, mountlevel = ?, mountexp = ?, mounttiredness= ?, equipslots = ?, useslots = ?, setupslots = ?, etcslots = ?, monsterbookcover = ?, vanquisherStage = ?, dojoPoints = ?, lastDojoStage = ?, finishedDojoTutorial = ?, vanquisherKills = ?, matchcardwins = ?, matchcardlosses = ?, matchcardties = ?, omokwins = ?, omoklosses = ?, omokties = ?, dataString = ?, fquest = ?, jailexpire = ?, partnerId = ?, marriageItemId = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS);
|
||||
ps = con.prepareStatement("UPDATE characters SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, exp = ?, gachaexp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, meso = ?, hpMpUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, mountlevel = ?, mountexp = ?, mounttiredness= ?, equipslots = ?, useslots = ?, setupslots = ?, etcslots = ?, monsterbookcover = ?, vanquisherStage = ?, dojoPoints = ?, lastDojoStage = ?, finishedDojoTutorial = ?, vanquisherKills = ?, matchcardwins = ?, matchcardlosses = ?, matchcardties = ?, omokwins = ?, omoklosses = ?, omokties = ?, dataString = ?, fquest = ?, jailexpire = ?, partnerId = ?, marriageItemId = ?, lastExpGainTime = ? WHERE id = ?", Statement.RETURN_GENERATED_KEYS);
|
||||
if (gmLevel < 1 && level > 199) {
|
||||
ps.setInt(1, isCygnus() ? 120 : 200);
|
||||
} else {
|
||||
@@ -7756,7 +7762,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ps.setLong(50, jailExpiration);
|
||||
ps.setInt(51, partnerId);
|
||||
ps.setInt(52, marriageItemid);
|
||||
ps.setInt(53, id);
|
||||
ps.setTimestamp(53, new Timestamp(lastExpGainTime));
|
||||
ps.setInt(54, id);
|
||||
|
||||
int updateRows = ps.executeUpdate();
|
||||
ps.close();
|
||||
|
||||
@@ -784,7 +784,7 @@ public class Server {
|
||||
worldQuery = (" AND `characters`.`world` >= 0 AND `characters`.`world` <= " + Math.abs(worldid));
|
||||
}
|
||||
|
||||
ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level`, `characters`.`world` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` < 2 AND `accounts`.`banned` = '0'" + worldQuery + " ORDER BY " + (!ServerConstants.USE_WHOLE_SERVER_RANKING ? "world, " : "") + "level DESC, exp DESC LIMIT 50");
|
||||
ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level`, `characters`.`world` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` < 2 AND `accounts`.`banned` = '0'" + worldQuery + " ORDER BY " + (!ServerConstants.USE_WHOLE_SERVER_RANKING ? "world, " : "") + "level DESC, exp DESC, lastExpGainTime ASC LIMIT 50");
|
||||
rs = ps.executeQuery();
|
||||
|
||||
if (!ServerConstants.USE_WHOLE_SERVER_RANKING) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class RankingLoginWorker implements Runnable {
|
||||
if (job != -1) {
|
||||
sqlCharSelect += "AND c.job DIV 100 = ? ";
|
||||
}
|
||||
sqlCharSelect += "ORDER BY c.level DESC , c.exp DESC , c.fame DESC , c.meso DESC";
|
||||
sqlCharSelect += "ORDER BY c.level DESC , c.exp DESC , c.lastExpGainTime ASC, c.fame DESC , c.meso DESC";
|
||||
|
||||
PreparedStatement charSelect = con.prepareStatement(sqlCharSelect);
|
||||
charSelect.setInt(1, world);
|
||||
|
||||
Reference in New Issue
Block a user