|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
|
|
|
|
package engine.net.client.msg;
|
|
|
|
|
|
|
|
|
|
|
|
import engine.net.AbstractConnection;
|
|
|
|
import engine.net.ByteBufferReader;
|
|
|
|
import engine.net.ByteBufferWriter;
|
|
|
|
import engine.net.client.Protocol;
|
|
|
|
|
|
|
|
|
|
|
|
public class ItemHealthUpdateMsg extends ClientNetMsg {
|
|
|
|
|
|
|
|
private int slot;
|
|
|
|
private float newDurability;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the general purpose constructor.
|
|
|
|
*/
|
|
|
|
public ItemHealthUpdateMsg(int slot, float newDurability) {
|
|
|
|
super(Protocol.ITEMHEALTHUPDATE);
|
|
|
|
this.slot = slot;
|
|
|
|
this.newDurability = newDurability;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 ItemHealthUpdateMsg(AbstractConnection origin, ByteBufferReader reader) {
|
|
|
|
super(Protocol.ITEMHEALTHUPDATE, origin, reader);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void _serialize(ByteBufferWriter writer) {
|
|
|
|
writer.putInt(this.slot);
|
|
|
|
writer.putFloat(this.newDurability);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void _deserialize(ByteBufferReader reader) {
|
|
|
|
this.slot = reader.getInt();
|
|
|
|
this.newDurability = reader.getFloat();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getSlot() {
|
|
|
|
return this.slot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSlot(int value) {
|
|
|
|
this.slot = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getNewDurability() {
|
|
|
|
return this.newDurability;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setNewDurability(float value) {
|
|
|
|
this.newDurability = value;
|
|
|
|
}
|
|
|
|
}
|