public static final void Character_WithoutSecondPassword( final LittleEndianAccessor slea, final MapleClient c, final boolean haspic, final boolean view) { slea.readByte(); // 1? slea.readByte(); // 1? final int charId = slea.readInt(); if (view) { c.setChannel(1); c.setWorld(slea.readInt()); } final String currentpw = c.getSecondPassword(); if (!c.isLoggedIn() || loginFailCount(c) || (currentpw != null && (!currentpw.equals("") || haspic)) || !c.login_Auth(charId) || ChannelServer.getInstance(c.getChannel()) == null || c.getWorld() != 0) { // TODOO: MULTI WORLDS c.getSession().close(); return; } c.updateMacs(slea.readMapleAsciiString()); slea.readMapleAsciiString(); if (slea.available() != 0) { final String setpassword = slea.readMapleAsciiString(); if (setpassword.length() >= 6 && setpassword.length() <= 16) { c.setSecondPassword(setpassword); c.updateSecondPassword(); } else { c.getSession().write(LoginPacket.secondPwError((byte) 0x14)); return; } } else if (GameConstants.GMS && haspic) { return; } if (c.getIdleTask() != null) { c.getIdleTask().cancel(true); } final String s = c.getSessionIPAddress(); LoginServer.putLoginAuth( charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel()); c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s); c.getSession() .write( CField.getServerIP( c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId)); }
@Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { String pic = slea.readMapleAsciiString(); int charId = slea.readInt(); byte world = (byte) slea.readInt(); // world c.setWorld(world); byte channel = (byte) Randomizer.rand(0, Server.getInstance().getWorld(world).getChannels().size()); c.setChannel(channel); String macs = slea.readMapleAsciiString(); c.updateMacs(macs); if (c.hasBannedMac()) { c.getSession().close(true); return; } if (c.checkPic(pic)) { try { if (c.getIdleTask() != null) { c.getIdleTask().cancel(true); } c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION); String channelServerIP = MapleClient.getChannelServerIPFromSubnet( c.getSession().getRemoteAddress().toString().replace("/", "").split(":")[0], channel); if (channelServerIP.equals("0.0.0.0")) { String[] socket = Server.getInstance().getIP(world, channel).split(":"); c.announce( MaplePacketCreator.getServerIP( InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId)); } else { String[] socket = Server.getInstance().getIP(world, channel).split(":"); c.announce( MaplePacketCreator.getServerIP( InetAddress.getByName(channelServerIP), Integer.parseInt(socket[1]), charId)); } } catch (UnknownHostException e) { log.error("Host not found", e); } } else { c.announce(MaplePacketCreator.wrongPic()); } }
public static final void Character_WithSecondPassword( LittleEndianAccessor slea, MapleClient c, boolean view) { String password = slea.readMapleAsciiString(); int charId = slea.readInt(); if (view) { c.setChannel(1); c.setWorld(slea.readInt()); } if ((!c.isLoggedIn()) || (loginFailCount(c)) || (c.getSecondPassword() == null) || (!c.login_Auth(charId)) || (ChannelServer.getInstance(c.getChannel()) == null) || (c.getWorld() != 0)) { c.getSession().close(true); return; } if (GameConstants.GMS) { c.updateMacs(slea.readMapleAsciiString()); } if ((c.CheckSecondPassword(password)) && (password.length() >= 6) && (password.length() <= 16)) { if (c.getIdleTask() != null) { c.getIdleTask().cancel(true); } String s = c.getSessionIPAddress(); LoginServer.putLoginAuth(charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP()); c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s); c.getSession() .write( CField.getServerIP( c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId)); System.out.println("Sent serverIp"); } else { c.getSession().write(LoginPacket.secondPwError((byte) 0x14)); } }