|
@@ -72,9 +72,6 @@ public class LoginController
|
|
|
protected byte[][] _blowfishKeys;
|
|
|
private static final int BLOWFISH_KEYS = 20;
|
|
|
|
|
|
- private static final String ACCESS_LEVEL_SELECT = "SELECT IF(? > value OR value IS NULL, accessLevel, -100) AS accessLevel " +
|
|
|
- "FROM accounts LEFT JOIN (account_data) ON (account_data.account_name=accounts.login AND account_data.var=\"ban_temp\") WHERE login=?";
|
|
|
-
|
|
|
private static final String USER_INFO_SELECT = "SELECT password, IF(? > value OR value IS NULL, accessLevel, -100) AS accessLevel, lastServer, userIp " +
|
|
|
"FROM accounts LEFT JOIN (account_data) ON (account_data.account_name=accounts.login AND account_data.var=\"ban_temp\") WHERE login=?";
|
|
|
|
|
@@ -180,11 +177,6 @@ public class LoginController
|
|
|
_loginServerClients.remove(account);
|
|
|
}
|
|
|
|
|
|
- public boolean isAccountInLoginServer(String account)
|
|
|
- {
|
|
|
- return _loginServerClients.containsKey(account);
|
|
|
- }
|
|
|
-
|
|
|
public L2LoginClient getAuthedClient(String account)
|
|
|
{
|
|
|
return _loginServerClients.get(account);
|
|
@@ -321,16 +313,6 @@ public class LoginController
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public int getOnlinePlayerCount(int serverId)
|
|
|
- {
|
|
|
- GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId);
|
|
|
- if (gsi != null && gsi.isAuthed())
|
|
|
- {
|
|
|
- return gsi.getCurrentPlayerCount();
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
public boolean isAccountInAnyGameServer(String account)
|
|
|
{
|
|
|
Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values();
|
|
@@ -359,20 +341,6 @@ public class LoginController
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public int getTotalOnlinePlayerCount()
|
|
|
- {
|
|
|
- int total = 0;
|
|
|
- Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values();
|
|
|
- for (GameServerInfo gsi : serverList)
|
|
|
- {
|
|
|
- if (gsi.isAuthed())
|
|
|
- {
|
|
|
- total += gsi.getCurrentPlayerCount();
|
|
|
- }
|
|
|
- }
|
|
|
- return total;
|
|
|
- }
|
|
|
-
|
|
|
public void getCharactersOnAccount(String account)
|
|
|
{
|
|
|
Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values();
|
|
@@ -383,16 +351,6 @@ public class LoginController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public int getMaxAllowedOnlinePlayers(int id)
|
|
|
- {
|
|
|
- GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(id);
|
|
|
- if (gsi != null)
|
|
|
- {
|
|
|
- return gsi.getMaxPlayers();
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
*
|
|
|
* @return
|
|
@@ -516,47 +474,6 @@ public class LoginController
|
|
|
client.serCharsWaitingDelOnServ(serverId, timeToDel);
|
|
|
}
|
|
|
|
|
|
- public boolean isGM(String user)
|
|
|
- {
|
|
|
- boolean ok = false;
|
|
|
- Connection con = null;
|
|
|
- PreparedStatement statement = null;
|
|
|
- try
|
|
|
- {
|
|
|
- con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
- statement = con.prepareStatement(ACCESS_LEVEL_SELECT);
|
|
|
- statement.setString(1, Long.toString(System.currentTimeMillis()));
|
|
|
- statement.setString(2, user);
|
|
|
- ResultSet rset = statement.executeQuery();
|
|
|
- if (rset.next())
|
|
|
- {
|
|
|
- int accessLevel = rset.getInt(1);
|
|
|
- if (accessLevel > 0)
|
|
|
- {
|
|
|
- ok = true;
|
|
|
- }
|
|
|
- }
|
|
|
- rset.close();
|
|
|
- statement.close();
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- _log.log(Level.WARNING, "Could not check gm state:" + e.getMessage(), e);
|
|
|
- ok = false;
|
|
|
- }
|
|
|
- finally
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- L2DatabaseFactory.close(con);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- }
|
|
|
- }
|
|
|
- return ok;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* <p>This method returns one of the cached {@link ScrambledKeyPair ScrambledKeyPairs} for communication with Login Clients.</p>
|
|
|
* @return a scrambled keypair
|
|
@@ -775,48 +692,6 @@ public class LoginController
|
|
|
|
|
|
return ok;
|
|
|
}
|
|
|
-
|
|
|
- public boolean loginBanned(String user)
|
|
|
- {
|
|
|
- boolean ok = false;
|
|
|
-
|
|
|
- Connection con = null;
|
|
|
- try
|
|
|
- {
|
|
|
- con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
- PreparedStatement statement = con.prepareStatement(ACCESS_LEVEL_SELECT);
|
|
|
- statement.setString(1, Long.toString(System.currentTimeMillis()));
|
|
|
- statement.setString(2, user);
|
|
|
- ResultSet rset = statement.executeQuery();
|
|
|
- if (rset.next())
|
|
|
- {
|
|
|
- int accessLevel = rset.getInt(1);
|
|
|
- if (accessLevel < 0)
|
|
|
- ok = true;
|
|
|
- }
|
|
|
- rset.close();
|
|
|
- statement.close();
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- // digest algo not found ??
|
|
|
- // out of bounds should not be possible
|
|
|
- _log.log(Level.WARNING, "Could not check ban state:" + e.getMessage(), e);
|
|
|
- ok = false;
|
|
|
- }
|
|
|
- finally
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- L2DatabaseFactory.close(con);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return ok;
|
|
|
- }
|
|
|
|
|
|
public boolean isValidIPAddress(String ipAddress)
|
|
|
{
|