Use MapleClient for session management
First working version of the Netty implementation, but there's a lot remaining to be done.
This commit is contained in:
@@ -22,37 +22,28 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.MapleClient;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import net.server.coordinator.session.Hwid;
|
||||
import net.server.coordinator.session.MapleSessionCoordinator;
|
||||
import net.server.coordinator.session.MapleSessionCoordinator.AntiMulticlientResult;
|
||||
import net.server.world.World;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public final class CharSelectedHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
private static int parseAntiMulticlientError(AntiMulticlientResult res) {
|
||||
switch (res) {
|
||||
case REMOTE_PROCESSING:
|
||||
return 10;
|
||||
|
||||
case REMOTE_LOGGEDIN:
|
||||
return 7;
|
||||
|
||||
case REMOTE_NO_MATCH:
|
||||
return 17;
|
||||
|
||||
case COORDINATOR_ERROR:
|
||||
return 8;
|
||||
|
||||
default:
|
||||
return 9;
|
||||
}
|
||||
return switch (res) {
|
||||
case REMOTE_PROCESSING -> 10;
|
||||
case REMOTE_LOGGEDIN -> 7;
|
||||
case REMOTE_NO_MATCH -> 17;
|
||||
case COORDINATOR_ERROR -> 8;
|
||||
default -> 9;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,22 +60,21 @@ public final class CharSelectedHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
c.updateMacs(macs);
|
||||
c.updateHwid(hwid);
|
||||
|
||||
IoSession session = c.getSession();
|
||||
AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptGameSession(session, c.getAccID(), hwid);
|
||||
|
||||
AntiMulticlientResult res = MapleSessionCoordinator.getInstance().attemptGameSession(c, c.getAccID(), hwid);
|
||||
if (res != AntiMulticlientResult.SUCCESS) {
|
||||
c.announce(MaplePacketCreator.getAfterLoginError(parseAntiMulticlientError(res)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (c.hasBannedMac() || c.hasBannedHWID()) {
|
||||
MapleSessionCoordinator.getInstance().closeSession(session, true);
|
||||
MapleSessionCoordinator.getInstance().closeSession(c, true);
|
||||
return;
|
||||
}
|
||||
|
||||
Server server = Server.getInstance();
|
||||
if(!server.haveCharacterEntry(c.getAccID(), charId)) {
|
||||
MapleSessionCoordinator.getInstance().closeSession(session, true);
|
||||
MapleSessionCoordinator.getInstance().closeSession(c, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,7 +85,7 @@ public final class CharSelectedHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] socket = server.getInetSocket(session, c.getWorld(), c.getChannel());
|
||||
String[] socket = server.getInetSocket(c, c.getWorld(), c.getChannel());
|
||||
if(socket == null) {
|
||||
c.announce(MaplePacketCreator.getAfterLoginError(10));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user