Files
BattleBane/src/engine/net/client/msg/RecommendNationMsg.java
T

90 lines
2.7 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg;
import engine.Enum.GameObjectType;
import engine.exception.SerializationException;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.objects.PlayerCharacter;
public class RecommendNationMsg extends ClientNetMsg {
2023-07-15 09:23:48 -04:00
private int guildID;
private byte ally;
private byte enemy;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public RecommendNationMsg(PlayerCharacter player) {
super(Protocol.RECOMMENDNATION);
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public RecommendNationMsg() {
super(Protocol.RECOMMENDNATION);
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
/**
* 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 RecommendNationMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.RECOMMENDNATION, origin, reader);
}
//CALL THIS AFTER SANITY CHECKS AND BEFORE UPDATING HEALTH/GOLD.
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
/**
* Deserializes the subclass specific items from the supplied NetMsgReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
reader.getInt();
this.guildID = reader.getInt();
this.ally = reader.get();
this.enemy = reader.get();
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// Precache and configure this message before we serialize it
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
/**
* Serializes the subclass specific items to the supplied NetMsgWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
writer.putInt(GameObjectType.Guild.ordinal());
writer.putInt(guildID);
writer.put(this.ally);
writer.put(this.enemy);
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getGuildID() {
return guildID;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public byte getAlly() {
return ally;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public byte getEnemy() {
return enemy;
}
2022-04-30 09:41:17 -04:00
}