/** * 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. * * Auto generated * * @author GWLPR Template Updater */ public final class P014_UnknownAction extends GenericAction { public final class NestedUnknown3 { private int unknown4; public void setUnknown4(int newValue) { unknown4 = newValue; } private int getSize() { return 4; } public boolean serialize(ByteBuffer buffer) { try { buffer.putInt(unknown4); } catch (BufferOverflowException e) { return false; } return true; } } private short unknown1; private byte unknown2; private NestedUnknown3[] unknown3; public short getHeader() { return 14; } public void setUnknown1(short newValue) { unknown1 = newValue; } public void setUnknown2(byte newValue) { unknown2 = newValue; } public void setUnknown3(NestedUnknown3[] newValue) { unknown3 = newValue; } private int getSize() { int size = 6; if (unknown3 != null) { for (NestedUnknown3 entry : unknown3) { int nextSize = entry.getSize(); if (nextSize == 0) { return 0; } size += entry.getSize(); } } 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(unknown1); buffer.put(unknown2); byte prefix_unknown3; if (unknown3 == null) { prefix_unknown3 = 0; } else { prefix_unknown3 = (byte) unknown3.length; } buffer.put(prefix_unknown3); for (int i = 0; i < prefix_unknown3; i++) { if (!unknown3[i].serialize(buffer)) { return false; } } } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }