/** * 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 display a guild in the guild window * and/or apply a cape to player agent(s). * * @author GWLPR Template Updater */ public final class P279_GuildGeneralAction extends GenericAction { private short localID; private byte[] guildHallData; private char[] guildName; private char[] guildTag; private byte features; private byte territory; private byte capeBackgroundColor; private byte capePatternColor; private byte capeEmblemColor; private byte capeShape; private byte capePattern; private short capeEmblem; private byte capeTrim; private byte allegiance; private int allianceFaction; private int qualifierPoints; private int rating; private int rank; private byte data19; public short getHeader() { return 279; } public void setLocalID(short newValue) { localID = newValue; } /** * this is sent to the server when trying to travel to * the guildhall */ 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; } public void setTerritory(byte newValue) { territory = newValue; } /** * 1-255 */ public void setCapeBackgroundColor(byte newValue) { capeBackgroundColor = newValue; } public void setCapePatternColor(byte newValue) { capePatternColor = newValue; } public void setCapeEmblemColor(byte newValue) { capeEmblemColor = newValue; } public void setCapeShape(byte newValue) { capeShape = newValue; } public void setCapePattern(byte newValue) { capePattern = 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 setQualifierPoints(int newValue) { qualifierPoints = newValue; } public void setRating(int newValue) { rating = newValue; } public void setRank(int newValue) { rank = newValue; } public void setData19(byte newValue) { data19 = newValue; } private int getSize() { int size = 52; 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(territory); buffer.put(capeBackgroundColor); buffer.put(capePatternColor); buffer.put(capeEmblemColor); buffer.put(capeShape); buffer.put(capePattern); buffer.putShort(capeEmblem); buffer.put(capeTrim); buffer.put(allegiance); buffer.putInt(allianceFaction); buffer.putInt(qualifierPoints); buffer.putInt(rating); buffer.putInt(rank); buffer.put(data19); } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }