Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/loginserverpackets/RequestCharacters.java
- ===================================================================
- --- /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/loginserverpackets/RequestCharacters.java (revision 646)
- +++ /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/loginserverpackets/RequestCharacters.java (revision 646)
- @@ -0,0 +1,40 @@
- +/*
- + * This program 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.
- + *
- + * This program 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.gameserver.network.loginserverpackets;
- +
- +import com.l2jserver.util.network.BaseRecievePacket;
- +
- +/**
- + * @author mrTJO
- + * Thanks to mochitto
- + */
- +public class RequestCharacters extends BaseRecievePacket
- +{
- + private String _account;
- +
- + public RequestCharacters(byte[] decrypt)
- + {
- + super(decrypt);
- + _account = readS();
- + }
- +
- + /**
- + * @return Return account name
- + */
- + public String getAccount()
- + {
- + return _account;
- + }
- +}
- Index: /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/gameserverpackets/ReplyCharacters.java
- ===================================================================
- --- /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/gameserverpackets/ReplyCharacters.java (revision 646)
- +++ /trunk/L2_GameServer/java/com/l2jserver/gameserver/network/gameserverpackets/ReplyCharacters.java (revision 646)
- @@ -0,0 +1,47 @@
- +/*
- + * This program 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.
- + *
- + * This program 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.gameserver.network.gameserverpackets;
- +
- +import java.io.IOException;
- +import java.util.List;
- +
- +import com.l2jserver.util.network.BaseSendablePacket;
- +
- +/**
- + * @author mrTJO
- + * Thanks to mochitto
- + */
- +public class ReplyCharacters extends BaseSendablePacket
- +{
- +
- + public ReplyCharacters(String account, int chars, List<Long> timeToDel)
- + {
- + writeC(0x08);
- + writeS(account);
- + writeC(chars);
- + writeC(timeToDel.size());
- + for (long time : timeToDel)
- + {
- + writeQ(time);
- + }
- + }
- +
- + @Override
- + public byte[] getContent() throws IOException
- + {
- + return getBytes();
- + }
- +
- +}
- Index: /trunk/L2_GameServer/java/com/l2jserver/gameserver/LoginServerThread.java
- ===================================================================
- --- /trunk/L2_GameServer/java/com/l2jserver/gameserver/LoginServerThread.java (revision 612)
- +++ /trunk/L2_GameServer/java/com/l2jserver/gameserver/LoginServerThread.java (revision 646)
- @@ -27,4 +27,9 @@
- import java.security.spec.RSAKeyGenParameterSpec;
- import java.security.spec.RSAPublicKeySpec;
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- @@ -37,4 +42,5 @@
- import com.l2jserver.Config;
- +import com.l2jserver.L2DatabaseFactory;
- import com.l2jserver.gameserver.model.L2World;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- @@ -51,4 +57,5 @@
- import com.l2jserver.gameserver.network.gameserverpackets.PlayerLogout;
- import com.l2jserver.gameserver.network.gameserverpackets.PlayerTracert;
- +import com.l2jserver.gameserver.network.gameserverpackets.ReplyCharacters;
- import com.l2jserver.gameserver.network.gameserverpackets.ServerStatus;
- import com.l2jserver.gameserver.network.gameserverpackets.UnBanIP;
- @@ -60,4 +67,5 @@
- import com.l2jserver.gameserver.network.loginserverpackets.LoginServerFail;
- import com.l2jserver.gameserver.network.loginserverpackets.PlayerAuthResponse;
- +import com.l2jserver.gameserver.network.loginserverpackets.RequestCharacters;
- import com.l2jserver.gameserver.network.serverpackets.CharSelectionInfo;
- import com.l2jserver.gameserver.network.serverpackets.LoginFail;
- @@ -206,9 +214,11 @@
- if (Config.DEBUG)
- _log.info("Init received");
- - if (init.getRevision() != REVISION)
- + int loginServerRevision;
- + if ((loginServerRevision = init.getRevision()) != REVISION)
- {
- //TODO: revision mismatch
- - _log.warning("/!\\ Revision mismatch between LS and GS /!\\");
- - break;
- + _log.warning(String.format("<!> Revision mismatch between LS(0x%04X) and GS(0x%04X) <!>", loginServerRevision, REVISION));
- + if (loginServerRevision != 0x0105 && loginServerRevision != 0x0106) //if High Five then pass
- + break;
- }
- try
- @@ -338,4 +348,8 @@
- doKickPlayer(kp.getAccount());
- break;
- + case 0x05:
- + RequestCharacters rc = new RequestCharacters(decrypt);
- + getCharsOnServer(rc.getAccount());
- + break;
- case 0xF8:
- new ChangePasswordResponse(decrypt);
- @@ -350,4 +364,12 @@
- if (Config.DEBUG)
- _log.log(Level.WARNING, "", e);
- + }
- + catch (java.net.ConnectException e)
- + {
- + _log.log(Level.WARNING, "Cannot connect LoginServer.");
- + }
- + catch (java.net.SocketException e)
- + {
- + _log.warning("LoginServer not avaible, trying to reconnect...");
- }
- catch (IOException e)
- @@ -491,4 +513,46 @@
- }
- + private void getCharsOnServer(String account)
- + {
- + Connection con = null;
- + int chars = 0;
- + List<Long> charToDel = new ArrayList<Long>();
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?");
- + statement.setString(1, account);
- + ResultSet rset = statement.executeQuery();
- + while (rset.next())
- + {
- + chars++;
- + long delTime = rset.getLong("deletetime");
- + if (delTime != 0)
- + charToDel.add(delTime);
- + }
- + rset.close();
- + statement.close();
- + }
- + catch (SQLException e)
- + {
- + _log.log(Level.WARNING, "Exception: getCharsOnServer: " + e.getMessage(), e);
- + }
- + finally
- + {
- + L2DatabaseFactory.close(con);
- + }
- +
- + ReplyCharacters rec = new ReplyCharacters(account, chars, charToDel);
- + try
- + {
- + sendPacket(rec);
- + }
- + catch (IOException e)
- + {
- + if (Config.DEBUG)
- + _log.log(Level.WARNING, "", e);
- + }
- +
- + }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement