loginserver\gameservercon\gspackets\ReplyCharacters.java
Код:
package l2open.loginserver.gameservercon.gspackets;
import l2open.loginserver.gameservercon.AttGS;
import l2open.loginserver.LoginController;
/**
* @author mrTJO
* Thanks to mochitto
*/
public class ReplyCharacters extends ClientBasePacket
{
private AttGS gameserver;
public ReplyCharacters(byte[] decrypt, AttGS gameserver)
{
super(decrypt, gameserver);
this.gameserver = gameserver;
}
@Override
public void read()
{
String account = readS();
int chars = readC();
int charsToDel = readC();
long[] charsList = new long[charsToDel];
for (int i = 0; i < charsToDel; i++)
{
charsList[i] = (long)readF();
}
LoginController.getInstance().setCharactersOnServer(account, chars, charsList, gameserver.getServerId());
}
}
gameserver\loginservercon\gspackets\ReplyCharacters.java
Код:
package l2open.gameserver.loginservercon.gspackets;
import java.util.List;
/**
* @author mrTJO
* Thanks to mochitto
*/
public class ReplyCharacters extends GameServerBasePacket
{
public ReplyCharacters(String account, int chars, List<Long> timeToDel)
{
writeC(0x0f);
writeS(account);
writeC(chars);
writeC(timeToDel.size());
for (long time : timeToDel)
{
writeF((double)time);
}
}
}
loginserver\LoginController.java
Код:
*******
public void setCharactersOnServer(String account, int charsNum, long[] timeToDel, int serverId)
{
L2LoginClient client = _loginServerClients.get(account);
if (client == null)
return;
if (charsNum > 0)
client.setCharsOnServ(serverId, charsNum);
if (timeToDel.length > 0)
client.serCharsWaitingDelOnServ(serverId, timeToDel);
}
*******
loginserver\L2LoginClient.java
Код:
**********
private Map<Integer, Integer> _charsOnServers;
private Map<Integer, long[]> _charsToDelete;
**********
public void setCharsOnServ(int servId, int chars)
{
if (_charsOnServers == null)
_charsOnServers = new HashMap<Integer, Integer>();
_charsOnServers.put(servId, chars);
}
public Map<Integer, Integer> getCharsOnServ()
{
return _charsOnServers;
}
public void serCharsWaitingDelOnServ(int servId, long[] charsToDel)
{
if (_charsToDelete == null)
_charsToDelete = new HashMap<Integer, long[]>();
_charsToDelete.put(servId, charsToDel);
}
public Map<Integer, long[]> getCharsWaitingDelOnServ()
{
return _charsToDelete;
}
********************
В каком файле фени мне написать данное обращение к пакету.....
в Лыже отправка идет:
com\l2jserver\gameserver\LoginServerThread.java
Код:
*************************************
case 0x05:
RequestCharacters rc = new RequestCharacters(decrypt);
getCharsOnServer(rc.getAccount());
break;
***************************************
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);
}
}
****************************************
Вот вроде весь код дал, в пакетах не силен только учусь.....