This commit is contained in:
mobius
2015-01-01 20:02:50 +00:00
parent eeae660458
commit a6a3718849
17894 changed files with 2818932 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 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.network.serverpackets;
/**
* @author KenM
*/
public final class AccountKicked extends L2LoginServerPacket
{
public static enum AccountKickedReason
{
REASON_DATA_STEALER(0x01),
REASON_GENERIC_VIOLATION(0x08),
REASON_7_DAYS_SUSPENDED(0x10),
REASON_PERMANENTLY_BANNED(0x20);
private final int _code;
AccountKickedReason(int code)
{
_code = code;
}
public final int getCode()
{
return _code;
}
}
private final AccountKickedReason _reason;
/**
* @param reason
*/
public AccountKicked(AccountKickedReason reason)
{
_reason = reason;
}
@Override
protected void write()
{
writeC(0x02);
writeD(_reason.getCode());
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 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.network.serverpackets;
import java.util.logging.Logger;
import com.l2jserver.Config;
/**
* Fromat: d d: response
*/
public final class GGAuth extends L2LoginServerPacket
{
static final Logger _log = Logger.getLogger(GGAuth.class.getName());
public static final int SKIP_GG_AUTH_REQUEST = 0x0b;
private final int _response;
public GGAuth(int response)
{
_response = response;
if (Config.DEBUG)
{
_log.warning("Reason Hex: " + (Integer.toHexString(response)));
}
}
@Override
protected void write()
{
writeC(0x0b);
writeD(_response);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
}
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 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.network.serverpackets;
import com.l2jserver.loginserver.network.L2LoginClient;
/**
* <pre>
* Format: dd b dddd s
* d: session id
* d: protocol revision
* b: 0x90 bytes : 0x80 bytes for the scrambled RSA public key
* 0x10 bytes at 0x00
* d: unknow
* d: unknow
* d: unknow
* d: unknow
* s: blowfish key
* </pre>
*/
public final class Init extends L2LoginServerPacket
{
private final int _sessionId;
private final byte[] _publicKey;
private final byte[] _blowfishKey;
public Init(L2LoginClient client)
{
this(client.getScrambledModulus(), client.getBlowfishKey(), client.getSessionId());
}
public Init(byte[] publickey, byte[] blowfishkey, int sessionId)
{
_sessionId = sessionId;
_publicKey = publickey;
_blowfishKey = blowfishkey;
}
@Override
protected void write()
{
writeC(0x00); // init packet id
writeD(_sessionId); // session id
writeD(0x0000c621); // protocol revision
writeB(_publicKey); // RSA Public Key
// unk GG related?
writeD(0x29DD954E);
writeD(0x77C39CFC);
writeD(0x97ADB620);
writeD(0x07BDE0F7);
writeB(_blowfishKey); // BlowFish key
writeC(0x00); // null termination ;)
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 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.network.serverpackets;
import org.mmocore.network.SendablePacket;
import com.l2jserver.loginserver.network.L2LoginClient;
/**
* @author KenM
*/
public abstract class L2LoginServerPacket extends SendablePacket<L2LoginClient>
{
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 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.network.serverpackets;
/**
* Fromat: d d: the failure reason
*/
public final class LoginFail extends L2LoginServerPacket
{
public static enum LoginFailReason
{
REASON_NO_MESSAGE(0x00),
REASON_SYSTEM_ERROR_LOGIN_LATER(0x01),
REASON_USER_OR_PASS_WRONG(0x02),
REASON_ACCESS_FAILED_TRY_AGAIN_LATER(0x04),
REASON_ACCOUNT_INFO_INCORRECT_CONTACT_SUPPORT(0x05),
REASON_ACCOUNT_IN_USE(0x07),
REASON_UNDER_18_YEARS_KR(0x0C),
REASON_SERVER_OVERLOADED(0x0F),
REASON_SERVER_MAINTENANCE(0x10),
REASON_TEMP_PASS_EXPIRED(0x11),
REASON_GAME_TIME_EXPIRED(0x12),
REASON_NO_TIME_LEFT(0x13),
REASON_SYSTEM_ERROR(0x14),
REASON_ACCESS_FAILED(0x15),
REASON_RESTRICTED_IP(0x16),
REASON_WEEK_USAGE_FINISHED(0x1E),
REASON_SECURITY_CARD_NUMBER_INVALID(0x1F),
REASON_AGE_NOT_VERIFIED_CANT_LOG_BEETWEEN_10PM_6AM(0x20),
REASON_SERVER_CANNOT_BE_ACCESSED_BY_YOUR_COUPON(0x21),
REASON_DUAL_BOX(0x23),
REASON_INACTIVE(0x24),
REASON_USER_AGREEMENT_REJECTED_ON_WEBSITE(0x25),
REASON_GUARDIAN_CONSENT_REQUIRED(0x26),
REASON_USER_AGREEMENT_DECLINED_OR_WITHDRAWL_REQUEST(0x27),
REASON_ACCOUNT_SUSPENDED_CALL(0x28),
REASON_CHANGE_PASSWORD_AND_QUIZ_ON_WEBSITE(0x29),
REASON_ALREADY_LOGGED_INTO_10_ACCOUNTS(0x2A),
REASON_MASTER_ACCOUNT_RESTRICTED(0x2B),
REASON_CERTIFICATION_FAILED(0x2E),
REASON_TELEPHONE_CERTIFICATION_UNAVAILABLE(0x2F),
REASON_TELEPHONE_SIGNALS_DELAYED(0x30),
REASON_CERTIFICATION_FAILED_LINE_BUSY(0x31),
REASON_CERTIFICATION_SERVICE_NUMBER_EXPIRED_OR_INCORRECT(0x32),
REASON_CERTIFICATION_SERVICE_CURRENTLY_BEING_CHECKED(0x33),
REASON_CERTIFICATION_SERVICE_CANT_BE_USED_HEAVY_VOLUME(0x34),
REASON_CERTIFICATION_SERVICE_EXPIRED_GAMEPLAY_BLOCKED(0x35),
REASON_CERTIFICATION_FAILED_3_TIMES_GAMEPLAY_BLOCKED_30_MIN(0x36),
REASON_CERTIFICATION_DAILY_USE_EXCEEDED(0x37),
REASON_CERTIFICATION_UNDERWAY_TRY_AGAIN_LATER(0x38);
private final int _code;
LoginFailReason(int code)
{
_code = code;
}
public final int getCode()
{
return _code;
}
}
private final LoginFailReason _reason;
public LoginFail(LoginFailReason reason)
{
_reason = reason;
}
@Override
protected void write()
{
writeC(0x01);
writeC(_reason.getCode());
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 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.network.serverpackets;
import com.l2jserver.loginserver.SessionKey;
/**
* <pre>
* Format: dddddddd
* f: the session key
* d: ?
* d: ?
* d: ?
* d: ?
* d: ?
* d: ?
* b: 16 bytes - unknown
* </pre>
*/
public final class LoginOk extends L2LoginServerPacket
{
private final int _loginOk1, _loginOk2;
public LoginOk(SessionKey sessionKey)
{
_loginOk1 = sessionKey.loginOkID1;
_loginOk2 = sessionKey.loginOkID2;
}
@Override
protected void write()
{
writeC(0x03);
writeD(_loginOk1);
writeD(_loginOk2);
writeD(0x00);
writeD(0x00);
writeD(0x000003ea);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeB(new byte[16]);
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (C) 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.network.serverpackets;
/**
* This class ...
* @version $Revision: 1.2.4.1 $ $Date: 2005/03/27 15:30:11 $
*/
public final class PlayFail extends L2LoginServerPacket
{
public static enum PlayFailReason
{
REASON_NO_MESSAGE(0x00),
REASON_SYSTEM_ERROR_LOGIN_LATER(0x01),
REASON_USER_OR_PASS_WRONG(0x02),
REASON_ACCESS_FAILED_TRY_AGAIN_LATER(0x04),
REASON_ACCOUNT_INFO_INCORRECT_CONTACT_SUPPORT(0x05),
REASON_ACCOUNT_IN_USE(0x07),
REASON_UNDER_18_YEARS_KR(0x0C),
REASON_SERVER_OVERLOADED(0x0F),
REASON_SERVER_MAINTENANCE(0x10),
REASON_TEMP_PASS_EXPIRED(0x11),
REASON_GAME_TIME_EXPIRED(0x12),
REASON_NO_TIME_LEFT(0x13),
REASON_SYSTEM_ERROR(0x14),
REASON_ACCESS_FAILED(0x15),
REASON_RESTRICTED_IP(0x16),
REASON_WEEK_USAGE_FINISHED(0x1E),
REASON_SECURITY_CARD_NUMBER_INVALID(0x1F),
REASON_AGE_NOT_VERIFIED_CANT_LOG_BEETWEEN_10PM_6AM(0x20),
REASON_SERVER_CANNOT_BE_ACCESSED_BY_YOUR_COUPON(0x21),
REASON_DUAL_BOX(0x23),
REASON_INACTIVE(0x24),
REASON_USER_AGREEMENT_REJECTED_ON_WEBSITE(0x25),
REASON_GUARDIAN_CONSENT_REQUIRED(0x26),
REASON_USER_AGREEMENT_DECLINED_OR_WITHDRAWL_REQUEST(0x27),
REASON_ACCOUNT_SUSPENDED_CALL(0x28),
REASON_CHANGE_PASSWORD_AND_QUIZ_ON_WEBSITE(0x29),
REASON_ALREADY_LOGGED_INTO_10_ACCOUNTS(0x2A),
REASON_MASTER_ACCOUNT_RESTRICTED(0x2B),
REASON_CERTIFICATION_FAILED(0x2E),
REASON_TELEPHONE_CERTIFICATION_UNAVAILABLE(0x2F),
REASON_TELEPHONE_SIGNALS_DELAYED(0x30),
REASON_CERTIFICATION_FAILED_LINE_BUSY(0x31),
REASON_CERTIFICATION_SERVICE_NUMBER_EXPIRED_OR_INCORRECT(0x32),
REASON_CERTIFICATION_SERVICE_CURRENTLY_BEING_CHECKED(0x33),
REASON_CERTIFICATION_SERVICE_CANT_BE_USED_HEAVY_VOLUME(0x34),
REASON_CERTIFICATION_SERVICE_EXPIRED_GAMEPLAY_BLOCKED(0x35),
REASON_CERTIFICATION_FAILED_3_TIMES_GAMEPLAY_BLOCKED_30_MIN(0x36),
REASON_CERTIFICATION_DAILY_USE_EXCEEDED(0x37),
REASON_CERTIFICATION_UNDERWAY_TRY_AGAIN_LATER(0x38);
private final int _code;
PlayFailReason(int code)
{
_code = code;
}
public final int getCode()
{
return _code;
}
}
private final PlayFailReason _reason;
public PlayFail(PlayFailReason reason)
{
_reason = reason;
}
@Override
protected void write()
{
writeC(0x06);
writeC(_reason.getCode());
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 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.network.serverpackets;
import com.l2jserver.loginserver.SessionKey;
/**
*
*/
public final class PlayOk extends L2LoginServerPacket
{
private final int _playOk1, _playOk2;
public PlayOk(SessionKey sessionKey)
{
_playOk1 = sessionKey.playOkID1;
_playOk2 = sessionKey.playOkID2;
}
@Override
protected void write()
{
writeC(0x07);
writeD(_playOk1);
writeD(_playOk2);
}
}

View File

@@ -0,0 +1,176 @@
/*
* Copyright (C) 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.network.serverpackets;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import com.l2jserver.loginserver.GameServerTable;
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.gameserverpackets.ServerStatus;
/**
* ServerList
*
* <pre>
* Format: cc [cddcchhcdc]
*
* c: server list size (number of servers)
* c: ?
* [ (repeat for each servers)
* c: server id (ignored by client?)
* d: server ip
* d: server port
* c: age limit (used by client?)
* c: pvp or not (used by client?)
* h: current number of players
* h: max number of players
* c: 0 if server is down
* d: 2nd bit: clock
* 3rd bit: won't display server name
* 4th bit: test server (used by client?)
* c: 0 if you don't want to display brackets in front of sever name
* ]
* </pre>
*
* Server will be considered as Good when the number of online players<br>
* is less than half the maximum. as Normal between half and 4/5<br>
* and Full when there's more than 4/5 of the maximum number of players.
*/
public final class ServerList extends L2LoginServerPacket
{
protected static final Logger _log = Logger.getLogger(ServerList.class.getName());
private final List<ServerData> _servers;
private final int _lastServer;
private final Map<Integer, Integer> _charsOnServers;
private final Map<Integer, long[]> _charsToDelete;
class ServerData
{
protected byte[] _ip;
protected int _port;
protected int _ageLimit;
protected boolean _pvp;
protected int _currentPlayers;
protected int _maxPlayers;
protected boolean _brackets;
protected boolean _clock;
protected int _status;
protected int _serverId;
protected int _serverType;
ServerData(L2LoginClient client, GameServerInfo gsi)
{
try
{
_ip = InetAddress.getByName(gsi.getServerAddress(client.getConnection().getInetAddress())).getAddress();
}
catch (UnknownHostException e)
{
_log.warning(getClass().getSimpleName() + ": " + e.getMessage());
_ip = new byte[4];
_ip[0] = 127;
_ip[1] = 0;
_ip[2] = 0;
_ip[3] = 1;
}
_port = gsi.getPort();
_pvp = gsi.isPvp();
_serverType = gsi.getServerType();
_currentPlayers = gsi.getCurrentPlayerCount();
_maxPlayers = gsi.getMaxPlayers();
_ageLimit = 0;
_brackets = gsi.isShowingBrackets();
// If server GM-only - show status only to GMs
_status = gsi.getStatus() != ServerStatus.STATUS_GM_ONLY ? gsi.getStatus() : client.getAccessLevel() > 0 ? gsi.getStatus() : ServerStatus.STATUS_DOWN;
_serverId = gsi.getId();
}
}
public ServerList(L2LoginClient client)
{
_servers = new ArrayList<>(GameServerTable.getInstance().getRegisteredGameServers().size());
_lastServer = client.getLastServer();
for (GameServerInfo gsi : GameServerTable.getInstance().getRegisteredGameServers().values())
{
_servers.add(new ServerData(client, gsi));
}
_charsOnServers = client.getCharsOnServ();
_charsToDelete = client.getCharsWaitingDelOnServ();
}
@Override
public void write()
{
writeC(0x04);
writeC(_servers.size());
writeC(_lastServer);
for (ServerData server : _servers)
{
writeC(server._serverId); // server id
writeC(server._ip[0] & 0xff);
writeC(server._ip[1] & 0xff);
writeC(server._ip[2] & 0xff);
writeC(server._ip[3] & 0xff);
writeD(server._port);
writeC(server._ageLimit); // Age Limit 0, 15, 18
writeC(server._pvp ? 0x01 : 0x00);
writeH(server._currentPlayers);
writeH(server._maxPlayers);
writeC(server._status == ServerStatus.STATUS_DOWN ? 0x00 : 0x01);
writeD(server._serverType); // 1: Normal, 2: Relax, 4: Public Test, 8: No Label, 16: Character Creation Restricted, 32: Event, 64: Free
writeC(server._brackets ? 0x01 : 0x00);
}
writeH(0x00); // unknown
if (_charsOnServers != null)
{
writeC(_charsOnServers.size());
for (int servId : _charsOnServers.keySet())
{
writeC(servId);
writeC(_charsOnServers.get(servId));
if ((_charsToDelete == null) || !_charsToDelete.containsKey(servId))
{
writeC(0x00);
}
else
{
writeC(_charsToDelete.get(servId).length);
for (long deleteTime : _charsToDelete.get(servId))
{
writeD((int) ((deleteTime - System.currentTimeMillis()) / 1000));
}
}
}
}
else
{
writeC(0x00);
}
}
}