MapleSolaxiaV2 Revision 1

Edited Ranking system.
This commit is contained in:
ronancpl
2015-11-06 13:22:14 -02:00
parent 26c3caf63f
commit 090aea9891
3 changed files with 24 additions and 6 deletions

View File

@@ -32,10 +32,12 @@ public class ServerConstants {
public static final boolean USE_PARTY_SEARCH = false;
public static final boolean USE_AUTOBAN = false; //commands the server to detect infractors automatically.
public static final boolean USE_ANOTHER_AUTOASSIGN = true; //based on distributing AP accordingly with higher secondary stat on equipments.
public static final boolean USE_REFRESH_RANK_MOVE = true;
public static final int MAX_AP = 999;
public static final long BLOCK_DUEY_RACE_COND = (long)(0.5 * 1000);
public static final long PET_LOOT_UPON_ATTACK = (long)(0.8 * 1000); //time the pet must wait before trying to pick items up.
public static final long PET_LOOT_UPON_ATTACK = (long)(0.7 * 1000); //time the pet must wait before trying to pick items up.
//Some Gameplay Enhancing Configurations
public static final boolean USE_PERFECT_SCROLLING = true; //scrolls doesn't use slots upon failure.
public static final boolean USE_ENHANCED_CHSCROLL = true; //equips even more powerful with chaos upgrade

View File

@@ -27,6 +27,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import client.MapleJob;
import tools.DatabaseConnection;
import constants.ServerConstants;
/**
* @author Matze
@@ -35,11 +36,17 @@ import tools.DatabaseConnection;
public class RankingWorker implements Runnable {
private Connection con;
private long lastUpdate = System.currentTimeMillis();
public void run() {
try {
con = DatabaseConnection.getConnection();
con.setAutoCommit(false);
if(ServerConstants.USE_REFRESH_RANK_MOVE == true) {
resetMoveRank(true);
resetMoveRank(false);
}
updateRanking(null);
for (int i = 0; i < 3; i += 2) {
for (int j = 1; j < 6; j++) {
@@ -50,13 +57,22 @@ public class RankingWorker implements Runnable {
con.setAutoCommit(true);
lastUpdate = System.currentTimeMillis();
} catch (SQLException ex) {
ex.printStackTrace();
try {
con.rollback();
con.setAutoCommit(true);
} catch (SQLException ex2) {
ex2.printStackTrace();
}
}
}
private void resetMoveRank(boolean job) throws SQLException {
String query = "UPDATE characters SET " + (job == true ? "jobRankMove = 0" : "rankMove = 0");
PreparedStatement reset = con.prepareStatement(query);
ResultSet rs = reset.executeQuery();
}
private void updateRanking(MapleJob job) throws SQLException {
String sqlCharSelect = "SELECT c.id, " + (job != null ? "c.jobRank, c.jobRankMove" : "c.rank, c.rankMove") + ", a.lastlogin AS lastlogin, a.loggedin FROM characters AS c LEFT JOIN accounts AS a ON c.accountid = a.id WHERE c.gm = 0 ";

View File

@@ -168,11 +168,11 @@ public class Server implements Runnable {
MapleItemInformationProvider.getInstance().getAllItems();
CashItemFactory.getSpecialCashItems();
System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n");
System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds");
timeToTake = System.currentTimeMillis();
MapleQuest.loadAllQuest();
System.out.println("Quest loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n");
timeToTake = System.currentTimeMillis();
MapleQuest.loadAllQuest();
System.out.println("Quest loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n");
try {