/** * 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. * * * @author GWLPR Template Updater */ public final class P234_TitleTrackStatusAction extends GenericAction { private int titleTrackId; private int titleGroupId; private int currentPointsInTitle; private int currentTitleRankId; private int pointsNeededToReachCurrentRank; private int nextTitleRankId; private int pointsNeededToReachNextRank; private int maxRank; private int maxRankId; private char[] pointName; private char[] description; public short getHeader() { return 234; } /** * id of title track */ public void setTitleTrackId(int newValue) { titleTrackId = newValue; } /** * 0 = no group */ public void setTitleGroupId(int newValue) { titleGroupId = newValue; } public void setCurrentPointsInTitle(int newValue) { currentPointsInTitle = newValue; } public void setCurrentTitleRankId(int newValue) { currentTitleRankId = newValue; } public void setPointsNeededToReachCurrentRank(int newValue) { pointsNeededToReachCurrentRank = newValue; } public void setNextTitleRankId(int newValue) { nextTitleRankId = newValue; } public void setPointsNeededToReachNextRank(int newValue) { pointsNeededToReachNextRank = newValue; } /** * max rank as value */ public void setMaxRank(int newValue) { maxRank = newValue; } /** * id of max rank */ public void setMaxRankId(int newValue) { maxRankId = newValue; } /** * Name of points in title */ public void setPointName(char[] newValue) { pointName = newValue; } public void setDescription(char[] newValue) { description = newValue; } private int getSize() { int size = 42; if (pointName != null) { size += 2 * pointName.length; } if (description != null) { size += 2 * description.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(titleTrackId); buffer.putInt(titleGroupId); buffer.putInt(currentPointsInTitle); buffer.putInt(currentTitleRankId); buffer.putInt(pointsNeededToReachCurrentRank); buffer.putInt(nextTitleRankId); buffer.putInt(pointsNeededToReachNextRank); buffer.putInt(maxRank); buffer.putInt(maxRankId); short prefix_pointName; if (pointName == null) { prefix_pointName = 0; } else { prefix_pointName = (short) pointName.length; } buffer.putShort(prefix_pointName); for (int i = 0; i < prefix_pointName; i++) { buffer.putChar(pointName[i]); } short prefix_description; if (description == null) { prefix_description = 0; } else { prefix_description = (short) description.length; } buffer.putShort(prefix_description); for (int i = 0; i < prefix_description; i++) { buffer.putChar(description[i]); } } catch (BufferOverflowException e) { return false; } setBuffer(buffer); return true; } }