Project cleanup pre merge.
This commit is contained in:
@@ -24,100 +24,98 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
public class SendOwnPlayerMsg extends ClientNetMsg {
|
||||
|
||||
private PlayerCharacter ch;
|
||||
private PlayerCharacter ch;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param s
|
||||
* Session from which the PlayerCharacter is obtained
|
||||
*/
|
||||
public SendOwnPlayerMsg(Session s) {
|
||||
super(Protocol.PLAYERDATA);
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param s Session from which the PlayerCharacter is obtained
|
||||
*/
|
||||
public SendOwnPlayerMsg(Session s) {
|
||||
super(Protocol.PLAYERDATA);
|
||||
|
||||
// Get all the character records for this account
|
||||
ch = s.getPlayerCharacter();
|
||||
}
|
||||
// Get all the character records for this account
|
||||
ch = s.getPlayerCharacter();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param pc
|
||||
* Playercharacter
|
||||
*/
|
||||
public SendOwnPlayerMsg(PlayerCharacter pc) {
|
||||
super(Protocol.PLAYERDATA);
|
||||
this.ch = pc;
|
||||
}
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param pc Playercharacter
|
||||
*/
|
||||
public SendOwnPlayerMsg(PlayerCharacter pc) {
|
||||
super(Protocol.PLAYERDATA);
|
||||
this.ch = pc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 SendOwnPlayerMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PLAYERDATA, origin, reader);
|
||||
}
|
||||
/**
|
||||
* 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 SendOwnPlayerMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PLAYERDATA, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (17); // 2^17 == 131,072
|
||||
}
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (17); // 2^17 == 131,072
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
Regions region = this.ch.region;
|
||||
//region loading seralization. serialzes building level and floor. -1 = not in building.
|
||||
if (region == null) {
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
} else {
|
||||
Building regionBuilding = Regions.GetBuildingForRegion(region);
|
||||
if (regionBuilding == null) {
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
} else {
|
||||
writer.putInt(region.getLevel());
|
||||
writer.putInt(region.getRoom());
|
||||
}
|
||||
}
|
||||
writer.putVector3f(ch.getLoc());
|
||||
try {
|
||||
PlayerCharacter.serializeForClientMsgFull(this.ch,writer);
|
||||
} catch (SerializationException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
Regions region = this.ch.region;
|
||||
//region loading seralization. serialzes building level and floor. -1 = not in building.
|
||||
if (region == null) {
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
} else {
|
||||
Building regionBuilding = Regions.GetBuildingForRegion(region);
|
||||
if (regionBuilding == null) {
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
} else {
|
||||
writer.putInt(region.getLevel());
|
||||
writer.putInt(region.getRoom());
|
||||
}
|
||||
}
|
||||
writer.putVector3f(ch.getLoc());
|
||||
try {
|
||||
PlayerCharacter.serializeForClientMsgFull(this.ch, writer);
|
||||
} catch (SerializationException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
int unknown1 = reader.getInt();
|
||||
int unknown2 = reader.getInt();
|
||||
int unknown1 = reader.getInt();
|
||||
int unknown2 = reader.getInt();
|
||||
|
||||
int unknown3 = reader.getInt();
|
||||
int unknown4 = reader.getInt();
|
||||
int unknown3 = reader.getInt();
|
||||
int unknown4 = reader.getInt();
|
||||
|
||||
int unknown5 = reader.getInt();
|
||||
int unknown6 = reader.getInt();
|
||||
int unknown7 = reader.getInt();
|
||||
int unknown5 = reader.getInt();
|
||||
int unknown6 = reader.getInt();
|
||||
int unknown7 = reader.getInt();
|
||||
|
||||
// TODO finish deserialization implementation.
|
||||
}
|
||||
// TODO finish deserialization implementation.
|
||||
}
|
||||
|
||||
public PlayerCharacter getChar() {
|
||||
return this.ch;
|
||||
}
|
||||
public PlayerCharacter getChar() {
|
||||
return this.ch;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user