/** * For copyright information see the LICENSE document. */ /** * Auto-generated by PacketCodeGen, on 2012-09-28 */ package com.gamerevision.gwlpr.actions.gameserver.stoc; import com.realityshard.shardlet.utils.GenericAction; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.ByteOrder; /** * This is an automatically generated ShardletAction. * It resembles the packet template that has been * parsed from our packet templates xml. * * This can be used to apply a guild created with "P279_GuildGeneral":https://github.com/GameRevision/GWLP-R/wiki/P279_GuildGeneral * to the guild window. * * @author GWLPR Template Updater */ public final class P270_GuildWindowAction extends GenericAction { private short localID; private byte[] guildHallData; private byte memberType; public short getHeader() { return 270; } public void setLocalID(short newValue) { localID = newValue; } public void setGuildHallData(byte[] newValue) { guildHallData = newValue; } /** * The member type specified here will determine whether * the guild window will let you invite players/guests, * edit the guild announcement, etc. */ public void setMemberType(byte newValue) { memberType = newValue; } private int getSize() { int size = 21; if (guildHallData == null) { return 0; } if (guildHallData.length != 16) { return 0; } return size; } @Override public boolean serialize() { int size = getSize(); if (size == 0) { return false; } ByteBuffer buffer = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN); try { buffer.putShort(getHeader()); buffer.putShort(localID); for (int i = 0; i < 16; i++) { buffer.put(guildHallData[i]); } buffer.put(memberType); } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }