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.net.AbstractConnection ;
import engine.net.ByteBufferReader ;
import engine.net.ByteBufferWriter ;
import engine.net.client.Protocol ;
import engine.objects.Zone ;
public class CityZoneMsg extends ClientNetMsg {
2023-07-15 09:23:48 -04:00
private int messageType ; //1 or 2
private int zoneType ;
private int zoneID ;
private float locX ;
private float locY ;
private float locZ ;
private String name ;
private float radiusX ;
private float radiusZ ;
private int unknown01 = 0 ;
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 CityZoneMsg ( int messageType , float locX , float locY , float locZ , String name , Zone zone , float radiusX , float radiusZ ) {
super ( Protocol . CITYZONE );
this . messageType = messageType ; //only 1 or 2 used on message type
this . zoneType = GameObjectType . Zone . ordinal ();
this . zoneID = zone . getObjectUUID ();
this . locX = locX ;
this . locY = locY ;
this . locZ = locZ ;
this . name = name ;
this . radiusX = radiusX ;
this . radiusZ = radiusZ ;
this . unknown01 = 0 ;
}
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 CityZoneMsg ( AbstractConnection origin , ByteBufferReader reader ) {
super ( Protocol . CITYZONE , 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 ) {
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
writer . putInt ( this . messageType );
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
//MSGTYPE 3 SERIALIZATION
if ( this . messageType == 3 ) {
writer . putInt ( 1 );
writer . putInt ( this . zoneType );
writer . putInt ( this . zoneID );
writer . putString ( "RuinedCity" );
writer . putString ( "Ruined" );
writer . putFloat ( this . locX );
writer . putFloat ( this . locY );
writer . putFloat ( this . locZ );
writer . putInt ( 0 );
return ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
//END SERIALIZIONTYPE 3
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
// writer.putInt(this.messageType);
if ( this . messageType == 1 ) {
writer . putInt ( this . zoneType );
writer . putInt ( this . zoneID );
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
writer . putFloat ( this . locX );
writer . putFloat ( this . locY );
writer . putFloat ( this . locZ );
writer . putString ( this . name );
if ( this . messageType == 1 ) {
writer . putFloat ( this . radiusX );
writer . putFloat ( this . radiusZ );
}
writer . putInt ( this . unknown01 );
}
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.locX = reader.getFloat();
// this.locY = reader.getFloat();
// this.locZ = reader.getFloat();
// this.name = reader.getString();
// this.unknown01 = reader.getInt();
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public float getLocX () {
return this . locX ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setLocX ( float value ) {
this . locX = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public float getLocY () {
return this . locY ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setLocY ( float value ) {
this . locY = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public float getLocZ () {
return this . locZ ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setLocZ ( float value ) {
this . locZ = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public String getName () {
return this . name ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setName ( String value ) {
this . name = value ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public int getUnknown01 () {
return this . unknown01 ;
}
2022-04-30 09:41:17 -04:00
2023-07-15 09:23:48 -04:00
public void setUnknown01 ( int value ) {
this . unknown01 = value ;
}
2022-04-30 09:41:17 -04:00
}