forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -23,84 +23,83 @@ import java.util.ArrayList;
|
||||
|
||||
public class SendGuildEntryMsg extends ClientNetMsg {
|
||||
|
||||
private PlayerCharacter pc;
|
||||
private PlayerCharacter pc;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public SendGuildEntryMsg(PlayerCharacter pc) {
|
||||
super(Protocol.SENDGUILDENTRY);
|
||||
this.pc = pc;
|
||||
}
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public SendGuildEntryMsg(PlayerCharacter pc) {
|
||||
super(Protocol.SENDGUILDENTRY);
|
||||
this.pc = 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 SendGuildEntryMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.SENDGUILDENTRY, 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 SendGuildEntryMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.SENDGUILDENTRY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
ArrayList<Guild>subsAndSovs = new ArrayList<>();
|
||||
|
||||
Guild nation = pc.getGuild().getNation();
|
||||
if (pc.getGuild() != nation)
|
||||
subsAndSovs.add(nation);
|
||||
subsAndSovs.addAll(pc.getGuild().getSubGuildList());
|
||||
|
||||
|
||||
writer.putInt(1);
|
||||
//GuildState
|
||||
//Petitioner = 2, Sworn = 4 , Nation = 5, protectorate = 6, city-State = 7(nation), province = 8,
|
||||
|
||||
writer.putInt(subsAndSovs.size());
|
||||
writer.putInt(1);
|
||||
if (subsAndSovs.size() > 0){
|
||||
|
||||
for (Guild guild : subsAndSovs){
|
||||
int state = guild.getGuildState().getStateID();
|
||||
|
||||
writer.putInt(guild.getObjectType().ordinal());
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
|
||||
writer.putString(guild.getName());
|
||||
|
||||
//TODO set Alliance date
|
||||
writer.putShort((short)1);
|
||||
writer.putInt(0);
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
|
||||
writer.putInt(state);
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
if (guild == nation)
|
||||
writer.putInt(2); // Break Fealty
|
||||
else
|
||||
writer.putInt(1); // Dismiss, Swear In.
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
}
|
||||
ArrayList<Guild> subsAndSovs = new ArrayList<>();
|
||||
|
||||
public PlayerCharacter getPc() {
|
||||
return pc;
|
||||
}
|
||||
Guild nation = pc.getGuild().getNation();
|
||||
if (pc.getGuild() != nation)
|
||||
subsAndSovs.add(nation);
|
||||
subsAndSovs.addAll(pc.getGuild().getSubGuildList());
|
||||
|
||||
public void setPc(PlayerCharacter pc) {
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
writer.putInt(1);
|
||||
//GuildState
|
||||
//Petitioner = 2, Sworn = 4 , Nation = 5, protectorate = 6, city-State = 7(nation), province = 8,
|
||||
|
||||
writer.putInt(subsAndSovs.size());
|
||||
writer.putInt(1);
|
||||
if (subsAndSovs.size() > 0) {
|
||||
|
||||
for (Guild guild : subsAndSovs) {
|
||||
int state = guild.getGuildState().getStateID();
|
||||
|
||||
writer.putInt(guild.getObjectType().ordinal());
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
|
||||
writer.putString(guild.getName());
|
||||
|
||||
//TODO set Alliance date
|
||||
writer.putShort((short) 1);
|
||||
writer.putInt(0);
|
||||
writer.putShort((short) 0);
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.putInt(state);
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(), writer);
|
||||
if (guild == nation)
|
||||
writer.putInt(2); // Break Fealty
|
||||
else
|
||||
writer.putInt(1); // Dismiss, Swear In.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
}
|
||||
|
||||
public PlayerCharacter getPc() {
|
||||
return pc;
|
||||
}
|
||||
|
||||
public void setPc(PlayerCharacter pc) {
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user