85 lines
2.7 KiB
85 lines
2.7 KiB
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . |
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· |
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ |
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ |
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ |
|
// 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 ToggleCombatMsg extends ClientNetMsg { |
|
|
|
private int sourceType; |
|
private int sourceID; |
|
private boolean toggleCombat; |
|
|
|
/** |
|
* This is the general purpose constructor. |
|
*/ |
|
public ToggleCombatMsg() { |
|
super(Protocol.COMBATMODE); |
|
} |
|
|
|
/** |
|
* 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 ToggleCombatMsg(AbstractConnection origin, ByteBufferReader reader) { |
|
super(Protocol.COMBATMODE, origin, reader); |
|
} |
|
|
|
/** |
|
* Serializes the subclass specific items to the supplied NetMsgWriter. |
|
*/ |
|
@Override |
|
protected void _serialize(ByteBufferWriter writer) { |
|
writer.putInt(this.sourceType); |
|
writer.putInt(this.sourceID); |
|
writer.put(this.toggleCombat ? (byte) 0x01 : (byte) 0x00); |
|
} |
|
|
|
/** |
|
* Deserializes the subclass specific items from the supplied NetMsgReader. |
|
*/ |
|
@Override |
|
protected void _deserialize(ByteBufferReader reader) { |
|
this.sourceType = reader.getInt(); |
|
this.sourceID = reader.getInt(); |
|
this.toggleCombat = (reader.get() == (byte) 0x01) ? true : false; |
|
} |
|
|
|
public int getSourceType() { |
|
return this.sourceType; |
|
} |
|
|
|
public void setSourceType(int value) { |
|
this.sourceType = value; |
|
} |
|
|
|
public int getSourceID() { |
|
return this.sourceID; |
|
} |
|
|
|
public void setSourceID(int value) { |
|
this.sourceID = value; |
|
} |
|
|
|
public boolean toggleCombat() { |
|
return this.toggleCombat; |
|
} |
|
|
|
public void setToggleCombat(boolean value) { |
|
this.toggleCombat = value; |
|
} |
|
}
|
|
|