Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2, or (at your option)
  5. * any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. * 02111-1307, USA.
  16. *
  17. * http://www.gnu.org/copyleft/gpl.html
  18. */
  19. package com.equal.gameserver.network.serverpackets;
  20.  
  21. import java.util.ArrayList;
  22. import java.util.Vector;
  23.  
  24. import com.equal.gameserver.model.L2Object;
  25.  
  26. /**
  27. *
  28. * 01 // Packet Identifier <BR>
  29. * c6 37 50 40 // ObjectId <BR><BR>
  30. *
  31. * 01 00 // Number of Attribute Trame of the Packet <BR><BR>
  32. *
  33. * c6 37 50 40 // Attribute Identifier : 01-Level, 02-Experience, 03-STR, 04-DEX, 05-CON, 06-INT, 07-WIT, 08-MEN, 09-Current HP, 0a, Max HP...<BR>
  34. * cd 09 00 00 // Attribute Value <BR>
  35. *
  36. * format d d(dd)
  37. *
  38. * @version $Revision: 1.3.2.1.2.5 $ $Date: 2005/03/27 15:29:39 $
  39. */
  40. public class StatusUpdate extends L2GameServerPacket
  41. {
  42. private static final String _S__1A_STATUSUPDATE = "[S] 0e StatusUpdate";
  43. public static final int LEVEL = 0x01;
  44. public static final int EXP = 0x02;
  45. public static final int STR = 0x03;
  46. public static final int DEX = 0x04;
  47. public static final int CON = 0x05;
  48. public static final int INT = 0x06;
  49. public static final int WIT = 0x07;
  50. public static final int MEN = 0x08;
  51.  
  52. public static final int CUR_HP = 0x09;
  53. public static final int MAX_HP = 0x0a;
  54. public static final int CUR_MP = 0x0b;
  55. public static final int MAX_MP = 0x0c;
  56.  
  57. public static final int SP = 0x0d;
  58. public static final int CUR_LOAD = 0x0e;
  59. public static final int MAX_LOAD = 0x0f;
  60.  
  61. public static final int P_ATK = 0x11;
  62. public static final int ATK_SPD = 0x12;
  63. public static final int P_DEF = 0x13;
  64. public static final int EVASION = 0x14;
  65. public static final int ACCURACY = 0x15;
  66. public static final int CRITICAL = 0x16;
  67. public static final int M_ATK = 0x17;
  68. public static final int CAST_SPD = 0x18;
  69. public static final int M_DEF = 0x19;
  70. public static final int PVP_FLAG = 0x1a;
  71. public static final int KARMA = 0x1b;
  72.  
  73. public static final int CUR_CP = 0x21;
  74. public static final int MAX_CP = 0x22;
  75.  
  76. private int _objectId;
  77. private Vector<Attribute> _attributes;
  78.  
  79. public StatusUpdate(L2Object object)
  80. {
  81. _objectId = object.getObjectId();
  82. }
  83.  
  84. class Attribute
  85. {
  86. /** id values
  87. * 09 - current health
  88. * 0a - max health
  89. * 0b - current mana
  90. * 0c - max mana
  91. *
  92. */
  93. public int id;
  94. public int value;
  95.  
  96. Attribute(int pId, int pValue)
  97. {
  98. id = pId;
  99. value = pValue;
  100. }
  101. }
  102.  
  103. public StatusUpdate(int objectId)
  104. {
  105. _attributes = new Vector<Attribute>();
  106. _objectId = objectId;
  107. }
  108.  
  109. public void addAttribute(int id, int level)
  110. {
  111. _attributes.add(new Attribute(id, level));
  112. }
  113.  
  114. @Override
  115. protected final void writeImpl()
  116. {
  117. writeC(0x0e);
  118. writeD(_objectId);
  119. writeD(_attributes.size());
  120.  
  121. for (int i = 0; i < _attributes.size(); i++)
  122. {
  123. Attribute temp = _attributes.get(i);
  124.  
  125. writeD(temp.id);
  126. writeD(temp.value);
  127. }
  128. }
  129.  
  130. /* (non-Javadoc)
  131. * @see com.equal.gameserver.serverpackets.ServerBasePacket#getType()
  132. */
  133. @Override
  134. public String getType()
  135. {
  136. return _S__1A_STATUSUPDATE;
  137. }
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement