ServerStatus.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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_TYPE = 0x02;
  29. public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
  30. public static final int MAX_PLAYERS = 0x04;
  31. public static final int SERVER_AGE = 0x05;
  32. // Server Status
  33. public static final int STATUS_AUTO = 0x00;
  34. public static final int STATUS_GOOD = 0x01;
  35. public static final int STATUS_NORMAL = 0x02;
  36. public static final int STATUS_FULL = 0x03;
  37. public static final int STATUS_DOWN = 0x04;
  38. public static final int STATUS_GM_ONLY = 0x05;
  39. // Server Types
  40. public static final int SERVER_NORMAL = 0x01;
  41. public static final int SERVER_RELAX = 0x02;
  42. public static final int SERVER_TEST = 0x04;
  43. public static final int SERVER_NOLABEL = 0x08;
  44. public static final int SERVER_CREATION_RESTRICTED = 0x10;
  45. public static final int SERVER_EVENT = 0x20;
  46. public static final int SERVER_FREE = 0x40;
  47. // Server Ages
  48. public static final int SERVER_AGE_ALL = 0x00;
  49. public static final int SERVER_AGE_15 = 0x0F;
  50. public static final int SERVER_AGE_18 = 0x12;
  51. public static final int ON = 0x01;
  52. public static final int OFF = 0x00;
  53. static class Attribute
  54. {
  55. public int id;
  56. public int value;
  57. Attribute(int pId, int pValue)
  58. {
  59. id = pId;
  60. value = pValue;
  61. }
  62. }
  63. public ServerStatus()
  64. {
  65. _attributes = new ArrayList<Attribute>();
  66. }
  67. public void addAttribute(int id, int value)
  68. {
  69. _attributes.add(new Attribute(id, value));
  70. }
  71. /* (non-Javadoc)
  72. * @see com.l2jserver.gameserver.gameserverpackets.GameServerBasePacket#getContent()
  73. */
  74. @Override
  75. public byte[] getContent() throws IOException
  76. {
  77. writeC(0x06);
  78. writeD(_attributes.size());
  79. for (Attribute temp: _attributes)
  80. {
  81. writeD(temp.id);
  82. writeD(temp.value);
  83. }
  84. return getBytes();
  85. }
  86. }