Ir para conteúdo
  • Cadastre-se

[Freya] BR Xtreme Project


Mr.Nobre

Posts recomendados

Você está usando memória demais no seu gameserver diminua um pouco,

Aqui está um tópico como exemplo http://www.l2jbrasil.com/index.php?/topic/116265-erro-ao-iniciar-o-game-server/?hl=mem%F3ria&do=findComment&comment=725427

Editado por Leo >.>'

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites


 

 

Deixa assim seu gameserver.

 

@echo off

title CT2.5 Game Server Console
:start
echo Starting L2 THE WAR Game Server.
echo.
REM -------------------------------------
REM Default parameters for a basic server.
java -Djava.util.logging.manager=ct25.xtreme.util.L2LogManager -Xms1024m -Xmx1024m -cp ./../libs/*;ct25-server.jar ct25.xtreme.gameserver.GameServer
REM
REM If you have a big server and lots of memory, you could experiment for example with
REM java -server -Xmx1536m -Xms1024m -Xmn512m -XX:PermSize=256m -XX:SurvivorRatio=8 -Xnoclassgc -XX:+AggressiveOpts
REM -------------------------------------
if ERRORLEVEL 2 goto restart
if ERRORLEVEL 1 goto error
goto end
:restart
echo.
echo Admin Restart ...
echo.
goto start
:error
echo.
echo Server terminated abnormaly
echo.
:end
echo.
echo server terminated
echo.
pause

Editado por ClodoDeniiz

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

 

 

Uma vez eu era assim como você, pedia sempre isto aqui no tópico até que um dia fiquei uma semana esperando alguém me fazer um favor, e descobri que quando se atinge 100 POSTS você libera uma area chamada Java MODS, nela contem tutoriais e tudo relacionado a Java, inclusive como compilar a REV da BrXtreme, então o meu conselho é, vai para o tópico de ajuda e tenta ajudar o seus amigos da L2 JBrasil ai quando você ajudar muito e atingir 100 Posts você vai conhecer um mundo novo.

 

Vai por mim a melhor coisa do mundo é quando você aprende a fazer as coisas e não precisa mais depender da ajuda das pessoas para compilar uma rev para você, é magica a sensação.

 

 

http://www.mediafire.com/download/ookakgulq4uuhcv/BrXtreme+176.rar

Amigo, vc me deu uma força lá posta a revisão 176 copilada, mas vc teria o Backup dessa revisão ? a minha antiga esta dando erro.
Desculpa pelo transtorno, mas estou tentando aprender fazer o meu melhor !

Você está usando memória demais no seu gameserver diminua um pouco,

Aqui está um tópico como exemplo http://www.l2jbrasil.com/index.php?/topic/116265-erro-ao-iniciar-o-game-server/?hl=mem%F3ria&do=findComment&comment=725427

Muito Obrigado, consegui !!

 

Deixa assim seu gameserver.

 

@echo off

title CT2.5 Game Server Console
:start
echo Starting L2 THE WAR Game Server.
echo.
REM -------------------------------------
REM Default parameters for a basic server.
java -Djava.util.logging.manager=ct25.xtreme.util.L2LogManager -Xms1024m -Xmx1024m -cp ./../libs/*;ct25-server.jar ct25.xtreme.gameserver.GameServer
REM
REM If you have a big server and lots of memory, you could experiment for example with
REM java -server -Xmx1536m -Xms1024m -Xmn512m -XX:PermSize=256m -XX:SurvivorRatio=8 -Xnoclassgc -XX:+AggressiveOpts
REM -------------------------------------
if ERRORLEVEL 2 goto restart
if ERRORLEVEL 1 goto error
goto end
:restart
echo.
echo Admin Restart ...
echo.
goto start
:error
echo.
echo Server terminated abnormaly
echo.
:end
echo.
echo server terminated
echo.
pause

 

Muito Obrigado, consegui !!

Editado por rodrigocarter
Link para o comentário
Compartilhar em outros sites

 

Sim,foi fixado,mais mesmo assim dá pra multiplicar itens pelo processhacker. ^^

Isso não é problema é apenas uma aviso. ^^

Siga Abaixo .

Configure assim.

# ---------------------------------------------------------------------------
# Antharas
# ---------------------------------------------------------------------------
# Delay of appearance time of Antharas. Value is minute. Range 3-60
AntharasWaitTime = 30 "Aqui é o tempo em que o antharas vai aparecer"
# Interval time of Antharas. Value is hour. Range 1-480
IntervalOfAntharasSpawn = 24 "Aqui é o tempo em que ele vai da respawn"
# Random interval. Range 1-192
RandomOfAntharasSpawn = 24 "Aqui é o tempo em que ele pode da respawn random."
Configure assim e teste. ^^
"No caso for Beleth ou Baylor você coloca da spawn nele //spawn "iddoboss" 1 "quantidade" 86400 "time 24hrs"

 

Continuo tendo problema com o respawn dos GRANDBOSS, Antharas e Valakas não nascem em 24hrs, alguém esta com o mesmo problema ? ai eu clonei os GRANDBOSS mas os boss clonados não usam as skills que eles usam normalmente, ex: Antharas usar fear stun esses tipo de coisas, alguém pode me ajudar ??

Editado por rodrigocarter
Link para o comentário
Compartilhar em outros sites

Eu gostaria de saber por parte dos desenvolvedores se o BUG De Duplicação de items já foi fixados sim ou não. ...

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Eu gostaria de saber por parte dos desenvolvedores se o BUG De Duplicação de items já foi fixados sim ou não. ...

Não.

Olá bom dia, alguem pode me dizer se a rev 176 ainda tem muitos bugs? E como estão as classes?

As Classes estão retail.

Mais isso quem configura é você.

Sim tem alguns bugzinho bobo ainda mais tem.

 

Amigo, vc me deu uma força lá posta a revisão 176 copilada, mas vc teria o Backup dessa revisão ? a minha antiga esta dando erro.

Desculpa pelo transtorno, mas estou tentando aprender fazer o meu melhor !

 

Muito Obrigado, consegui !!

 

Muito Obrigado, consegui !!

Diga ai uns mods que vc queria pra ver se já tenho aqui adotado ai adiciono e mando uma rev compilada pra você.

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

 

Encontrei um mod que diz ser um fix na L2JServer

Só não sei se é ...

 

 

 

--- a/L2J_Server_BETA/dist/login/config/LoginServer.properties
+++ b/L2J_Server_BETA/dist/login/config/LoginServer.properties
@@ -39,10 +39,6 @@ LoginPort = 9014
# Security
# ---------------------------------------------------------------------------
-# Logs in file the login server events.
-# Default: True
-LogLoginController = True
-
# How many times you can provide an invalid account/pass before the IP gets banned.
# Default: 5
LoginTryBeforeBan = 5
diff --git a/L2J_Server_BETA/java/com/l2jserver/Config.java b/L2J_Server_BETA/java/com/l2jserver/Config.java
index 330e0a3..0135093 100644
--- a/L2J_Server_BETA/java/com/l2jserver/Config.java
+++ b/L2J_Server_BETA/java/com/l2jserver/Config.java
@@ -948,7 +948,6 @@
public static int REQUEST_ID;
public static boolean RESERVE_HOST_ON_LOGIN = false;
public static List<Integer> PROTOCOL_LIST;
- public static boolean LOG_LOGIN_CONTROLLER;
public static boolean LOGIN_SERVER_SCHEDULE_RESTART;
public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;
@@ -2790,8 +2789,6 @@ else if (Server.serverMode == Server.MODE_LOGINSERVER)
LOGIN_TRY_BEFORE_BAN = ServerSettings.getInt("LoginTryBeforeBan", 5);
LOGIN_BLOCK_AFTER_BAN = ServerSettings.getInt("LoginBlockAfterBan", 900);
- LOG_LOGIN_CONTROLLER = ServerSettings.getBoolean("LogLoginController", true);
-
LOGIN_SERVER_SCHEDULE_RESTART = ServerSettings.getBoolean("LoginRestartSchedule", false);
LOGIN_SERVER_SCHEDULE_RESTART_TIME = ServerSettings.getLong("LoginRestartTime", 24);
diff --git a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
index bac0c6b..6ad5217 100644
--- a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
+++ b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
@@ -27,14 +27,13 @@
import java.util.logging.Logger;
import com.l2jserver.Config;
-import com.l2jserver.util.lib.Log;
/**
* Audits Game Master's actions.
*/
public class GMAudit
{
- private static final Logger _log = Logger.getLogger(Log.class.getName());
+ private static final Logger _log = Logger.getLogger(GMAudit.class.getName());
static
{
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
index 3da9896..3b80a31 100644
--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
@@ -20,6 +20,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
@@ -29,9 +30,9 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -44,12 +45,12 @@
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
+import com.l2jserver.loginserver.model.data.AccountInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.gameserverpackets.ServerStatus;
import com.l2jserver.loginserver.network.serverpackets.LoginFail.LoginFailReason;
import com.l2jserver.util.Rnd;
import com.l2jserver.util.crypt.ScrambledKeyPair;
-import com.l2jserver.util.lib.Log;
/**
* This class ...
@@ -67,9 +68,8 @@
/** Authed Clients on LoginServer */
protected FastMap<String, L2LoginClient> _loginServerClients = new FastMap<String, L2LoginClient>().shared();
- private final Map<String, BanInfo> _bannedIps = new FastMap<String, BanInfo>().shared();
-
- private final Map<InetAddress, FailedLoginAttempt> _hackProtection;
+ private final Map<InetAddress, Integer> _failedLoginAttemps = new HashMap<>();
+ private final Map<InetAddress, Long> _bannedIps = new FastMap<InetAddress, Long>().shared();
protected ScrambledKeyPair[] _keyPairs;
@@ -79,7 +79,7 @@
private static final int BLOWFISH_KEYS = 20;
// SQL Queries
- private static final String USER_INFO_SELECT = "SELECT password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 login, password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 AUTOCREATE_ACCOUNTS_INSERT = "INSERT INTO accounts (login, password, lastactive, accessLevel, lastIP) values (?, ?, ?, ?, ?)";
private static final String ACCOUNT_INFO_UPDATE = "UPDATE accounts SET lastactive = ?, lastIP = ? WHERE login = ?";
private static final String ACCOUNT_LAST_SERVER_UPDATE = "UPDATE accounts SET lastServer = ? WHERE login = ?";
@@ -87,32 +87,10 @@
private static final String ACCOUNT_IPS_UPDATE = "UPDATE accounts SET pcIp = ?, hop1 = ?, hop2 = ?, hop3 = ?, hop4 = ? WHERE login = ?";
private static final String ACCOUNT_IPAUTH_SELECT = "SELECT * FROM accounts_ipauth WHERE login = ?";
- public static void load() throws GeneralSecurityException
- {
- synchronized (LoginController.class)
- {
- if (_instance == null)
- {
- _instance = new LoginController();
- }
- else
- {
- throw new IllegalStateException("LoginController can only be loaded a single time.");
- }
- }
- }
-
- public static LoginController getInstance()
- {
- return _instance;
- }
-
private LoginController() throws GeneralSecurityException
{
_log.info("Loading LoginController...");
- _hackProtection = new FastMap<>();
-
_keyPairs = new ScrambledKeyPair[10];
KeyPairGenerator keygen = null;
@@ -196,57 +174,154 @@ public L2LoginClient getAuthedClient(String account)
return _loginServerClients.get(account);
}
- public static enum AuthLoginResult
+ public AccountInfo retriveAccountInfo(InetAddress clientAddr, String login, String password)
{
- INVALID_PASSWORD,
- ACCOUNT_BANNED,
- ALREADY_ON_LS,
- ALREADY_ON_GS,
- AUTH_SUCCESS
+ return retriveAccountInfo(clientAddr, login, password, true);
}
- public AuthLoginResult tryAuthLogin(String account, String password, L2LoginClient client)
+ private void recordFailedLoginAttemp(InetAddress addr)
{
+ // We need to synchronize this!
+ // When multiple connections from the same address fail to login at the
+ // same time, unexpected behavior can happen.
+ Integer failedLoginAttemps;
+ synchronized (_failedLoginAttemps)
+ {
+ failedLoginAttemps = _failedLoginAttemps.get(addr);
+ if (failedLoginAttemps == null)
+ {
+ failedLoginAttemps = 1;
+ }
+ else
+ {
+ ++failedLoginAttemps;
+ }
+
+ _failedLoginAttemps.put(addr, failedLoginAttemps);
+ }
+
+ if (failedLoginAttemps >= Config.LOGIN_TRY_BEFORE_BAN)
+ {
+ addBanForAddress(addr, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
+ // we need to clear the failed login attemps here, so after the ip ban is over the client has another 5 attemps
+ clearFailedLoginAttemps(addr);
+ _log.warning("Added banned address " + addr.getHostAddress() + "! Too many login attemps.");
+ }
+ }
+
+ private void clearFailedLoginAttemps(InetAddress addr)
+ {
+ synchronized (_failedLoginAttemps)
+ {
+ _failedLoginAttemps.remove(addr);
+ }
+ }
+
+ private AccountInfo retriveAccountInfo(InetAddress addr, String login, String password, boolean autoCreateIfEnabled)
+ {
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ byte[] raw = password.getBytes(StandardCharsets.UTF_8);
+ String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
+ {
+ ps.setString(1, Long.toString(System.currentTimeMillis()));
+ ps.setString(2, login);
+ try (ResultSet rset = ps.executeQuery())
+ {
+ if (rset.next())
+ {
+ if (Config.DEBUG)
+ {
+ _log.fine("Account '" + login + "' exists.");
+ }
+
+ AccountInfo info = new AccountInfo(rset.getString("login"), rset.getString("password"), rset.getInt("accessLevel"), rset.getInt("lastServer"));
+ if (!info.checkPassHash(hashBase64))
+ {
+ // wrong password
+ recordFailedLoginAttemp(addr);
+ return null;
+ }
+
+ clearFailedLoginAttemps(addr);
+ return info;
+ }
+ }
+ }
+
+ if (!autoCreateIfEnabled || !Config.AUTO_CREATE_ACCOUNTS)
+ {
+ // account does not exist and auto create accoutn is not desired
+ recordFailedLoginAttemp(addr);
+ return null;
+ }
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
+ {
+ ps.setString(1, login);
+ ps.setString(2, hashBase64);
+ ps.setLong(3, System.currentTimeMillis());
+ ps.setInt(4, 0);
+ ps.setString(5, addr.getHostAddress());
+ ps.execute();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Exception while auto creating account for '" + login + "'!", e);
+ return null;
+ }
+
+ _log.info("Auto created account '" + login + "'.");
+ return retriveAccountInfo(addr, login, password, false);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Exception while retriving account info for '" + login + "'!", e);
+ return null;
+ }
+ }
+
+ public AuthLoginResult tryCheckinAccount(L2LoginClient client, InetAddress address, AccountInfo info)
+ {
+ if (info.getAccessLevel() < 0)
+ {
+ return AuthLoginResult.ACCOUNT_BANNED;
+ }
+
AuthLoginResult ret = AuthLoginResult.INVALID_PASSWORD;
// check auth
- if (loginValid(account, password, client))
+ if (canCheckin(client, address, info))
{
// login was successful, verify presence on Gameservers
ret = AuthLoginResult.ALREADY_ON_GS;
- if (!isAccountInAnyGameServer(account))
+ if (!isAccountInAnyGameServer(info.getLogin()))
{
// account isnt on any GS verify LS itself
ret = AuthLoginResult.ALREADY_ON_LS;
- if (_loginServerClients.putIfAbsent(account, client) == null)
+ if (_loginServerClients.putIfAbsent(info.getLogin(), client) == null)
{
ret = AuthLoginResult.AUTH_SUCCESS;
}
}
}
- else
- {
- if (client.getAccessLevel() < 0)
- {
- ret = AuthLoginResult.ACCOUNT_BANNED;
- }
- }
return ret;
}
/**
- * Adds the address to the ban list of the login server, with the given duration.
+ * Adds the address to the ban list of the login server, with the given end tiem in millis.
* @param address The Address to be banned.
* @param expiration Timestamp in miliseconds when this ban expires
* @throws UnknownHostException if the address is invalid.
*/
public void addBanForAddress(String address, long expiration) throws UnknownHostException
{
- InetAddress netAddress = InetAddress.getByName(address);
- if (!_bannedIps.containsKey(netAddress.getHostAddress()))
- {
- _bannedIps.put(netAddress.getHostAddress(), new BanInfo(netAddress, expiration));
- }
+ _bannedIps.putIfAbsent(InetAddress.getByName(address), expiration);
}
/**
@@ -256,16 +331,13 @@ public void addBanForAddress(String address, long expiration) throws UnknownHost
*/
public void addBanForAddress(InetAddress address, long duration)
{
- if (!_bannedIps.containsKey(address.getHostAddress()))
- {
- _bannedIps.put(address.getHostAddress(), new BanInfo(address, System.currentTimeMillis() + duration));
- }
+ _bannedIps.putIfAbsent(address, System.currentTimeMillis() + duration);
}
public boolean isBannedAddress(InetAddress address)
{
String[] parts = address.getHostAddress().split("\\.");
- BanInfo bi = _bannedIps.get(address.getHostAddress());
+ Long bi = _bannedIps.get(address);
if (bi == null)
{
bi = _bannedIps.get(parts[0] + "." + parts[1] + "." + parts[2] + ".0");
@@ -280,9 +352,10 @@ public boolean isBannedAddress(InetAddress address)
}
if (bi != null)
{
- if (bi.hasExpired())
+ if ((bi > 0) && (bi < System.currentTimeMillis()))
{
- _bannedIps.remove(address.getHostAddress());
+ _bannedIps.remove(address);
+ _log.info("Removed expired ip address ban " + address.getHostAddress() + ".");
return false;
}
return true;
@@ -290,7 +363,7 @@ public boolean isBannedAddress(InetAddress address)
return false;
}
- public Map<String, BanInfo> getBannedIps()
+ public Map<InetAddress, Long> getBannedIps()
{
return _bannedIps;
}
@@ -470,61 +543,21 @@ public ScrambledKeyPair getScrambledRSAKeyPair()
}
/**
- * User name is not case sensitive any more.
- * @param user
- * @param password
- * @param client
- * @return
+ * @param client the client
+ * @param address client host address
+ * @param info the account info to checkin
+ * @return true when ok to checkin, false otherwise
*/
- public boolean loginValid(String user, String password, L2LoginClient client)// throws HackingException
+ public boolean canCheckin(L2LoginClient client, InetAddress address, AccountInfo info)
{
- boolean ok = false;
- InetAddress address = client.getConnection().getInetAddress();
-
- // player disconnected meanwhile
- if ((address == null) || (user == null))
- {
- return false;
- }
-
try
{
- MessageDigest md = MessageDigest.getInstance("SHA");
- byte[] raw = password.getBytes("UTF-8");
- byte[] hash = md.digest(raw);
-
- byte[] expected = null;
- int access = 0;
- int lastServer = 1;
List<InetAddress> ipWhiteList = new ArrayList<>();
List<InetAddress> ipBlackList = new ArrayList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
- {
- ps.setString(1, Long.toString(System.currentTimeMillis()));
- ps.setString(2, user);
- try (ResultSet rset = ps.executeQuery())
- {
- if (rset.next())
- {
- expected = Base64.getDecoder().decode(rset.getString("password"));
- access = rset.getInt("accessLevel");
- lastServer = rset.getInt("lastServer");
- if (lastServer <= 0)
- {
- lastServer = 1; // minServerId is 1 in Interlude
- }
- if (Config.DEBUG)
- {
- _log.fine("account exists");
- }
- }
- }
- }
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
- ps.setString(1, user);
+ ps.setString(1, info.getLogin());
try (ResultSet rset = ps.executeQuery())
{
String ip, type;
@@ -549,162 +582,40 @@ else if (type.equals("deny"))
}
}
- // if account doesn't exists
- if (expected == null)
- {
- if (Config.AUTO_CREATE_ACCOUNTS)
- {
- if ((user.length() >= 2) && (user.length() <= 14))
- {
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
- {
- ps.setString(1, user);
- ps.setString(2, Base64.getEncoder().encodeToString(hash));
- ps.setLong(3, System.currentTimeMillis());
- ps.setInt(4, 0);
- ps.setString(5, address.getHostAddress());
- ps.execute();
- }
-
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : AccountCreate", "loginlog");
- }
-
- _log.info("Created new account for " + user);
- return true;
-
- }
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : ErrCreatingACC", "loginlog");
- }
-
- _log.warning("Invalid username creation/use attempt: " + user);
- }
- else
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountMissing", "loginlog");
- }
-
- _log.warning("Account missing for user " + user);
- FailedLoginAttempt failedAttempt = _hackProtection.get(address);
- int failedCount;
- if (failedAttempt == null)
- {
- _hackProtection.put(address, new FailedLoginAttempt(address, password));
- failedCount = 1;
- }
- else
- {
- failedAttempt.increaseCounter();
- failedCount = failedAttempt.getCount();
- }
-
- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)
- {
- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user name attempts");
- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
- }
- }
- return false;
- }
-
- // is this account banned?
- if (access < 0)
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountBanned", "loginlog");
- }
-
- client.setAccessLevel(access);
- return false;
- }
-
// Check IP
if (!ipWhiteList.isEmpty() || !ipBlackList.isEmpty())
{
if (!ipWhiteList.isEmpty() && !ipWhiteList.contains(address))
{
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : INCORRECT IP", "loginlog");
- }
+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") not present on whitelist for account '" + info.getLogin() + "'.");
return false;
}
if (!ipBlackList.isEmpty() && ipBlackList.contains(address))
{
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : BLACKLISTED IP", "loginlog");
- }
+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") on blacklist for account '" + info.getLogin() + "'.");
return false;
}
}
- // check password hash
- ok = Arrays.equals(hash, expected);
- if (ok)
- {
- client.setAccessLevel(access);
- client.setLastServer(lastServer);
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
- {
- ps.setLong(1, System.currentTimeMillis());
- ps.setString(2, address.getHostAddress());
- ps.setString(3, user);
- ps.execute();
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "Could not check password:" + e.getMessage(), e);
- ok = false;
- }
-
- if (!ok)
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : LoginFailed", "loginlog");
- }
-
- FailedLoginAttempt failedAttempt = _hackProtection.get(address);
- int failedCount;
- if (failedAttempt == null)
- {
- _hackProtection.put(address, new FailedLoginAttempt(address, password));
- failedCount = 1;
- }
- else
+ client.setAccessLevel(info.getAccessLevel());
+ client.setLastServer(info.getLastServer());
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
- failedAttempt.increaseCounter(password);
- failedCount = failedAttempt.getCount();
+ ps.setLong(1, System.currentTimeMillis());
+ ps.setString(2, address.getHostAddress());
+ ps.setString(3, info.getLogin());
+ ps.execute();
}
- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)
- {
- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user/pass attempts");
- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
- }
+ return true;
}
- else
+ catch (Exception e)
{
- _hackProtection.remove(address);
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : LoginOk", "loginlog");
- }
+ _log.log(Level.WARNING, "Could not finish login process!", e);
+ return false;
}
-
- return ok;
}
public boolean isValidIPAddress(String ipAddress)
@@ -726,79 +637,24 @@ public boolean isValidIPAddress(String ipAddress)
return true;
}
- class FailedLoginAttempt
+ public static void load() throws GeneralSecurityException
{
- // private InetAddress _ipAddress;
- private int _count;
- private long _lastAttempTime;
- private String _lastPassword;
-
- public FailedLoginAttempt(InetAddress address, String lastPassword)
- {
- // _ipAddress = address;
- _count = 1;
- _lastAttempTime = System.currentTimeMillis();
- _lastPassword = lastPassword;
- }
-
- public void increaseCounter(String password)
+ synchronized (LoginController.class)
{
- if (!_lastPassword.equals(password))
+ if (_instance == null)
{
- // check if theres a long time since last wrong try
- if ((System.currentTimeMillis() - _lastAttempTime) < (300 * 1000))
- {
- _count++;
- }
- else
- {
- // restart the status
- _count = 1;
-
- }
- _lastPassword = password;
- _lastAttempTime = System.currentTimeMillis();
+ _instance = new LoginController();
}
else
- // trying the same password is not brute force
{
- _lastAttempTime = System.currentTimeMillis();
+ throw new IllegalStateException("LoginController can only be loaded a single time.");
}
}
-
- public int getCount()
- {
- return _count;
- }
-
- public void increaseCounter()
- {
- _count++;
- }
-
}
- class BanInfo
+ public static LoginController getInstance()
{
- private final InetAddress _ipAddress;
- // Expiration
- private final long _expiration;
-
- public BanInfo(InetAddress ipAddress, long expiration)
- {
- _ipAddress = ipAddress;
- _expiration = expiration;
- }
-
- public InetAddress getAddress()
- {
- return _ipAddress;
- }
-
- public boolean hasExpired()
- {
- return (System.currentTimeMillis() > _expiration) && (_expiration > 0);
- }
+ return _instance;
}
class PurgeThread extends Thread
@@ -836,4 +692,13 @@ public void run()
}
}
}
+
+ public static enum AuthLoginResult
+ {
+ INVALID_PASSWORD,
+ ACCOUNT_BANNED,
+ ALREADY_ON_LS,
+ ALREADY_ON_GS,
+ AUTH_SUCCESS
+ }
}
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java
new file mode 100644
index 0000000..55f9f2e
--- /dev/null
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2004-2014 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.loginserver.model.data;
+
+/**
+ * @author FBIagent
+ */
+public final class AccountInfo
+{
+ private final String _login;
+ private final String _passHash;
+ private final int _accessLevel;
+ private final int _lastServer;
+
+ public AccountInfo(String login, String passHash, int accessLevel, int lastServer)
+ {
+ if (login == null)
+ {
+ throw new NullPointerException("login");
+ }
+ if (passHash == null)
+ {
+ throw new NullPointerException("passHash");
+ }
+
+ if (login.isEmpty())
+ {
+ throw new IllegalArgumentException("login");
+ }
+ if (passHash.isEmpty())
+ {
+ throw new IllegalArgumentException("passHash");
+ }
+
+ _login = login;
+ _passHash = passHash;
+ _accessLevel = accessLevel;
+ _lastServer = lastServer;
+ }
+
+ public boolean checkPassHash(String passHash)
+ {
+ return _passHash.equals(passHash);
+ }
+
+ public String getLogin()
+ {
+ return _login;
+ }
+
+ public int getAccessLevel()
+ {
+ return _accessLevel;
+ }
+
+ public int getLastServer()
+ {
+ return _lastServer;
+ }
+}
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
index 79e78c4..46f3fc6 100644
--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
@@ -18,6 +18,7 @@
*/
package com.l2jserver.loginserver.network.clientpackets;
+import java.net.InetAddress;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -28,6 +29,7 @@
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.LoginController;
import com.l2jserver.loginserver.LoginController.AuthLoginResult;
+import com.l2jserver.loginserver.model.data.AccountInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.L2LoginClient.LoginClientState;
import com.l2jserver.loginserver.network.serverpackets.AccountKicked;
@@ -118,15 +120,25 @@ public void run()
return;
}
+ InetAddress clientAddr = getClient().getConnection().getInetAddress();
+
final LoginController lc = LoginController.getInstance();
- AuthLoginResult result = lc.tryAuthLogin(_user, _password, client);
+ AccountInfo info = lc.retriveAccountInfo(clientAddr, _user, _password);
+ if (info == null)
+ {
+ // user or pass wrong
+ client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
+ return;
+ }
+
+ AuthLoginResult result = lc.tryCheckinAccount(client, clientAddr, info);
switch (result)
{
case AUTH_SUCCESS:
- client.setAccount(_user);
+ client.setAccount(info.getLogin());
client.setState(LoginClientState.AUTHED_LOGIN);
- client.setSessionKey(lc.assignSessionKeyToClient(_user, client));
- lc.getCharactersOnAccount(_user);
+ client.setSessionKey(lc.assignSessionKeyToClient(info.getLogin(), client));
+ lc.getCharactersOnAccount(info.getLogin());
if (Config.SHOW_LICENCE)
{
client.sendPacket(new LoginOk(getClient().getSessionKey()));
@@ -141,28 +153,28 @@ public void run()
break;
case ACCOUNT_BANNED:
client.close(new AccountKicked(AccountKickedReason.REASON_PERMANENTLY_BANNED));
- break;
+ return;
case ALREADY_ON_LS:
L2LoginClient oldClient;
- if ((oldClient = lc.getAuthedClient(_user)) != null)
+ if ((oldClient = lc.getAuthedClient(info.getLogin())) != null)
{
// kick the other client
oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
- lc.removeAuthedLoginClient(_user);
+ lc.removeAuthedLoginClient(info.getLogin());
}
// kick also current client
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
break;
case ALREADY_ON_GS:
GameServerInfo gsi;
- if ((gsi = lc.getAccountOnGameServer(_user)) != null)
+ if ((gsi = lc.getAccountOnGameServer(info.getLogin())) != null)
{
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
// kick from there
if (gsi.isAuthed())
{
- gsi.getGameServerThread().kickPlayer(_user);
+ gsi.getGameServerThread().kickPlayer(info.getLogin());
}
}
break;
diff --git a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java b/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java
deleted file mode 100644
index ddfdac6..0000000
--- a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2004-2014 L2J Server
- *
- * This file is part of L2J Server.
- *
- * L2J Server is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L2J Server is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.util.lib;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.l2jserver.Config;
-
-/**
- * @version 0.1, 2005-06-06
- * @author Balancer
- */
-public class Log
-{
- private static final Logger _log = Logger.getLogger(Log.class.getName());
-
- public static final void add(String text, String cat)
- {
- String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());
- String curr = (new SimpleDateFormat("yyyy-MM-dd-")).format(new Date());
- new File("log/game").mkdirs();
-
- final File file = new File("log/game/" + (curr != null ? curr : "") + (cat != null ? cat : "unk") + ".txt");
- try (FileWriter save = new FileWriter(file, true))
- {
- save.write("[" + date + "] " + text + Config.EOL);
- }
- catch (IOException e)
- {
- _log.log(Level.WARNING, "Error saving logfile: ", e);
- }
- }
-}

 

 

E também tem este

 

 

Index: java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java

===================================================================

--- java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java (revision 5420)

+++ java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java (working copy)

@@ -1573,10 +1591,17 @@

while (inv.next())

{

item = L2ItemInstance.restoreFromDb(getOwnerId(), inv);

if (item == null)

continue;

 

+ // Check if that item already exists in OID map.

+ if (L2World.getInstance().findObject(inv.getInt("object_id")) != null)

+ {

+ _log.log(Level.WARNING, "Item: "+ item.getObjectId() +" Has Duplied on World And Cannot be Load");

+ L2World.getInstance().removeObject(item);

+ continue;

+ }

+

Editado por Leo >.>'

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Encontrei um mod que diz ser um fix na L2JServer

Só não sei se é ...

sim é um fiz da jserver antidup item. Tipo não testei ainda e tbm não adicionei pra saber.

Mais irei faze o seguinte vou adicionar ele e pedir pra algurm que saiba usar testar.

 

 

--- a/L2J_Server_BETA/dist/login/config/LoginServer.properties

+++ b/L2J_Server_BETA/dist/login/config/LoginServer.properties

@@ -39,10 +39,6 @@ LoginPort = 9014

# Security

# ---------------------------------------------------------------------------

 

-# Logs in file the login server events.

-# Default: True

-LogLoginController = True

-

# How many times you can provide an invalid account/pass before the IP gets banned.

# Default: 5

LoginTryBeforeBan = 5

diff --git a/L2J_Server_BETA/java/com/l2jserver/Config.java b/L2J_Server_BETA/java/com/l2jserver/Config.java

index 330e0a3..0135093 100644

--- a/L2J_Server_BETA/java/com/l2jserver/Config.java

+++ b/L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -948,7 +948,6 @@

public static int REQUEST_ID;

public static boolean RESERVE_HOST_ON_LOGIN = false;

public static List<Integer> PROTOCOL_LIST;

- public static boolean LOG_LOGIN_CONTROLLER;

public static boolean LOGIN_SERVER_SCHEDULE_RESTART;

public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;

 

@@ -2790,8 +2789,6 @@ else if (Server.serverMode == Server.MODE_LOGINSERVER)

LOGIN_TRY_BEFORE_BAN = ServerSettings.getInt("LoginTryBeforeBan", 5);

LOGIN_BLOCK_AFTER_BAN = ServerSettings.getInt("LoginBlockAfterBan", 900);

 

- LOG_LOGIN_CONTROLLER = ServerSettings.getBoolean("LogLoginController", true);

-

LOGIN_SERVER_SCHEDULE_RESTART = ServerSettings.getBoolean("LoginRestartSchedule", false);

LOGIN_SERVER_SCHEDULE_RESTART_TIME = ServerSettings.getLong("LoginRestartTime", 24);

 

diff --git a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java

index bac0c6b..6ad5217 100644

--- a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java

+++ b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java

@@ -27,14 +27,13 @@

import java.util.logging.Logger;

 

import com.l2jserver.Config;

-import com.l2jserver.util.lib.Log;

 

/**

* Audits Game Master's actions.

*/

public class GMAudit

{

- private static final Logger _log = Logger.getLogger(Log.class.getName());

+ private static final Logger _log = Logger.getLogger(GMAudit.class.getName());

 

static

{

diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java

index 3da9896..3b80a31 100644

--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java

+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java

@@ -20,6 +20,7 @@

 

import java.net.InetAddress;

import java.net.UnknownHostException;

+import java.nio.charset.StandardCharsets;

import java.security.GeneralSecurityException;

import java.security.KeyPairGenerator;

import java.security.MessageDigest;

@@ -29,9 +30,9 @@

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.util.ArrayList;

-import java.util.Arrays;

import java.util.Base64;

import java.util.Collection;

+import java.util.HashMap;

import java.util.List;

import java.util.Map;

import java.util.logging.Level;

@@ -44,12 +45,12 @@

import com.l2jserver.Config;

import com.l2jserver.L2DatabaseFactory;

import com.l2jserver.loginserver.GameServerTable.GameServerInfo;

+import com.l2jserver.loginserver.model.data.AccountInfo;

import com.l2jserver.loginserver.network.L2LoginClient;

import com.l2jserver.loginserver.network.gameserverpackets.ServerStatus;

import com.l2jserver.loginserver.network.serverpackets.LoginFail.LoginFailReason;

import com.l2jserver.util.Rnd;

import com.l2jserver.util.crypt.ScrambledKeyPair;

-import com.l2jserver.util.lib.Log;

 

/**

* This class ...

@@ -67,9 +68,8 @@

/** Authed Clients on LoginServer */

protected FastMap<String, L2LoginClient> _loginServerClients = new FastMap<String, L2LoginClient>().shared();

 

- private final Map<String, BanInfo> _bannedIps = new FastMap<String, BanInfo>().shared();

-

- private final Map<InetAddress, FailedLoginAttempt> _hackProtection;

+ private final Map<InetAddress, Integer> _failedLoginAttemps = new HashMap<>();

+ private final Map<InetAddress, Long> _bannedIps = new FastMap<InetAddress, Long>().shared();

 

protected ScrambledKeyPair[] _keyPairs;

 

@@ -79,7 +79,7 @@

private static final int BLOWFISH_KEYS = 20;

 

// SQL Queries

- private static final String USER_INFO_SELECT = "SELECT password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 login, password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 AUTOCREATE_ACCOUNTS_INSERT = "INSERT INTO accounts (login, password, lastactive, accessLevel, lastIP) values (?, ?, ?, ?, ?)";

private static final String ACCOUNT_INFO_UPDATE = "UPDATE accounts SET lastactive = ?, lastIP = ? WHERE login = ?";

private static final String ACCOUNT_LAST_SERVER_UPDATE = "UPDATE accounts SET lastServer = ? WHERE login = ?";

@@ -87,32 +87,10 @@

private static final String ACCOUNT_IPS_UPDATE = "UPDATE accounts SET pcIp = ?, hop1 = ?, hop2 = ?, hop3 = ?, hop4 = ? WHERE login = ?";

private static final String ACCOUNT_IPAUTH_SELECT = "SELECT * FROM accounts_ipauth WHERE login = ?";

 

- public static void load() throws GeneralSecurityException

- {

- synchronized (LoginController.class)

- {

- if (_instance == null)

- {

- _instance = new LoginController();

- }

- else

- {

- throw new IllegalStateException("LoginController can only be loaded a single time.");

- }

- }

- }

-

- public static LoginController getInstance()

- {

- return _instance;

- }

-

private LoginController() throws GeneralSecurityException

{

_log.info("Loading LoginController...");

 

- _hackProtection = new FastMap<>();

-

_keyPairs = new ScrambledKeyPair[10];

 

KeyPairGenerator keygen = null;

@@ -196,57 +174,154 @@ public L2LoginClient getAuthedClient(String account)

return _loginServerClients.get(account);

}

 

- public static enum AuthLoginResult

+ public AccountInfo retriveAccountInfo(InetAddress clientAddr, String login, String password)

{

- INVALID_PASSWORD,

- ACCOUNT_BANNED,

- ALREADY_ON_LS,

- ALREADY_ON_GS,

- AUTH_SUCCESS

+ return retriveAccountInfo(clientAddr, login, password, true);

}

 

- public AuthLoginResult tryAuthLogin(String account, String password, L2LoginClient client)

+ private void recordFailedLoginAttemp(InetAddress addr)

{

+ // We need to synchronize this!

+ // When multiple connections from the same address fail to login at the

+ // same time, unexpected behavior can happen.

+ Integer failedLoginAttemps;

+ synchronized (_failedLoginAttemps)

+ {

+ failedLoginAttemps = _failedLoginAttemps.get(addr);

+ if (failedLoginAttemps == null)

+ {

+ failedLoginAttemps = 1;

+ }

+ else

+ {

+ ++failedLoginAttemps;

+ }

+

+ _failedLoginAttemps.put(addr, failedLoginAttemps);

+ }

+

+ if (failedLoginAttemps >= Config.LOGIN_TRY_BEFORE_BAN)

+ {

+ addBanForAddress(addr, Config.LOGIN_BLOCK_AFTER_BAN * 1000);

+ // we need to clear the failed login attemps here, so after the ip ban is over the client has another 5 attemps

+ clearFailedLoginAttemps(addr);

+ _log.warning("Added banned address " + addr.getHostAddress() + "! Too many login attemps.");

+ }

+ }

+

+ private void clearFailedLoginAttemps(InetAddress addr)

+ {

+ synchronized (_failedLoginAttemps)

+ {

+ _failedLoginAttemps.remove(addr);

+ }

+ }

+

+ private AccountInfo retriveAccountInfo(InetAddress addr, String login, String password, boolean autoCreateIfEnabled)

+ {

+ try

+ {

+ MessageDigest md = MessageDigest.getInstance("SHA");

+ byte[] raw = password.getBytes(StandardCharsets.UTF_8);

+ String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));

+

+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();

+ PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))

+ {

+ ps.setString(1, Long.toString(System.currentTimeMillis()));

+ ps.setString(2, login);

+ try (ResultSet rset = ps.executeQuery())

+ {

+ if (rset.next())

+ {

+ if (Config.DEBUG)

+ {

+ _log.fine("Account '" + login + "' exists.");

+ }

+

+ AccountInfo info = new AccountInfo(rset.getString("login"), rset.getString("password"), rset.getInt("accessLevel"), rset.getInt("lastServer"));

+ if (!info.checkPassHash(hashBase64))

+ {

+ // wrong password

+ recordFailedLoginAttemp(addr);

+ return null;

+ }

+

+ clearFailedLoginAttemps(addr);

+ return info;

+ }

+ }

+ }

+

+ if (!autoCreateIfEnabled || !Config.AUTO_CREATE_ACCOUNTS)

+ {

+ // account does not exist and auto create accoutn is not desired

+ recordFailedLoginAttemp(addr);

+ return null;

+ }

+

+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();

+ PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))

+ {

+ ps.setString(1, login);

+ ps.setString(2, hashBase64);

+ ps.setLong(3, System.currentTimeMillis());

+ ps.setInt(4, 0);

+ ps.setString(5, addr.getHostAddress());

+ ps.execute();

+ }

+ catch (Exception e)

+ {

+ _log.log(Level.WARNING, "Exception while auto creating account for '" + login + "'!", e);

+ return null;

+ }

+

+ _log.info("Auto created account '" + login + "'.");

+ return retriveAccountInfo(addr, login, password, false);

+ }

+ catch (Exception e)

+ {

+ _log.log(Level.WARNING, "Exception while retriving account info for '" + login + "'!", e);

+ return null;

+ }

+ }

+

+ public AuthLoginResult tryCheckinAccount(L2LoginClient client, InetAddress address, AccountInfo info)

+ {

+ if (info.getAccessLevel() < 0)

+ {

+ return AuthLoginResult.ACCOUNT_BANNED;

+ }

+

AuthLoginResult ret = AuthLoginResult.INVALID_PASSWORD;

// check auth

- if (loginValid(account, password, client))

+ if (canCheckin(client, address, info))

{

// login was successful, verify presence on Gameservers

ret = AuthLoginResult.ALREADY_ON_GS;

- if (!isAccountInAnyGameServer(account))

+ if (!isAccountInAnyGameServer(info.getLogin()))

{

// account isnt on any GS verify LS itself

ret = AuthLoginResult.ALREADY_ON_LS;

 

- if (_loginServerClients.putIfAbsent(account, client) == null)

+ if (_loginServerClients.putIfAbsent(info.getLogin(), client) == null)

{

ret = AuthLoginResult.AUTH_SUCCESS;

}

}

}

- else

- {

- if (client.getAccessLevel() < 0)

- {

- ret = AuthLoginResult.ACCOUNT_BANNED;

- }

- }

return ret;

}

 

/**

- * Adds the address to the ban list of the login server, with the given duration.

+ * Adds the address to the ban list of the login server, with the given end tiem in millis.

* @param address The Address to be banned.

* @param expiration Timestamp in miliseconds when this ban expires

* @throws UnknownHostException if the address is invalid.

*/

public void addBanForAddress(String address, long expiration) throws UnknownHostException

{

- InetAddress netAddress = InetAddress.getByName(address);

- if (!_bannedIps.containsKey(netAddress.getHostAddress()))

- {

- _bannedIps.put(netAddress.getHostAddress(), new BanInfo(netAddress, expiration));

- }

+ _bannedIps.putIfAbsent(InetAddress.getByName(address), expiration);

}

 

/**

@@ -256,16 +331,13 @@ public void addBanForAddress(String address, long expiration) throws UnknownHost

*/

public void addBanForAddress(InetAddress address, long duration)

{

- if (!_bannedIps.containsKey(address.getHostAddress()))

- {

- _bannedIps.put(address.getHostAddress(), new BanInfo(address, System.currentTimeMillis() + duration));

- }

+ _bannedIps.putIfAbsent(address, System.currentTimeMillis() + duration);

}

 

public boolean isBannedAddress(InetAddress address)

{

String[] parts = address.getHostAddress().split("\\.");

- BanInfo bi = _bannedIps.get(address.getHostAddress());

+ Long bi = _bannedIps.get(address);

if (bi == null)

{

bi = _bannedIps.get(parts[0] + "." + parts[1] + "." + parts[2] + ".0");

@@ -280,9 +352,10 @@ public boolean isBannedAddress(InetAddress address)

}

if (bi != null)

{

- if (bi.hasExpired())

+ if ((bi > 0) && (bi < System.currentTimeMillis()))

{

- _bannedIps.remove(address.getHostAddress());

+ _bannedIps.remove(address);

+ _log.info("Removed expired ip address ban " + address.getHostAddress() + ".");

return false;

}

return true;

@@ -290,7 +363,7 @@ public boolean isBannedAddress(InetAddress address)

return false;

}

 

- public Map<String, BanInfo> getBannedIps()

+ public Map<InetAddress, Long> getBannedIps()

{

return _bannedIps;

}

@@ -470,61 +543,21 @@ public ScrambledKeyPair getScrambledRSAKeyPair()

}

 

/**

- * User name is not case sensitive any more.

- * @param user

- * @param password

- * @param client

- * @return

+ * @param client the client

+ * @param address client host address

+ * @param info the account info to checkin

+ * @return true when ok to checkin, false otherwise

*/

- public boolean loginValid(String user, String password, L2LoginClient client)// throws HackingException

+ public boolean canCheckin(L2LoginClient client, InetAddress address, AccountInfo info)

{

- boolean ok = false;

- InetAddress address = client.getConnection().getInetAddress();

-

- // player disconnected meanwhile

- if ((address == null) || (user == null))

- {

- return false;

- }

-

try

{

- MessageDigest md = MessageDigest.getInstance("SHA");

- byte[] raw = password.getBytes("UTF-8");

- byte[] hash = md.digest(raw);

-

- byte[] expected = null;

- int access = 0;

- int lastServer = 1;

List<InetAddress> ipWhiteList = new ArrayList<>();

List<InetAddress> ipBlackList = new ArrayList<>();

try (Connection con = L2DatabaseFactory.getInstance().getConnection();

- PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))

- {

- ps.setString(1, Long.toString(System.currentTimeMillis()));

- ps.setString(2, user);

- try (ResultSet rset = ps.executeQuery())

- {

- if (rset.next())

- {

- expected = Base64.getDecoder().decode(rset.getString("password"));

- access = rset.getInt("accessLevel");

- lastServer = rset.getInt("lastServer");

- if (lastServer <= 0)

- {

- lastServer = 1; // minServerId is 1 in Interlude

- }

- if (Config.DEBUG)

- {

- _log.fine("account exists");

- }

- }

- }

- }

- try (Connection con = L2DatabaseFactory.getInstance().getConnection();

PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))

{

- ps.setString(1, user);

+ ps.setString(1, info.getLogin());

try (ResultSet rset = ps.executeQuery())

{

String ip, type;

@@ -549,162 +582,40 @@ else if (type.equals("deny"))

}

}

 

- // if account doesn't exists

- if (expected == null)

- {

- if (Config.AUTO_CREATE_ACCOUNTS)

- {

- if ((user.length() >= 2) && (user.length() <= 14))

- {

- try (Connection con = L2DatabaseFactory.getInstance().getConnection();

- PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))

- {

- ps.setString(1, user);

- ps.setString(2, Base64.getEncoder().encodeToString(hash));

- ps.setLong(3, System.currentTimeMillis());

- ps.setInt(4, 0);

- ps.setString(5, address.getHostAddress());

- ps.execute();

- }

-

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : AccountCreate", "loginlog");

- }

-

- _log.info("Created new account for " + user);

- return true;

-

- }

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : ErrCreatingACC", "loginlog");

- }

-

- _log.warning("Invalid username creation/use attempt: " + user);

- }

- else

- {

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountMissing", "loginlog");

- }

-

- _log.warning("Account missing for user " + user);

- FailedLoginAttempt failedAttempt = _hackProtection.get(address);

- int failedCount;

- if (failedAttempt == null)

- {

- _hackProtection.put(address, new FailedLoginAttempt(address, password));

- failedCount = 1;

- }

- else

- {

- failedAttempt.increaseCounter();

- failedCount = failedAttempt.getCount();

- }

-

- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)

- {

- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user name attempts");

- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);

- }

- }

- return false;

- }

-

- // is this account banned?

- if (access < 0)

- {

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountBanned", "loginlog");

- }

-

- client.setAccessLevel(access);

- return false;

- }

-

// Check IP

if (!ipWhiteList.isEmpty() || !ipBlackList.isEmpty())

{

if (!ipWhiteList.isEmpty() && !ipWhiteList.contains(address))

{

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : INCORRECT IP", "loginlog");

- }

+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") not present on whitelist for account '" + info.getLogin() + "'.");

return false;

}

 

if (!ipBlackList.isEmpty() && ipBlackList.contains(address))

{

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : BLACKLISTED IP", "loginlog");

- }

+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") on blacklist for account '" + info.getLogin() + "'.");

return false;

}

}

 

- // check password hash

- ok = Arrays.equals(hash, expected);

- if (ok)

- {

- client.setAccessLevel(access);

- client.setLastServer(lastServer);

- try (Connection con = L2DatabaseFactory.getInstance().getConnection();

- PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))

- {

- ps.setLong(1, System.currentTimeMillis());

- ps.setString(2, address.getHostAddress());

- ps.setString(3, user);

- ps.execute();

- }

- }

- }

- catch (Exception e)

- {

- _log.log(Level.WARNING, "Could not check password:" + e.getMessage(), e);

- ok = false;

- }

-

- if (!ok)

- {

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : LoginFailed", "loginlog");

- }

-

- FailedLoginAttempt failedAttempt = _hackProtection.get(address);

- int failedCount;

- if (failedAttempt == null)

- {

- _hackProtection.put(address, new FailedLoginAttempt(address, password));

- failedCount = 1;

- }

- else

+ client.setAccessLevel(info.getAccessLevel());

+ client.setLastServer(info.getLastServer());

+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();

+ PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))

{

- failedAttempt.increaseCounter(password);

- failedCount = failedAttempt.getCount();

+ ps.setLong(1, System.currentTimeMillis());

+ ps.setString(2, address.getHostAddress());

+ ps.setString(3, info.getLogin());

+ ps.execute();

}

 

- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)

- {

- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user/pass attempts");

- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);

- }

+ return true;

}

- else

+ catch (Exception e)

{

- _hackProtection.remove(address);

- if (Config.LOG_LOGIN_CONTROLLER)

- {

- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : LoginOk", "loginlog");

- }

+ _log.log(Level.WARNING, "Could not finish login process!", e);

+ return false;

}

-

- return ok;

}

 

public boolean isValidIPAddress(String ipAddress)

@@ -726,79 +637,24 @@ public boolean isValidIPAddress(String ipAddress)

return true;

}

 

- class FailedLoginAttempt

+ public static void load() throws GeneralSecurityException

{

- // private InetAddress _ipAddress;

- private int _count;

- private long _lastAttempTime;

- private String _lastPassword;

-

- public FailedLoginAttempt(InetAddress address, String lastPassword)

- {

- // _ipAddress = address;

- _count = 1;

- _lastAttempTime = System.currentTimeMillis();

- _lastPassword = lastPassword;

- }

-

- public void increaseCounter(String password)

+ synchronized (LoginController.class)

{

- if (!_lastPassword.equals(password))

+ if (_instance == null)

{

- // check if theres a long time since last wrong try

- if ((System.currentTimeMillis() - _lastAttempTime) < (300 * 1000))

- {

- _count++;

- }

- else

- {

- // restart the status

- _count = 1;

-

- }

- _lastPassword = password;

- _lastAttempTime = System.currentTimeMillis();

+ _instance = new LoginController();

}

else

- // trying the same password is not brute force

{

- _lastAttempTime = System.currentTimeMillis();

+ throw new IllegalStateException("LoginController can only be loaded a single time.");

}

}

-

- public int getCount()

- {

- return _count;

- }

-

- public void increaseCounter()

- {

- _count++;

- }

-

}

 

- class BanInfo

+ public static LoginController getInstance()

{

- private final InetAddress _ipAddress;

- // Expiration

- private final long _expiration;

-

- public BanInfo(InetAddress ipAddress, long expiration)

- {

- _ipAddress = ipAddress;

- _expiration = expiration;

- }

-

- public InetAddress getAddress()

- {

- return _ipAddress;

- }

-

- public boolean hasExpired()

- {

- return (System.currentTimeMillis() > _expiration) && (_expiration > 0);

- }

+ return _instance;

}

 

class PurgeThread extends Thread

@@ -836,4 +692,13 @@ public void run()

}

}

}

+

+ public static enum AuthLoginResult

+ {

+ INVALID_PASSWORD,

+ ACCOUNT_BANNED,

+ ALREADY_ON_LS,

+ ALREADY_ON_GS,

+ AUTH_SUCCESS

+ }

}

diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java

new file mode 100644

index 0000000..55f9f2e

--- /dev/null

+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java

@@ -0,0 +1,76 @@

+/*

+ * Copyright © 2004-2014 L2J Server

+ *

+ * This file is part of L2J Server.

+ *

+ * L2J Server is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License as published by

+ * the Free Software Foundation, either version 3 of the License, or

+ * (at your option) any later version.

+ *

+ * L2J Server is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

+ * General Public License for more details.

+ *

+ * You should have received a copy of the GNU General Public License

+ * along with this program. If not, see <http://www.gnu.org/licenses/>.

+ */

+package com.l2jserver.loginserver.model.data;

+

+/**

+ * @author FBIagent

+ */

+public final class AccountInfo

+{

+ private final String _login;

+ private final String _passHash;

+ private final int _accessLevel;

+ private final int _lastServer;

+

+ public AccountInfo(String login, String passHash, int accessLevel, int lastServer)

+ {

+ if (login == null)

+ {

+ throw new NullPointerException("login");

+ }

+ if (passHash == null)

+ {

+ throw new NullPointerException("passHash");

+ }

+

+ if (login.isEmpty())

+ {

+ throw new IllegalArgumentException("login");

+ }

+ if (passHash.isEmpty())

+ {

+ throw new IllegalArgumentException("passHash");

+ }

+

+ _login = login;

+ _passHash = passHash;

+ _accessLevel = accessLevel;

+ _lastServer = lastServer;

+ }

+

+ public boolean checkPassHash(String passHash)

+ {

+ return _passHash.equals(passHash);

+ }

+

+ public String getLogin()

+ {

+ return _login;

+ }

+

+ public int getAccessLevel()

+ {

+ return _accessLevel;

+ }

+

+ public int getLastServer()

+ {

+ return _lastServer;

+ }

+}

diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java

index 79e78c4..46f3fc6 100644

--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java

+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java

@@ -18,6 +18,7 @@

*/

package com.l2jserver.loginserver.network.clientpackets;

 

+import java.net.InetAddress;

import java.security.GeneralSecurityException;

import java.util.logging.Level;

import java.util.logging.Logger;

@@ -28,6 +29,7 @@

import com.l2jserver.loginserver.GameServerTable.GameServerInfo;

import com.l2jserver.loginserver.LoginController;

import com.l2jserver.loginserver.LoginController.AuthLoginResult;

+import com.l2jserver.loginserver.model.data.AccountInfo;

import com.l2jserver.loginserver.network.L2LoginClient;

import com.l2jserver.loginserver.network.L2LoginClient.LoginClientState;

import com.l2jserver.loginserver.network.serverpackets.AccountKicked;

@@ -118,15 +120,25 @@ public void run()

return;

}

 

+ InetAddress clientAddr = getClient().getConnection().getInetAddress();

+

final LoginController lc = LoginController.getInstance();

- AuthLoginResult result = lc.tryAuthLogin(_user, _password, client);

+ AccountInfo info = lc.retriveAccountInfo(clientAddr, _user, _password);

+ if (info == null)

+ {

+ // user or pass wrong

+ client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);

+ return;

+ }

+

+ AuthLoginResult result = lc.tryCheckinAccount(client, clientAddr, info);

switch (result)

{

case AUTH_SUCCESS:

- client.setAccount(_user);

+ client.setAccount(info.getLogin());

client.setState(LoginClientState.AUTHED_LOGIN);

- client.setSessionKey(lc.assignSessionKeyToClient(_user, client));

- lc.getCharactersOnAccount(_user);

+ client.setSessionKey(lc.assignSessionKeyToClient(info.getLogin(), client));

+ lc.getCharactersOnAccount(info.getLogin());

if (Config.SHOW_LICENCE)

{

client.sendPacket(new LoginOk(getClient().getSessionKey()));

@@ -141,28 +153,28 @@ public void run()

break;

case ACCOUNT_BANNED:

client.close(new AccountKicked(AccountKickedReason.REASON_PERMANENTLY_BANNED));

- break;

+ return;

case ALREADY_ON_LS:

L2LoginClient oldClient;

- if ((oldClient = lc.getAuthedClient(_user)) != null)

+ if ((oldClient = lc.getAuthedClient(info.getLogin())) != null)

{

// kick the other client

oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);

- lc.removeAuthedLoginClient(_user);

+ lc.removeAuthedLoginClient(info.getLogin());

}

// kick also current client

client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);

break;

case ALREADY_ON_GS:

GameServerInfo gsi;

- if ((gsi = lc.getAccountOnGameServer(_user)) != null)

+ if ((gsi = lc.getAccountOnGameServer(info.getLogin())) != null)

{

client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);

 

// kick from there

if (gsi.isAuthed())

{

- gsi.getGameServerThread().kickPlayer(_user);

+ gsi.getGameServerThread().kickPlayer(info.getLogin());

}

}

break;

diff --git a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java b/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java

deleted file mode 100644

index ddfdac6..0000000

--- a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java

+++ /dev/null

@@ -1,55 +0,0 @@

-/*

- * Copyright © 2004-2014 L2J Server

- *

- * This file is part of L2J Server.

- *

- * L2J Server is free software: you can redistribute it and/or modify

- * it under the terms of the GNU General Public License as published by

- * the Free Software Foundation, either version 3 of the License, or

- * (at your option) any later version.

- *

- * L2J Server is distributed in the hope that it will be useful,

- * but WITHOUT ANY WARRANTY; without even the implied warranty of

- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

- * General Public License for more details.

- *

- * You should have received a copy of the GNU General Public License

- * along with this program. If not, see <http://www.gnu.org/licenses/>.

- */

-package com.l2jserver.util.lib;

-

-import java.io.File;

-import java.io.FileWriter;

-import java.io.IOException;

-import java.text.SimpleDateFormat;

-import java.util.Date;

-import java.util.logging.Level;

-import java.util.logging.Logger;

-

-import com.l2jserver.Config;

-

-/**

- * @version 0.1, 2005-06-06

- * @author Balancer

- */

-public class Log

-{

- private static final Logger _log = Logger.getLogger(Log.class.getName());

-

- public static final void add(String text, String cat)

- {

- String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());

- String curr = (new SimpleDateFormat("yyyy-MM-dd-")).format(new Date());

- new File("log/game").mkdirs();

-

- final File file = new File("log/game/" + (curr != null ? curr : "") + (cat != null ? cat : "unk") + ".txt");

- try (FileWriter save = new FileWriter(file, true))

- {

- save.write("[" + date + "] " + text + Config.EOL);

- }

- catch (IOException e)

- {

- _log.log(Level.WARNING, "Error saving logfile: ", e);

- }

- }

-}

 

 

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

Sim Clodo, achei em um fórum por ai... infelizmente o Git da L2JS tá fora por alguns problemas lá.

Só tem que dar uma adaptada no código. O Zoey até disponibilizou a proteção posta no HI5 mas o link está off.

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

isso ai não fixa, fato é que a rev contem outros bugs mais grotescos

isso ai não fixa, fato é que a rev contem outros bugs mais grotescos

Pra mim, nada mais grotesco do que o cara aparecer full items em 15 minutos em um server hard farms. Ou até mesmo ter 50k de blesseds na BAG. Sinceramente, duplicação de items é algo que realmente destrói um servidor

Que bugs por exemplo ??

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Sim Clodo, achei em um fórum por ai... infelizmente o Git da L2JS tá fora por alguns problemas lá.

Só tem que dar uma adaptada no código. O Zoey até disponibilizou a proteção posta no HI5 mas o link está off.

Eu tenho esse mod. Mais não sei se ta funcionando. Vou adicionar 3 proteção aqui ai vc testa pode ser ?

Encontrei um mod que diz ser um fix na L2JServer

Só não sei se é ...

 

 

 

--- a/L2J_Server_BETA/dist/login/config/LoginServer.properties
+++ b/L2J_Server_BETA/dist/login/config/LoginServer.properties
@@ -39,10 +39,6 @@ LoginPort = 9014
# Security
# ---------------------------------------------------------------------------
-# Logs in file the login server events.
-# Default: True
-LogLoginController = True
-
# How many times you can provide an invalid account/pass before the IP gets banned.
# Default: 5
LoginTryBeforeBan = 5
diff --git a/L2J_Server_BETA/java/com/l2jserver/Config.java b/L2J_Server_BETA/java/com/l2jserver/Config.java
index 330e0a3..0135093 100644
--- a/L2J_Server_BETA/java/com/l2jserver/Config.java
+++ b/L2J_Server_BETA/java/com/l2jserver/Config.java
@@ -948,7 +948,6 @@
public static int REQUEST_ID;
public static boolean RESERVE_HOST_ON_LOGIN = false;
public static List<Integer> PROTOCOL_LIST;
- public static boolean LOG_LOGIN_CONTROLLER;
public static boolean LOGIN_SERVER_SCHEDULE_RESTART;
public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;
@@ -2790,8 +2789,6 @@ else if (Server.serverMode == Server.MODE_LOGINSERVER)
LOGIN_TRY_BEFORE_BAN = ServerSettings.getInt("LoginTryBeforeBan", 5);
LOGIN_BLOCK_AFTER_BAN = ServerSettings.getInt("LoginBlockAfterBan", 900);
- LOG_LOGIN_CONTROLLER = ServerSettings.getBoolean("LogLoginController", true);
-
LOGIN_SERVER_SCHEDULE_RESTART = ServerSettings.getBoolean("LoginRestartSchedule", false);
LOGIN_SERVER_SCHEDULE_RESTART_TIME = ServerSettings.getLong("LoginRestartTime", 24);
diff --git a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
index bac0c6b..6ad5217 100644
--- a/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
+++ b/L2J_Server_BETA/java/com/l2jserver/gameserver/util/GMAudit.java
@@ -27,14 +27,13 @@
import java.util.logging.Logger;
import com.l2jserver.Config;
-import com.l2jserver.util.lib.Log;
/**
* Audits Game Master's actions.
*/
public class GMAudit
{
- private static final Logger _log = Logger.getLogger(Log.class.getName());
+ private static final Logger _log = Logger.getLogger(GMAudit.class.getName());
static
{
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
index 3da9896..3b80a31 100644
--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/LoginController.java
@@ -20,6 +20,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
@@ -29,9 +30,9 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -44,12 +45,12 @@
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
+import com.l2jserver.loginserver.model.data.AccountInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.gameserverpackets.ServerStatus;
import com.l2jserver.loginserver.network.serverpackets.LoginFail.LoginFailReason;
import com.l2jserver.util.Rnd;
import com.l2jserver.util.crypt.ScrambledKeyPair;
-import com.l2jserver.util.lib.Log;
/**
* This class ...
@@ -67,9 +68,8 @@
/** Authed Clients on LoginServer */
protected FastMap<String, L2LoginClient> _loginServerClients = new FastMap<String, L2LoginClient>().shared();
- private final Map<String, BanInfo> _bannedIps = new FastMap<String, BanInfo>().shared();
-
- private final Map<InetAddress, FailedLoginAttempt> _hackProtection;
+ private final Map<InetAddress, Integer> _failedLoginAttemps = new HashMap<>();
+ private final Map<InetAddress, Long> _bannedIps = new FastMap<InetAddress, Long>().shared();
protected ScrambledKeyPair[] _keyPairs;
@@ -79,7 +79,7 @@
private static final int BLOWFISH_KEYS = 20;
// SQL Queries
- private static final String USER_INFO_SELECT = "SELECT password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 login, password, IF(? > value OR value IS NULL, accessLevel, -1) AS accessLevel, lastServer 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 AUTOCREATE_ACCOUNTS_INSERT = "INSERT INTO accounts (login, password, lastactive, accessLevel, lastIP) values (?, ?, ?, ?, ?)";
private static final String ACCOUNT_INFO_UPDATE = "UPDATE accounts SET lastactive = ?, lastIP = ? WHERE login = ?";
private static final String ACCOUNT_LAST_SERVER_UPDATE = "UPDATE accounts SET lastServer = ? WHERE login = ?";
@@ -87,32 +87,10 @@
private static final String ACCOUNT_IPS_UPDATE = "UPDATE accounts SET pcIp = ?, hop1 = ?, hop2 = ?, hop3 = ?, hop4 = ? WHERE login = ?";
private static final String ACCOUNT_IPAUTH_SELECT = "SELECT * FROM accounts_ipauth WHERE login = ?";
- public static void load() throws GeneralSecurityException
- {
- synchronized (LoginController.class)
- {
- if (_instance == null)
- {
- _instance = new LoginController();
- }
- else
- {
- throw new IllegalStateException("LoginController can only be loaded a single time.");
- }
- }
- }
-
- public static LoginController getInstance()
- {
- return _instance;
- }
-
private LoginController() throws GeneralSecurityException
{
_log.info("Loading LoginController...");
- _hackProtection = new FastMap<>();
-
_keyPairs = new ScrambledKeyPair[10];
KeyPairGenerator keygen = null;
@@ -196,57 +174,154 @@ public L2LoginClient getAuthedClient(String account)
return _loginServerClients.get(account);
}
- public static enum AuthLoginResult
+ public AccountInfo retriveAccountInfo(InetAddress clientAddr, String login, String password)
{
- INVALID_PASSWORD,
- ACCOUNT_BANNED,
- ALREADY_ON_LS,
- ALREADY_ON_GS,
- AUTH_SUCCESS
+ return retriveAccountInfo(clientAddr, login, password, true);
}
- public AuthLoginResult tryAuthLogin(String account, String password, L2LoginClient client)
+ private void recordFailedLoginAttemp(InetAddress addr)
{
+ // We need to synchronize this!
+ // When multiple connections from the same address fail to login at the
+ // same time, unexpected behavior can happen.
+ Integer failedLoginAttemps;
+ synchronized (_failedLoginAttemps)
+ {
+ failedLoginAttemps = _failedLoginAttemps.get(addr);
+ if (failedLoginAttemps == null)
+ {
+ failedLoginAttemps = 1;
+ }
+ else
+ {
+ ++failedLoginAttemps;
+ }
+
+ _failedLoginAttemps.put(addr, failedLoginAttemps);
+ }
+
+ if (failedLoginAttemps >= Config.LOGIN_TRY_BEFORE_BAN)
+ {
+ addBanForAddress(addr, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
+ // we need to clear the failed login attemps here, so after the ip ban is over the client has another 5 attemps
+ clearFailedLoginAttemps(addr);
+ _log.warning("Added banned address " + addr.getHostAddress() + "! Too many login attemps.");
+ }
+ }
+
+ private void clearFailedLoginAttemps(InetAddress addr)
+ {
+ synchronized (_failedLoginAttemps)
+ {
+ _failedLoginAttemps.remove(addr);
+ }
+ }
+
+ private AccountInfo retriveAccountInfo(InetAddress addr, String login, String password, boolean autoCreateIfEnabled)
+ {
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ byte[] raw = password.getBytes(StandardCharsets.UTF_8);
+ String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
+ {
+ ps.setString(1, Long.toString(System.currentTimeMillis()));
+ ps.setString(2, login);
+ try (ResultSet rset = ps.executeQuery())
+ {
+ if (rset.next())
+ {
+ if (Config.DEBUG)
+ {
+ _log.fine("Account '" + login + "' exists.");
+ }
+
+ AccountInfo info = new AccountInfo(rset.getString("login"), rset.getString("password"), rset.getInt("accessLevel"), rset.getInt("lastServer"));
+ if (!info.checkPassHash(hashBase64))
+ {
+ // wrong password
+ recordFailedLoginAttemp(addr);
+ return null;
+ }
+
+ clearFailedLoginAttemps(addr);
+ return info;
+ }
+ }
+ }
+
+ if (!autoCreateIfEnabled || !Config.AUTO_CREATE_ACCOUNTS)
+ {
+ // account does not exist and auto create accoutn is not desired
+ recordFailedLoginAttemp(addr);
+ return null;
+ }
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
+ {
+ ps.setString(1, login);
+ ps.setString(2, hashBase64);
+ ps.setLong(3, System.currentTimeMillis());
+ ps.setInt(4, 0);
+ ps.setString(5, addr.getHostAddress());
+ ps.execute();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Exception while auto creating account for '" + login + "'!", e);
+ return null;
+ }
+
+ _log.info("Auto created account '" + login + "'.");
+ return retriveAccountInfo(addr, login, password, false);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Exception while retriving account info for '" + login + "'!", e);
+ return null;
+ }
+ }
+
+ public AuthLoginResult tryCheckinAccount(L2LoginClient client, InetAddress address, AccountInfo info)
+ {
+ if (info.getAccessLevel() < 0)
+ {
+ return AuthLoginResult.ACCOUNT_BANNED;
+ }
+
AuthLoginResult ret = AuthLoginResult.INVALID_PASSWORD;
// check auth
- if (loginValid(account, password, client))
+ if (canCheckin(client, address, info))
{
// login was successful, verify presence on Gameservers
ret = AuthLoginResult.ALREADY_ON_GS;
- if (!isAccountInAnyGameServer(account))
+ if (!isAccountInAnyGameServer(info.getLogin()))
{
// account isnt on any GS verify LS itself
ret = AuthLoginResult.ALREADY_ON_LS;
- if (_loginServerClients.putIfAbsent(account, client) == null)
+ if (_loginServerClients.putIfAbsent(info.getLogin(), client) == null)
{
ret = AuthLoginResult.AUTH_SUCCESS;
}
}
}
- else
- {
- if (client.getAccessLevel() < 0)
- {
- ret = AuthLoginResult.ACCOUNT_BANNED;
- }
- }
return ret;
}
/**
- * Adds the address to the ban list of the login server, with the given duration.
+ * Adds the address to the ban list of the login server, with the given end tiem in millis.
* @param address The Address to be banned.
* @param expiration Timestamp in miliseconds when this ban expires
* @throws UnknownHostException if the address is invalid.
*/
public void addBanForAddress(String address, long expiration) throws UnknownHostException
{
- InetAddress netAddress = InetAddress.getByName(address);
- if (!_bannedIps.containsKey(netAddress.getHostAddress()))
- {
- _bannedIps.put(netAddress.getHostAddress(), new BanInfo(netAddress, expiration));
- }
+ _bannedIps.putIfAbsent(InetAddress.getByName(address), expiration);
}
/**
@@ -256,16 +331,13 @@ public void addBanForAddress(String address, long expiration) throws UnknownHost
*/
public void addBanForAddress(InetAddress address, long duration)
{
- if (!_bannedIps.containsKey(address.getHostAddress()))
- {
- _bannedIps.put(address.getHostAddress(), new BanInfo(address, System.currentTimeMillis() + duration));
- }
+ _bannedIps.putIfAbsent(address, System.currentTimeMillis() + duration);
}
public boolean isBannedAddress(InetAddress address)
{
String[] parts = address.getHostAddress().split("\\.");
- BanInfo bi = _bannedIps.get(address.getHostAddress());
+ Long bi = _bannedIps.get(address);
if (bi == null)
{
bi = _bannedIps.get(parts[0] + "." + parts[1] + "." + parts[2] + ".0");
@@ -280,9 +352,10 @@ public boolean isBannedAddress(InetAddress address)
}
if (bi != null)
{
- if (bi.hasExpired())
+ if ((bi > 0) && (bi < System.currentTimeMillis()))
{
- _bannedIps.remove(address.getHostAddress());
+ _bannedIps.remove(address);
+ _log.info("Removed expired ip address ban " + address.getHostAddress() + ".");
return false;
}
return true;
@@ -290,7 +363,7 @@ public boolean isBannedAddress(InetAddress address)
return false;
}
- public Map<String, BanInfo> getBannedIps()
+ public Map<InetAddress, Long> getBannedIps()
{
return _bannedIps;
}
@@ -470,61 +543,21 @@ public ScrambledKeyPair getScrambledRSAKeyPair()
}
/**
- * User name is not case sensitive any more.
- * @param user
- * @param password
- * @param client
- * @return
+ * @param client the client
+ * @param address client host address
+ * @param info the account info to checkin
+ * @return true when ok to checkin, false otherwise
*/
- public boolean loginValid(String user, String password, L2LoginClient client)// throws HackingException
+ public boolean canCheckin(L2LoginClient client, InetAddress address, AccountInfo info)
{
- boolean ok = false;
- InetAddress address = client.getConnection().getInetAddress();
-
- // player disconnected meanwhile
- if ((address == null) || (user == null))
- {
- return false;
- }
-
try
{
- MessageDigest md = MessageDigest.getInstance("SHA");
- byte[] raw = password.getBytes("UTF-8");
- byte[] hash = md.digest(raw);
-
- byte[] expected = null;
- int access = 0;
- int lastServer = 1;
List<InetAddress> ipWhiteList = new ArrayList<>();
List<InetAddress> ipBlackList = new ArrayList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
- {
- ps.setString(1, Long.toString(System.currentTimeMillis()));
- ps.setString(2, user);
- try (ResultSet rset = ps.executeQuery())
- {
- if (rset.next())
- {
- expected = Base64.getDecoder().decode(rset.getString("password"));
- access = rset.getInt("accessLevel");
- lastServer = rset.getInt("lastServer");
- if (lastServer <= 0)
- {
- lastServer = 1; // minServerId is 1 in Interlude
- }
- if (Config.DEBUG)
- {
- _log.fine("account exists");
- }
- }
- }
- }
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
- ps.setString(1, user);
+ ps.setString(1, info.getLogin());
try (ResultSet rset = ps.executeQuery())
{
String ip, type;
@@ -549,162 +582,40 @@ else if (type.equals("deny"))
}
}
- // if account doesn't exists
- if (expected == null)
- {
- if (Config.AUTO_CREATE_ACCOUNTS)
- {
- if ((user.length() >= 2) && (user.length() <= 14))
- {
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
- {
- ps.setString(1, user);
- ps.setString(2, Base64.getEncoder().encodeToString(hash));
- ps.setLong(3, System.currentTimeMillis());
- ps.setInt(4, 0);
- ps.setString(5, address.getHostAddress());
- ps.execute();
- }
-
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : AccountCreate", "loginlog");
- }
-
- _log.info("Created new account for " + user);
- return true;
-
- }
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : ErrCreatingACC", "loginlog");
- }
-
- _log.warning("Invalid username creation/use attempt: " + user);
- }
- else
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountMissing", "loginlog");
- }
-
- _log.warning("Account missing for user " + user);
- FailedLoginAttempt failedAttempt = _hackProtection.get(address);
- int failedCount;
- if (failedAttempt == null)
- {
- _hackProtection.put(address, new FailedLoginAttempt(address, password));
- failedCount = 1;
- }
- else
- {
- failedAttempt.increaseCounter();
- failedCount = failedAttempt.getCount();
- }
-
- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)
- {
- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user name attempts");
- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
- }
- }
- return false;
- }
-
- // is this account banned?
- if (access < 0)
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : AccountBanned", "loginlog");
- }
-
- client.setAccessLevel(access);
- return false;
- }
-
// Check IP
if (!ipWhiteList.isEmpty() || !ipBlackList.isEmpty())
{
if (!ipWhiteList.isEmpty() && !ipWhiteList.contains(address))
{
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : INCORRECT IP", "loginlog");
- }
+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") not present on whitelist for account '" + info.getLogin() + "'.");
return false;
}
if (!ipBlackList.isEmpty() && ipBlackList.contains(address))
{
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : BLACKLISTED IP", "loginlog");
- }
+ _log.warning("Account checkin attemp from address(" + address.getHostAddress() + ") on blacklist for account '" + info.getLogin() + "'.");
return false;
}
}
- // check password hash
- ok = Arrays.equals(hash, expected);
- if (ok)
- {
- client.setAccessLevel(access);
- client.setLastServer(lastServer);
- try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
- {
- ps.setLong(1, System.currentTimeMillis());
- ps.setString(2, address.getHostAddress());
- ps.setString(3, user);
- ps.execute();
- }
- }
- }
- catch (Exception e)
- {
- _log.log(Level.WARNING, "Could not check password:" + e.getMessage(), e);
- ok = false;
- }
-
- if (!ok)
- {
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - ERR : LoginFailed", "loginlog");
- }
-
- FailedLoginAttempt failedAttempt = _hackProtection.get(address);
- int failedCount;
- if (failedAttempt == null)
- {
- _hackProtection.put(address, new FailedLoginAttempt(address, password));
- failedCount = 1;
- }
- else
+ client.setAccessLevel(info.getAccessLevel());
+ client.setLastServer(info.getLastServer());
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
- failedAttempt.increaseCounter(password);
- failedCount = failedAttempt.getCount();
+ ps.setLong(1, System.currentTimeMillis());
+ ps.setString(2, address.getHostAddress());
+ ps.setString(3, info.getLogin());
+ ps.execute();
}
- if (failedCount >= Config.LOGIN_TRY_BEFORE_BAN)
- {
- _log.info("Banning '" + address.getHostAddress() + "' for " + Config.LOGIN_BLOCK_AFTER_BAN + " seconds due to " + failedCount + " invalid user/pass attempts");
- this.addBanForAddress(address, Config.LOGIN_BLOCK_AFTER_BAN * 1000);
- }
+ return true;
}
- else
+ catch (Exception e)
{
- _hackProtection.remove(address);
- if (Config.LOG_LOGIN_CONTROLLER)
- {
- Log.add("'" + user + "' " + address.getHostAddress() + " - OK : LoginOk", "loginlog");
- }
+ _log.log(Level.WARNING, "Could not finish login process!", e);
+ return false;
}
-
- return ok;
}
public boolean isValidIPAddress(String ipAddress)
@@ -726,79 +637,24 @@ public boolean isValidIPAddress(String ipAddress)
return true;
}
- class FailedLoginAttempt
+ public static void load() throws GeneralSecurityException
{
- // private InetAddress _ipAddress;
- private int _count;
- private long _lastAttempTime;
- private String _lastPassword;
-
- public FailedLoginAttempt(InetAddress address, String lastPassword)
- {
- // _ipAddress = address;
- _count = 1;
- _lastAttempTime = System.currentTimeMillis();
- _lastPassword = lastPassword;
- }
-
- public void increaseCounter(String password)
+ synchronized (LoginController.class)
{
- if (!_lastPassword.equals(password))
+ if (_instance == null)
{
- // check if theres a long time since last wrong try
- if ((System.currentTimeMillis() - _lastAttempTime) < (300 * 1000))
- {
- _count++;
- }
- else
- {
- // restart the status
- _count = 1;
-
- }
- _lastPassword = password;
- _lastAttempTime = System.currentTimeMillis();
+ _instance = new LoginController();
}
else
- // trying the same password is not brute force
{
- _lastAttempTime = System.currentTimeMillis();
+ throw new IllegalStateException("LoginController can only be loaded a single time.");
}
}
-
- public int getCount()
- {
- return _count;
- }
-
- public void increaseCounter()
- {
- _count++;
- }
-
}
- class BanInfo
+ public static LoginController getInstance()
{
- private final InetAddress _ipAddress;
- // Expiration
- private final long _expiration;
-
- public BanInfo(InetAddress ipAddress, long expiration)
- {
- _ipAddress = ipAddress;
- _expiration = expiration;
- }
-
- public InetAddress getAddress()
- {
- return _ipAddress;
- }
-
- public boolean hasExpired()
- {
- return (System.currentTimeMillis() > _expiration) && (_expiration > 0);
- }
+ return _instance;
}
class PurgeThread extends Thread
@@ -836,4 +692,13 @@ public void run()
}
}
}
+
+ public static enum AuthLoginResult
+ {
+ INVALID_PASSWORD,
+ ACCOUNT_BANNED,
+ ALREADY_ON_LS,
+ ALREADY_ON_GS,
+ AUTH_SUCCESS
+ }
}
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java
new file mode 100644
index 0000000..55f9f2e
--- /dev/null
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/model/data/AccountInfo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2004-2014 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.loginserver.model.data;
+
+/**
+ * @author FBIagent
+ */
+public final class AccountInfo
+{
+ private final String _login;
+ private final String _passHash;
+ private final int _accessLevel;
+ private final int _lastServer;
+
+ public AccountInfo(String login, String passHash, int accessLevel, int lastServer)
+ {
+ if (login == null)
+ {
+ throw new NullPointerException("login");
+ }
+ if (passHash == null)
+ {
+ throw new NullPointerException("passHash");
+ }
+
+ if (login.isEmpty())
+ {
+ throw new IllegalArgumentException("login");
+ }
+ if (passHash.isEmpty())
+ {
+ throw new IllegalArgumentException("passHash");
+ }
+
+ _login = login;
+ _passHash = passHash;
+ _accessLevel = accessLevel;
+ _lastServer = lastServer;
+ }
+
+ public boolean checkPassHash(String passHash)
+ {
+ return _passHash.equals(passHash);
+ }
+
+ public String getLogin()
+ {
+ return _login;
+ }
+
+ public int getAccessLevel()
+ {
+ return _accessLevel;
+ }
+
+ public int getLastServer()
+ {
+ return _lastServer;
+ }
+}
diff --git a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
index 79e78c4..46f3fc6 100644
--- a/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
+++ b/L2J_Server_BETA/java/com/l2jserver/loginserver/network/clientpackets/RequestAuthLogin.java
@@ -18,6 +18,7 @@
*/
package com.l2jserver.loginserver.network.clientpackets;
+import java.net.InetAddress;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -28,6 +29,7 @@
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.LoginController;
import com.l2jserver.loginserver.LoginController.AuthLoginResult;
+import com.l2jserver.loginserver.model.data.AccountInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.L2LoginClient.LoginClientState;
import com.l2jserver.loginserver.network.serverpackets.AccountKicked;
@@ -118,15 +120,25 @@ public void run()
return;
}
+ InetAddress clientAddr = getClient().getConnection().getInetAddress();
+
final LoginController lc = LoginController.getInstance();
- AuthLoginResult result = lc.tryAuthLogin(_user, _password, client);
+ AccountInfo info = lc.retriveAccountInfo(clientAddr, _user, _password);
+ if (info == null)
+ {
+ // user or pass wrong
+ client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
+ return;
+ }
+
+ AuthLoginResult result = lc.tryCheckinAccount(client, clientAddr, info);
switch (result)
{
case AUTH_SUCCESS:
- client.setAccount(_user);
+ client.setAccount(info.getLogin());
client.setState(LoginClientState.AUTHED_LOGIN);
- client.setSessionKey(lc.assignSessionKeyToClient(_user, client));
- lc.getCharactersOnAccount(_user);
+ client.setSessionKey(lc.assignSessionKeyToClient(info.getLogin(), client));
+ lc.getCharactersOnAccount(info.getLogin());
if (Config.SHOW_LICENCE)
{
client.sendPacket(new LoginOk(getClient().getSessionKey()));
@@ -141,28 +153,28 @@ public void run()
break;
case ACCOUNT_BANNED:
client.close(new AccountKicked(AccountKickedReason.REASON_PERMANENTLY_BANNED));
- break;
+ return;
case ALREADY_ON_LS:
L2LoginClient oldClient;
- if ((oldClient = lc.getAuthedClient(_user)) != null)
+ if ((oldClient = lc.getAuthedClient(info.getLogin())) != null)
{
// kick the other client
oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
- lc.removeAuthedLoginClient(_user);
+ lc.removeAuthedLoginClient(info.getLogin());
}
// kick also current client
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
break;
case ALREADY_ON_GS:
GameServerInfo gsi;
- if ((gsi = lc.getAccountOnGameServer(_user)) != null)
+ if ((gsi = lc.getAccountOnGameServer(info.getLogin())) != null)
{
client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
// kick from there
if (gsi.isAuthed())
{
- gsi.getGameServerThread().kickPlayer(_user);
+ gsi.getGameServerThread().kickPlayer(info.getLogin());
}
}
break;
diff --git a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java b/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java
deleted file mode 100644
index ddfdac6..0000000
--- a/L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2004-2014 L2J Server
- *
- * This file is part of L2J Server.
- *
- * L2J Server is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L2J Server is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.util.lib;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.l2jserver.Config;
-
-/**
- * @version 0.1, 2005-06-06
- * @author Balancer
- */
-public class Log
-{
- private static final Logger _log = Logger.getLogger(Log.class.getName());
-
- public static final void add(String text, String cat)
- {
- String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());
- String curr = (new SimpleDateFormat("yyyy-MM-dd-")).format(new Date());
- new File("log/game").mkdirs();
-
- final File file = new File("log/game/" + (curr != null ? curr : "") + (cat != null ? cat : "unk") + ".txt");
- try (FileWriter save = new FileWriter(file, true))
- {
- save.write("[" + date + "] " + text + Config.EOL);
- }
- catch (IOException e)
- {
- _log.log(Level.WARNING, "Error saving logfile: ", e);
- }
- }
-}

 

 

 

Esse ai já tem na rev.

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

Eu tenho esse mod. Mais não sei se ta funcionando. Vou adicionar 3 proteção aqui ai vc testa pode ser ?

Esse ai já tem na rev.

 

Blz eu testo pra você

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Blz eu testo pra você

Ok . vou adicionar e upar .

//edit

DOWNLOAD

 

 

so colocar isso ai compilado pra ver.

Editado por ClodoDeniiz

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

alguém pode me ajudar, eu compro o item da quest do antharas e mesmo assim nao consigo entrar a sala... mesma coisa se repete com o valakas. Eu consigo desativar a quest de ambos ?3IFVKzW.jpgjá no Baium eu compro o item da quest e funciona normalmente entro na sala pelo crystal e o mato sem problema algum !

Editado por rodrigocarter
Link para o comentário
Compartilhar em outros sites

alguém pode me ajudar, eu compro o item da quest do antharas e mesmo assim nao consigo entrar a sala... mesma coisa se repete com o valakas. Eu consigo desativar a quest de ambos ?3IFVKzW.jpgjá no Baium eu compro o item da quest e funciona normalmente entro na sala pelo crystal e o mato sem problema algum !

Ue isso já tinha sido arrumado.

Isso ta acontecendo com char normal ou so com char gm?

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

estou usando essa http://www.mediafire...rXtreme 176.rar que o Sr. Slave disponibilizou aqui ! se vc tiver alguma revisão ai que nao tenha isso e puder disponibilizar ficarei grato !

Você tem que entregar o item da quest no NPC que fica no meio do caminho pro crystal. E não no crystal em si.

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Você tem que entregar o item da quest no NPC que fica no meio do caminho pro crystal. E não no crystal em si.

Não você está errado,basta somente ter o Portal Stone e clicar no crystal e entrar.

como você pode ver abaixo isso é no meu projeto "brxtreme também" só que já foi fixado isso na minha rev.

NggIVXP.jpg

Lineage 2 THE WAR ! Freya High Five PvP Server !

Em Breve Online '-'

Link para o comentário
Compartilhar em outros sites

Que coisa estranha, até onde eu saiba a quest do Valakas, você tem que entregar no NPC que fica no meio do caminho. Se não, não entra. Eu nunca parei pra jogar servidor freya mas jogo um 15x High Five e lá é assim.

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.






  • Patrocinadores

  • Quem Está Navegando

    • Nenhum usuário registrado visualizando esta página.
  • Posts

    • Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?    
    • muchas gracias muy lindos NPC 🙂
    • relaxa jovem gafanhoto, testa as quests. e posTa os erros indesejaveis.  
    • Se alguém pudesse me ensinar como codificar as missões, eu ficaria feliz em fazer isso sozinho ou pelo menos ajudar. Eu realmente quero jogar em um servidor onde todas as quests funcionem bem e melhor ainda se você puder fazer quests customizadas!
    • mas no interlude, nem todas as quests de class,  vai mostrar onde tem que ir, ate o reborn nao mostrava quando era interlude, só mostrou depois que eles colocaram client classic pra rodar, e ficou melhor ainda quando virou hellbound em diante, mas ha sim alguma chance de modificar isso direto no script para fazer igualmente, só basta te um pouco de paciencia e persistencia exato
    • 408_PathToElvenwizard dá Orion eu tive que mexer tbm, até modifiquei e consegui deixar ela igual do Classic, com a seta e a marcação no mapa. (não retail IL) Dá pra importar py de várias revs, o foda é que não da regular as quest py através do debug em tempo real, pelo menos eu não consegui rsrs
    • Hasta el momento todas las QUESTS son completables si te guias con un tutorial de youtube. El problema es que tienen bugs de locacion y de subquests que no avanzan o no te marcan correctamente a donde ir en el mapa, cosa que en Retail si se ve como corresponde.
    • estranho, mas pelo menos a galera nunca reclamo das quests quando tinha aberto 5x, geral fez class primeira e segunda job, poucos que compraram a class
    • en RUSaCis-3.5 data pack, las Quests estan en formato .java y son diferentes a como estan redactadas en jOrion y jFrozen 1.5 (ProyectX) package net.sf.l2j.gameserver.scripting.quest; import net.sf.l2j.commons.random.Rnd; import net.sf.l2j.gameserver.enums.Paperdoll; import net.sf.l2j.gameserver.enums.QuestStatus; import net.sf.l2j.gameserver.enums.actors.ClassId; import net.sf.l2j.gameserver.model.actor.Creature; import net.sf.l2j.gameserver.model.actor.Npc; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.network.serverpackets.SocialAction; import net.sf.l2j.gameserver.scripting.QuestState; public class Q224_TestOfSagittarius extends SecondClassQuest { private static final String QUEST_NAME = "Q224_TestOfSagittarius"; // Items private static final int BERNARD_INTRODUCTION = 3294; private static final int HAMIL_LETTER_1 = 3295; private static final int HAMIL_LETTER_2 = 3296; private static final int HAMIL_LETTER_3 = 3297; private static final int HUNTER_RUNE_1 = 3298; private static final int HUNTER_RUNE_2 = 3299; private static final int TALISMAN_OF_KADESH = 3300; private static final int TALISMAN_OF_SNAKE = 3301; private static final int MITHRIL_CLIP = 3302; private static final int STAKATO_CHITIN = 3303; private static final int REINFORCED_BOWSTRING = 3304; private static final int MANASHEN_HORN = 3305; private static final int BLOOD_OF_LIZARDMAN = 3306; private static final int CRESCENT_MOON_BOW = 3028; private static final int WOODEN_ARROW = 17; // Rewards private static final int MARK_OF_SAGITTARIUS = 3293; // NPCs private static final int BERNARD = 30702; private static final int HAMIL = 30626; private static final int SIR_ARON_TANFORD = 30653; private static final int VOKIAN = 30514; private static final int GAUEN = 30717; // Monsters private static final int ANT = 20079; private static final int ANT_CAPTAIN = 20080; private static final int ANT_OVERSEER = 20081; private static final int ANT_RECRUIT = 20082; private static final int ANT_PATROL = 20084; private static final int ANT_GUARD = 20086; private static final int NOBLE_ANT = 20089; private static final int NOBLE_ANT_LEADER = 20090; private static final int BREKA_ORC_SHAMAN = 20269; private static final int BREKA_ORC_OVERLORD = 20270; private static final int MARSH_STAKATO_WORKER = 20230; private static final int MARSH_STAKATO_SOLDIER = 20232; private static final int MARSH_STAKATO_DRONE = 20234; private static final int MARSH_SPIDER = 20233; private static final int ROAD_SCAVENGER = 20551; private static final int MANASHEN_GARGOYLE = 20563; private static final int LETO_LIZARDMAN = 20577; private static final int LETO_LIZARDMAN_ARCHER = 20578; private static final int LETO_LIZARDMAN_SOLDIER = 20579; private static final int LETO_LIZARDMAN_WARRIOR = 20580; private static final int LETO_LIZARDMAN_SHAMAN = 20581; private static final int LETO_LIZARDMAN_OVERLORD = 20582; private static final int SERPENT_DEMON_KADESH = 27090; public Q224_TestOfSagittarius() { super(224, "Test Of Sagittarius"); setItemsIds(BERNARD_INTRODUCTION, HAMIL_LETTER_1, HAMIL_LETTER_2, HAMIL_LETTER_3, HUNTER_RUNE_1, HUNTER_RUNE_2, TALISMAN_OF_KADESH, TALISMAN_OF_SNAKE, MITHRIL_CLIP, STAKATO_CHITIN, REINFORCED_BOWSTRING, MANASHEN_HORN, BLOOD_OF_LIZARDMAN, CRESCENT_MOON_BOW); addQuestStart(BERNARD); addTalkId(BERNARD, HAMIL, SIR_ARON_TANFORD, VOKIAN, GAUEN); addMyDying(ANT, ANT_CAPTAIN, ANT_OVERSEER, ANT_RECRUIT, ANT_PATROL, ANT_GUARD, NOBLE_ANT, NOBLE_ANT_LEADER, BREKA_ORC_SHAMAN, BREKA_ORC_OVERLORD, MARSH_STAKATO_WORKER, MARSH_STAKATO_SOLDIER, MARSH_STAKATO_DRONE, MARSH_SPIDER, ROAD_SCAVENGER, MANASHEN_GARGOYLE, LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_SHAMAN, LETO_LIZARDMAN_OVERLORD, SERPENT_DEMON_KADESH); } @Override public String onAdvEvent(String event, Npc npc, Player player) { String htmltext = event; QuestState st = player.getQuestList().getQuestState(QUEST_NAME); if (st == null) return htmltext; // BERNARD if (event.equalsIgnoreCase("30702-04.htm")) { st.setState(QuestStatus.STARTED); st.setCond(1); playSound(player, SOUND_ACCEPT); giveItems(player, BERNARD_INTRODUCTION, 1); if (giveDimensionalDiamonds39(player)) htmltext = "30702-04a.htm"; } // HAMIL else if (event.equalsIgnoreCase("30626-03.htm")) { st.setCond(2); playSound(player, SOUND_MIDDLE); takeItems(player, BERNARD_INTRODUCTION, 1); giveItems(player, HAMIL_LETTER_1, 1); } else if (event.equalsIgnoreCase("30626-07.htm")) { st.setCond(5); playSound(player, SOUND_MIDDLE); takeItems(player, HUNTER_RUNE_1, 10); giveItems(player, HAMIL_LETTER_2, 1); } // SIR_ARON_TANFORD else if (event.equalsIgnoreCase("30653-02.htm")) { st.setCond(3); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_1, 1); } // VOKIAN else if (event.equalsIgnoreCase("30514-02.htm")) { st.setCond(6); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_2, 1); } return htmltext; } @Override public String onTalk(Npc npc, Player player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestList().getQuestState(QUEST_NAME); if (st == null) return htmltext; switch (st.getState()) { case CREATED: if (player.getClassId() != ClassId.ROGUE && player.getClassId() != ClassId.ELVEN_SCOUT && player.getClassId() != ClassId.ASSASSIN) htmltext = "30702-02.htm"; else if (player.getStatus().getLevel() < 39) htmltext = "30702-01.htm"; else htmltext = "30702-03.htm"; break; case STARTED: int cond = st.getCond(); switch (npc.getNpcId()) { case BERNARD: htmltext = "30702-05.htm"; break; case HAMIL: if (cond == 1) htmltext = "30626-01.htm"; else if (cond == 2 || cond == 3) htmltext = "30626-04.htm"; else if (cond == 4) htmltext = "30626-05.htm"; else if (cond > 4 && cond < 8) htmltext = "30626-08.htm"; else if (cond == 8) { htmltext = "30626-09.htm"; st.setCond(9); playSound(player, SOUND_MIDDLE); takeItems(player, HUNTER_RUNE_2, 10); giveItems(player, HAMIL_LETTER_3, 1); } else if (cond > 8 && cond < 12) htmltext = "30626-10.htm"; else if (cond == 12) { htmltext = "30626-11.htm"; st.setCond(13); playSound(player, SOUND_MIDDLE); } else if (cond == 13) htmltext = "30626-12.htm"; else if (cond == 14) { htmltext = "30626-13.htm"; takeItems(player, BLOOD_OF_LIZARDMAN, -1); takeItems(player, CRESCENT_MOON_BOW, 1); takeItems(player, TALISMAN_OF_KADESH, 1); giveItems(player, MARK_OF_SAGITTARIUS, 1); rewardExpAndSp(player, 54726, 20250); player.broadcastPacket(new SocialAction(player, 3)); playSound(player, SOUND_FINISH); st.exitQuest(false); } break; case SIR_ARON_TANFORD: if (cond == 2) htmltext = "30653-01.htm"; else if (cond > 2) htmltext = "30653-03.htm"; break; case VOKIAN: if (cond == 5) htmltext = "30514-01.htm"; else if (cond == 6) htmltext = "30514-03.htm"; else if (cond == 7) { htmltext = "30514-04.htm"; st.setCond(8); playSound(player, SOUND_MIDDLE); takeItems(player, TALISMAN_OF_SNAKE, 1); } else if (cond > 7) htmltext = "30514-05.htm"; break; case GAUEN: if (cond == 9) { htmltext = "30717-01.htm"; st.setCond(10); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_3, 1); } else if (cond == 10) htmltext = "30717-03.htm"; else if (cond == 11) { htmltext = "30717-02.htm"; st.setCond(12); playSound(player, SOUND_MIDDLE); takeItems(player, MANASHEN_HORN, 1); takeItems(player, MITHRIL_CLIP, 1); takeItems(player, REINFORCED_BOWSTRING, 1); takeItems(player, STAKATO_CHITIN, 1); giveItems(player, CRESCENT_MOON_BOW, 1); giveItems(player, WOODEN_ARROW, 10); } else if (cond > 11) htmltext = "30717-04.htm"; break; } break; case COMPLETED: htmltext = getAlreadyCompletedMsg(); break; } return htmltext; } @Override public void onMyDying(Npc npc, Creature killer) { final Player player = killer.getActingPlayer(); final QuestState st = checkPlayerState(player, npc, QuestStatus.STARTED); if (st == null) return; switch (npc.getNpcId()) { case ANT: case ANT_CAPTAIN: case ANT_OVERSEER: case ANT_RECRUIT: case ANT_PATROL: case ANT_GUARD: case NOBLE_ANT: case NOBLE_ANT_LEADER: if (st.getCond() == 3 && dropItems(player, HUNTER_RUNE_1, 1, 10, 500000)) st.setCond(4); break; case BREKA_ORC_SHAMAN: case BREKA_ORC_OVERLORD: if (st.getCond() == 6 && dropItems(player, HUNTER_RUNE_2, 1, 10, 500000)) { st.setCond(7); giveItems(player, TALISMAN_OF_SNAKE, 1); } break; case MARSH_STAKATO_WORKER: case MARSH_STAKATO_SOLDIER: case MARSH_STAKATO_DRONE: if (st.getCond() == 10 && dropItems(player, STAKATO_CHITIN, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, MITHRIL_CLIP, REINFORCED_BOWSTRING)) st.setCond(11); break; case MARSH_SPIDER: if (st.getCond() == 10 && dropItems(player, REINFORCED_BOWSTRING, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, MITHRIL_CLIP, STAKATO_CHITIN)) st.setCond(11); break; case ROAD_SCAVENGER: if (st.getCond() == 10 && dropItems(player, MITHRIL_CLIP, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, REINFORCED_BOWSTRING, STAKATO_CHITIN)) st.setCond(11); break; case MANASHEN_GARGOYLE: if (st.getCond() == 10 && dropItems(player, MANASHEN_HORN, 1, 1, 100000) && player.getInventory().hasItems(REINFORCED_BOWSTRING, MITHRIL_CLIP, STAKATO_CHITIN)) st.setCond(11); break; case LETO_LIZARDMAN: case LETO_LIZARDMAN_ARCHER: case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: case LETO_LIZARDMAN_OVERLORD: if (st.getCond() == 13) { if (((player.getInventory().getItemCount(BLOOD_OF_LIZARDMAN) - 120) * 5) > Rnd.get(100)) { playSound(player, SOUND_BEFORE_BATTLE); takeItems(player, BLOOD_OF_LIZARDMAN, -1); addSpawn(SERPENT_DEMON_KADESH, player, false, 300000, true); } else dropItemsAlways(player, BLOOD_OF_LIZARDMAN, 1, 0); } break; case SERPENT_DEMON_KADESH: if (st.getCond() == 13) { if (player.getInventory().getItemIdFrom(Paperdoll.RHAND) == CRESCENT_MOON_BOW) { st.setCond(14); playSound(player, SOUND_MIDDLE); giveItems(player, TALISMAN_OF_KADESH, 1); } else addSpawn(SERPENT_DEMON_KADESH, player, false, 300000, true); } break; } } }  
×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.