ServerStatus.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.network.gameserverpackets;
  16. import java.io.IOException;
  17. import java.util.ArrayList;
  18. /**
  19. * @author -Wooden-
  20. *
  21. */
  22. public class ServerStatus extends GameServerBasePacket
  23. {
  24. private ArrayList<Attribute> _attributes;
  25. public static final String[] STATUS_STRING = {"Auto", "Good", "Normal", "Full", "Down", "Gm Only"};
  26. public static final int SERVER_LIST_STATUS = 0x01;
  27. public static final int SERVER_LIST_CLOCK = 0x02;
  28. public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
  29. public static final int MAX_PLAYERS = 0x04;
  30. public static final int TEST_SERVER = 0x05;
  31. public static final int STATUS_AUTO = 0x00;
  32. public static final int STATUS_GOOD = 0x01;
  33. public static final int STATUS_NORMAL = 0x02;
  34. public static final int STATUS_FULL = 0x03;
  35. public static final int STATUS_DOWN = 0x04;
  36. public static final int STATUS_GM_ONLY = 0x05;
  37. public static final int ON = 0x01;
  38. public static final int OFF = 0x00;
  39. class Attribute
  40. {
  41. public int id;
  42. public int value;
  43. Attribute(int pId, int pValue)
  44. {
  45. id = pId;
  46. value = pValue;
  47. }
  48. }
  49. public ServerStatus()
  50. {
  51. _attributes = new ArrayList<Attribute>();
  52. }
  53. public void addAttribute(int id, int value)
  54. {
  55. _attributes.add(new Attribute(id, value));
  56. }
  57. /* (non-Javadoc)
  58. * @see com.l2jserver.gameserver.gameserverpackets.GameServerBasePacket#getContent()
  59. */
  60. @Override
  61. public byte[] getContent() throws IOException
  62. {
  63. writeC(0x06);
  64. writeD(_attributes.size());
  65. for (Attribute temp: _attributes)
  66. {
  67. writeD(temp.id);
  68. writeD(temp.value);
  69. }
  70. return getBytes();
  71. }
  72. }