|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
|
|
|
|
package engine.net.client.msg.login;
|
|
|
|
|
|
|
|
|
|
|
|
import engine.gameManager.ConfigManager;
|
|
|
|
import engine.net.AbstractConnection;
|
|
|
|
import engine.net.ByteBufferReader;
|
|
|
|
import engine.net.ByteBufferWriter;
|
|
|
|
import engine.net.client.Protocol;
|
|
|
|
import engine.net.client.msg.ClientNetMsg;
|
|
|
|
|
|
|
|
public class GameServerIPResponseMsg extends ClientNetMsg {
|
|
|
|
|
|
|
|
private String ip;
|
|
|
|
private int port;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the general purpose constructor.
|
|
|
|
*/
|
|
|
|
public GameServerIPResponseMsg(String ip, int port) {
|
|
|
|
super(Protocol.GAMESERVERIPRESPONSE);
|
|
|
|
this.ip = ip;
|
|
|
|
this.port = port;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the general purpose constructor.
|
|
|
|
*/
|
|
|
|
public GameServerIPResponseMsg() {
|
|
|
|
super(Protocol.GAMESERVERIPRESPONSE);
|
|
|
|
this.ip = ConfigManager.MB_EXTERNAL_ADDR.getValue();
|
|
|
|
this.port = Integer.parseInt(ConfigManager.MB_WORLD_PORT.getValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
|
|
|
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
|
|
|
* past the limit) then this constructor Throws that Exception to the
|
|
|
|
* caller.
|
|
|
|
*/
|
|
|
|
public GameServerIPResponseMsg(AbstractConnection origin,
|
|
|
|
ByteBufferReader reader) {
|
|
|
|
super(Protocol.GAMESERVERIPRESPONSE, origin, reader);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void _serialize(ByteBufferWriter writer) {
|
|
|
|
writer.putString(this.ip);
|
|
|
|
writer.putInt(this.port);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void _deserialize(ByteBufferReader reader) {
|
|
|
|
this.ip = reader.getString();
|
|
|
|
this.port = reader.getInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the ip
|
|
|
|
*/
|
|
|
|
public String getIp() {
|
|
|
|
return ip;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the port
|
|
|
|
*/
|
|
|
|
public int getPort() {
|
|
|
|
return port;
|
|
|
|
}
|
|
|
|
}
|