/** * For copyright information see the LICENSE document. */ /** * Auto-generated by PacketCodeGen, on 2012-09-28 */ package com.gamerevision.gwlpr.actions.loginserver.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 P024_UnknownAction extends GenericAction { private int unknown1; private byte[] unknown2; private byte[] unknown3; private byte[] unknown4; public short getHeader() { return 24; } public void setUnknown1(int newValue) { unknown1 = newValue; } public void setUnknown2(byte[] newValue) { unknown2 = newValue; } public void setUnknown3(byte[] newValue) { unknown3 = newValue; } public void setUnknown4(byte[] newValue) { unknown4 = newValue; } private int getSize() { int size = 24; if (unknown2 == null) { return 0; } if (unknown2.length != 8) { return 0; } if (unknown3 == null) { return 0; } if (unknown3.length != 8) { return 0; } if (unknown4 != null) { size += 1 * unknown4.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.putInt(unknown1); for (int i = 0; i < 8; i++) { buffer.put(unknown2[i]); } for (int i = 0; i < 8; i++) { buffer.put(unknown3[i]); } short prefix_unknown4; if (unknown4 == null) { prefix_unknown4 = 0; } else { prefix_unknown4 = (short) unknown4.length; } buffer.putShort(prefix_unknown4); for (int i = 0; i < prefix_unknown4; i++) { buffer.put(unknown4[i]); } } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }