2
0

ServerStatus.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. import com.l2jserver.util.network.BaseSendablePacket;
  19. /**
  20. * @author -Wooden-
  21. *
  22. */
  23. public class ServerStatus extends BaseSendablePacket
  24. {
  25. private ArrayList<Attribute> _attributes;
  26. public static final String[] STATUS_STRING = {"Auto", "Good", "Normal", "Full", "Down", "Gm Only"};
  27. public static final int SERVER_LIST_STATUS = 0x01;
  28. public static final int SERVER_LIST_CLOCK = 0x02;
  29. public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
  30. public static final int MAX_PLAYERS = 0x04;
  31. public static final int TEST_SERVER = 0x05;
  32. public static final int STATUS_AUTO = 0x00;
  33. public static final int STATUS_GOOD = 0x01;
  34. public static final int STATUS_NORMAL = 0x02;
  35. public static final int STATUS_FULL = 0x03;
  36. public static final int STATUS_DOWN = 0x04;
  37. public static final int STATUS_GM_ONLY = 0x05;
  38. public static final int ON = 0x01;
  39. public static final int OFF = 0x00;
  40. class Attribute
  41. {
  42. public int id;
  43. public int value;
  44. Attribute(int pId, int pValue)
  45. {
  46. id = pId;
  47. value = pValue;
  48. }
  49. }
  50. public ServerStatus()
  51. {
  52. _attributes = new ArrayList<Attribute>();
  53. }
  54. public void addAttribute(int id, int value)
  55. {
  56. _attributes.add(new Attribute(id, value));
  57. }
  58. /* (non-Javadoc)
  59. * @see com.l2jserver.gameserver.gameserverpackets.GameServerBasePacket#getContent()
  60. */
  61. @Override
  62. public byte[] getContent() throws IOException
  63. {
  64. writeC(0x06);
  65. writeD(_attributes.size());
  66. for (Attribute temp: _attributes)
  67. {
  68. writeD(temp.id);
  69. writeD(temp.value);
  70. }
  71. return getBytes();
  72. }
  73. }