You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.1 KiB
101 lines
3.1 KiB
3 years ago
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||
|
// Magicbane Emulator Project © 2013 - 2022
|
||
|
// www.magicbane.com
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||
|
// Magicbane Emulator Project © 2013 - 2022
|
||
|
// www.magicbane.com
|
||
|
|
||
|
|
||
|
package engine.net.client.msg;
|
||
|
|
||
|
import engine.Enum.RealmType;
|
||
|
import engine.net.AbstractConnection;
|
||
|
import engine.net.ByteBufferReader;
|
||
|
import engine.net.ByteBufferWriter;
|
||
|
import engine.net.client.Protocol;
|
||
|
import engine.objects.Realm;
|
||
|
|
||
|
|
||
|
public class WorldRealmMsg extends ClientNetMsg {
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* This is the general purpose constructor.
|
||
|
*/
|
||
|
public WorldRealmMsg() {
|
||
|
super(Protocol.REALMDATA);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 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 WorldRealmMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||
|
super(Protocol.REALMDATA, origin, reader);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected int getPowerOfTwoBufferSize() {
|
||
|
return (14); // 2^14 == 16384
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||
|
*/
|
||
|
|
||
|
@Override
|
||
|
protected void _serialize(ByteBufferWriter writer) {
|
||
|
|
||
|
int realmCount;
|
||
|
int realmID;
|
||
|
Realm serverRealm;
|
||
|
|
||
|
|
||
|
realmCount = RealmType.values().length - 1;
|
||
|
// Realm count without seafloor
|
||
|
|
||
|
writer.putInt(realmCount);
|
||
|
|
||
|
for (RealmType realmType : RealmType.values()) {
|
||
|
|
||
|
realmID = realmType.getRealmID();
|
||
|
// Don't serialize seafloor
|
||
|
|
||
|
if (realmID == 0)
|
||
|
continue;
|
||
|
|
||
|
serverRealm = Realm.getRealm(realmID);
|
||
|
serverRealm.serializeForClientMsg(writer);
|
||
|
|
||
|
}
|
||
|
|
||
|
writer.putInt(0x0);
|
||
|
writer.putInt(3000000);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||
|
*/
|
||
|
@Override
|
||
|
protected void _deserialize(ByteBufferReader reader) {
|
||
|
// TODO Implement Deserialization
|
||
|
}
|
||
|
}
|