2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// 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 ;
2024-04-06 15:30:35 -04:00
import engine.net.Protocol ;
2022-04-30 09:41:17 -04:00
public class RandomMsg extends ClientNetMsg {
2023-07-15 09:23:48 -04:00
private int max ;
private int roll ;
private int sourceType ;
private int sourceID ;
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
/**
* This is the general purpose constructor.
*/
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public RandomMsg () {
super ( Protocol . RANDOM );
}
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 RandomMsg ( AbstractConnection origin , ByteBufferReader reader ) {
super ( Protocol . RANDOM , origin , reader );
}
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 ) {
writer . putInt ( this . max );
writer . putInt ( this . roll );
writer . putInt ( this . sourceType );
writer . putInt ( this . sourceID );
}
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 ) {
this . max = reader . getInt ();
this . roll = reader . getInt ();
this . sourceType = reader . getInt ();
this . sourceID = reader . getInt ();
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getMax () {
return this . max ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setMax ( int value ) {
this . max = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getRoll () {
return this . roll ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setRoll ( int value ) {
this . roll = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getSourceType () {
return this . sourceType ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setSourceType ( int value ) {
this . sourceType = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getSourceID () {
return this . sourceID ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setSourceID ( int value ) {
this . sourceID = value ;
}
2022-04-30 09:41:17 -04:00
}