this fix allows ppl who host and play on same machines to play without use of loop back and allows outside connections
this allows use of 127.0.0.1 clients to play without that retarded kick to title after picking a char.
ADD IN gameconstants:
REPLACE IN CFIELD:
this allows use of 127.0.0.1 clients to play without that retarded kick to title after picking a char.
ADD IN gameconstants:
Code:
X.x.x.x = wan ip of server
public static final byte[] Gateway_IP = new byte[]{(byte) X, (byte) X, (byte) X, (byte) X};
public static final byte[] localhost = new byte[]{(byte) 127, (byte) 0, (byte) 0, (byte) 1};
Code:
public static byte[] getServerIP(final MapleClient c, final int port, final int clientId) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SERVER_IP.getValue());
mplew.writeShort(0);
if (c.getTempIP().length() > 0) {
for (String s : c.getTempIP().split(",")) {
mplew.write(Integer.parseInt(s));
}
} else {
if (c.getSessionIPAddress().equals("/127.0.0.1")) {
System.out.println("Admin Logged in");
mplew.write(GameConstants.localhost);
} else {
mplew.write(GameConstants.Gateway_IP);
}
}
mplew.writeShort(port);
mplew.writeInt(clientId);
mplew.writeZeroBytes(10);
return mplew.getPacket();
}
public static byte[] getChannelChange(final MapleClient c, final int port) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.CHANGE_CHANNEL.getValue());
mplew.write(1);
if (c.getTempIP().length() > 0) {
for (String s : c.getTempIP().split(",")) {
mplew.write(Integer.parseInt(s));
}
} else {
if (c.getSessionIPAddress().equals("/127.0.0.1")) {
System.out.println("Admin Logged in");
mplew.write(GameConstants.localhost);
} else {
mplew.write(GameConstants.Gateway_IP);
}
}
mplew.writeShort(port);
mplew.write(0);
return mplew.getPacket();
}