/** * 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 setup a guild to be displayed in * the alliance tab of the guild window. * * @author GWLPR Template Updater */ public final class P278_GuildAllyGeneralAction extends GenericAction { private short localID; private byte[] guildHallData; private char[] guildName; private char[] guildTag; private byte features; private byte capeBackgroundColor; private byte capeDetailColor; private byte capeEmblemColor; private byte capeShape; private byte capeDetail; private short capeEmblem; private byte capeTrim; private byte allegiance; private int allianceFaction; private byte data15; public short getHeader() { return 278; } public void setLocalID(short newValue) { localID = newValue; } public void setGuildHallData(byte[] newValue) { guildHallData = newValue; } public void setGuildName(char[] newValue) { guildName = newValue; } public void setGuildTag(char[] newValue) { guildTag = newValue; } public void setFeatures(byte newValue) { features = newValue; } /** * 1-255 */ public void setCapeBackgroundColor(byte newValue) { capeBackgroundColor = newValue; } public void setCapeDetailColor(byte newValue) { capeDetailColor = newValue; } public void setCapeEmblemColor(byte newValue) { capeEmblemColor = newValue; } public void setCapeShape(byte newValue) { capeShape = newValue; } public void setCapeDetail(byte newValue) { capeDetail = newValue; } public void setCapeEmblem(short newValue) { capeEmblem = newValue; } public void setCapeTrim(byte newValue) { capeTrim = newValue; } public void setAllegiance(byte newValue) { allegiance = newValue; } public void setAllianceFaction(int newValue) { allianceFaction = newValue; } public void setData15(byte newValue) { data15 = newValue; } private int getSize() { int size = 39; if (guildHallData == null) { return 0; } if (guildHallData.length != 16) { return 0; } if (guildName != null) { size += 2 * guildName.length; } if (guildTag != null) { size += 2 * guildTag.length; } 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]); } short prefix_guildName; if (guildName == null) { prefix_guildName = 0; } else { prefix_guildName = (short) guildName.length; } buffer.putShort(prefix_guildName); for (int i = 0; i < prefix_guildName; i++) { buffer.putChar(guildName[i]); } short prefix_guildTag; if (guildTag == null) { prefix_guildTag = 0; } else { prefix_guildTag = (short) guildTag.length; } buffer.putShort(prefix_guildTag); for (int i = 0; i < prefix_guildTag; i++) { buffer.putChar(guildTag[i]); } buffer.put(features); buffer.put(capeBackgroundColor); buffer.put(capeDetailColor); buffer.put(capeEmblemColor); buffer.put(capeShape); buffer.put(capeDetail); buffer.putShort(capeEmblem); buffer.put(capeTrim); buffer.put(allegiance); buffer.putInt(allianceFaction); buffer.put(data15); } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }