|
@@ -18,6 +18,8 @@
|
|
*/
|
|
*/
|
|
package com.l2jserver.gameserver.network.clientpackets;
|
|
package com.l2jserver.gameserver.network.clientpackets;
|
|
|
|
|
|
|
|
+import static com.l2jserver.gameserver.network.L2GameClient.GameClientState.JOINING;
|
|
|
|
+
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.LogRecord;
|
|
import java.util.logging.LogRecord;
|
|
import java.util.logging.Logger;
|
|
import java.util.logging.Logger;
|
|
@@ -37,19 +39,14 @@ import com.l2jserver.gameserver.model.events.returns.TerminateReturn;
|
|
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
|
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
|
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
|
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
|
import com.l2jserver.gameserver.network.L2GameClient;
|
|
import com.l2jserver.gameserver.network.L2GameClient;
|
|
-import com.l2jserver.gameserver.network.L2GameClient.GameClientState;
|
|
|
|
import com.l2jserver.gameserver.network.serverpackets.CharSelected;
|
|
import com.l2jserver.gameserver.network.serverpackets.CharSelected;
|
|
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
|
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
|
import com.l2jserver.gameserver.network.serverpackets.SSQInfo;
|
|
import com.l2jserver.gameserver.network.serverpackets.SSQInfo;
|
|
import com.l2jserver.gameserver.network.serverpackets.ServerClose;
|
|
import com.l2jserver.gameserver.network.serverpackets.ServerClose;
|
|
|
|
|
|
-/**
|
|
|
|
- * This class ...
|
|
|
|
- * @version $Revision: 1.5.2.1.2.5 $ $Date: 2005/03/27 15:29:30 $
|
|
|
|
- */
|
|
|
|
-public class CharacterSelect extends L2GameClientPacket
|
|
|
|
-{
|
|
|
|
|
|
+public class CharacterSelect extends L2GameClientPacket {
|
|
private static final String _C__12_CHARACTERSELECT = "[C] 12 CharacterSelect";
|
|
private static final String _C__12_CHARACTERSELECT = "[C] 12 CharacterSelect";
|
|
|
|
+
|
|
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
|
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
|
|
|
|
|
// cd
|
|
// cd
|
|
@@ -65,8 +62,7 @@ public class CharacterSelect extends L2GameClientPacket
|
|
private int _unk4; // new in C4
|
|
private int _unk4; // new in C4
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- protected void readImpl()
|
|
|
|
- {
|
|
|
|
|
|
+ protected void readImpl() {
|
|
_charSlot = readD();
|
|
_charSlot = readD();
|
|
_unk1 = readH();
|
|
_unk1 = readH();
|
|
_unk2 = readD();
|
|
_unk2 = readD();
|
|
@@ -75,53 +71,43 @@ public class CharacterSelect extends L2GameClientPacket
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- protected void runImpl()
|
|
|
|
- {
|
|
|
|
|
|
+ protected void runImpl() {
|
|
final L2GameClient client = getClient();
|
|
final L2GameClient client = getClient();
|
|
- if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
|
|
|
|
- {
|
|
|
|
|
|
+ if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect")) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (SecondaryAuthData.getInstance().isEnabled() && !client.getSecondaryAuth().isAuthed())
|
|
|
|
- {
|
|
|
|
|
|
+ if (SecondaryAuthData.getInstance().isEnabled() && !client.getSecondaryAuth().isAuthed()) {
|
|
client.getSecondaryAuth().openDialog();
|
|
client.getSecondaryAuth().openDialog();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// We should always be able to acquire the lock
|
|
// We should always be able to acquire the lock
|
|
// But if we can't lock then nothing should be done (i.e. repeated packet)
|
|
// But if we can't lock then nothing should be done (i.e. repeated packet)
|
|
- if (client.getActiveCharLock().tryLock())
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
|
|
+ if (client.getActiveCharLock().tryLock()) {
|
|
|
|
+ try {
|
|
// should always be null
|
|
// should always be null
|
|
// but if not then this is repeated packet and nothing should be done here
|
|
// but if not then this is repeated packet and nothing should be done here
|
|
- if (client.getActiveChar() == null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (client.getActiveChar() == null) {
|
|
final CharSelectInfoPackage info = client.getCharSelection(_charSlot);
|
|
final CharSelectInfoPackage info = client.getCharSelection(_charSlot);
|
|
- if (info == null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (info == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// Banned?
|
|
// Banned?
|
|
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN)
|
|
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN)
|
|
- || PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN))
|
|
|
|
- {
|
|
|
|
|
|
+ || PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN)) {
|
|
client.close(ServerClose.STATIC_PACKET);
|
|
client.close(ServerClose.STATIC_PACKET);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// Selected character is banned (compatibility with previous versions).
|
|
// Selected character is banned (compatibility with previous versions).
|
|
- if (info.getAccessLevel() < 0)
|
|
|
|
- {
|
|
|
|
|
|
+ if (info.getAccessLevel() < 0) {
|
|
client.close(ServerClose.STATIC_PACKET);
|
|
client.close(ServerClose.STATIC_PACKET);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if ((Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddClient(AntiFeedManager.GAME_ID, client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP))
|
|
|
|
- {
|
|
|
|
|
|
+ if ((Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddClient(AntiFeedManager.GAME_ID, client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP)) {
|
|
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
|
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
|
msg.setFile(info.getHtmlPrefix(), "data/html/mods/IPRestriction.htm");
|
|
msg.setFile(info.getHtmlPrefix(), "data/html/mods/IPRestriction.htm");
|
|
msg.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP)));
|
|
msg.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP)));
|
|
@@ -130,15 +116,13 @@ public class CharacterSelect extends L2GameClientPacket
|
|
}
|
|
}
|
|
|
|
|
|
// The L2PcInstance must be created here, so that it can be attached to the L2GameClient
|
|
// The L2PcInstance must be created here, so that it can be attached to the L2GameClient
|
|
- if (Config.DEBUG)
|
|
|
|
- {
|
|
|
|
|
|
+ if (Config.DEBUG) {
|
|
_log.fine("selected slot:" + _charSlot);
|
|
_log.fine("selected slot:" + _charSlot);
|
|
}
|
|
}
|
|
|
|
|
|
// load up character from disk
|
|
// load up character from disk
|
|
final L2PcInstance cha = client.loadCharFromDisk(_charSlot);
|
|
final L2PcInstance cha = client.loadCharFromDisk(_charSlot);
|
|
- if (cha == null)
|
|
|
|
- {
|
|
|
|
|
|
+ if (cha == null) {
|
|
return; // handled in L2GameClient
|
|
return; // handled in L2GameClient
|
|
}
|
|
}
|
|
L2World.getInstance().addPlayerToWorld(cha);
|
|
L2World.getInstance().addPlayerToWorld(cha);
|
|
@@ -149,27 +133,24 @@ public class CharacterSelect extends L2GameClientPacket
|
|
cha.setOnlineStatus(true, true);
|
|
cha.setOnlineStatus(true, true);
|
|
|
|
|
|
final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerSelect(cha, cha.getObjectId(), cha.getName(), getClient()), Containers.Players(), TerminateReturn.class);
|
|
final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerSelect(cha, cha.getObjectId(), cha.getName(), getClient()), Containers.Players(), TerminateReturn.class);
|
|
- if ((terminate != null) && terminate.terminate())
|
|
|
|
- {
|
|
|
|
|
|
+ if ((terminate != null) && terminate.terminate()) {
|
|
cha.deleteMe();
|
|
cha.deleteMe();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
sendPacket(new SSQInfo());
|
|
sendPacket(new SSQInfo());
|
|
|
|
|
|
- client.setState(GameClientState.IN_GAME);
|
|
|
|
|
|
+ client.setState(JOINING);
|
|
CharSelected cs = new CharSelected(cha, client.getSessionId().playOkID1);
|
|
CharSelected cs = new CharSelected(cha, client.getSessionId().playOkID1);
|
|
sendPacket(cs);
|
|
sendPacket(cs);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- finally
|
|
|
|
- {
|
|
|
|
|
|
+ finally {
|
|
client.getActiveCharLock().unlock();
|
|
client.getActiveCharLock().unlock();
|
|
}
|
|
}
|
|
|
|
|
|
LogRecord record = new LogRecord(Level.INFO, "Logged in");
|
|
LogRecord record = new LogRecord(Level.INFO, "Logged in");
|
|
- record.setParameters(new Object[]
|
|
|
|
- {
|
|
|
|
|
|
+ record.setParameters(new Object[] {
|
|
client
|
|
client
|
|
});
|
|
});
|
|
_logAccounting.log(record);
|
|
_logAccounting.log(record);
|
|
@@ -177,8 +158,7 @@ public class CharacterSelect extends L2GameClientPacket
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String getType()
|
|
|
|
- {
|
|
|
|
|
|
+ public String getType() {
|
|
return _C__12_CHARACTERSELECT;
|
|
return _C__12_CHARACTERSELECT;
|
|
}
|
|
}
|
|
}
|
|
}
|