ServerStatus.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.network.gameserverpackets;
  20. import java.util.ArrayList;
  21. import com.l2jserver.util.network.BaseSendablePacket;
  22. /**
  23. * @author -Wooden-
  24. */
  25. public class ServerStatus extends BaseSendablePacket
  26. {
  27. private final ArrayList<Attribute> _attributes;
  28. public static final String[] STATUS_STRING =
  29. {
  30. "Auto",
  31. "Good",
  32. "Normal",
  33. "Full",
  34. "Down",
  35. "Gm Only"
  36. };
  37. public static final int SERVER_LIST_STATUS = 0x01;
  38. public static final int SERVER_TYPE = 0x02;
  39. public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
  40. public static final int MAX_PLAYERS = 0x04;
  41. public static final int SERVER_AGE = 0x05;
  42. // Server Status
  43. public static final int STATUS_AUTO = 0x00;
  44. public static final int STATUS_GOOD = 0x01;
  45. public static final int STATUS_NORMAL = 0x02;
  46. public static final int STATUS_FULL = 0x03;
  47. public static final int STATUS_DOWN = 0x04;
  48. public static final int STATUS_GM_ONLY = 0x05;
  49. // Server Types
  50. public static final int SERVER_NORMAL = 0x01;
  51. public static final int SERVER_RELAX = 0x02;
  52. public static final int SERVER_TEST = 0x04;
  53. public static final int SERVER_NOLABEL = 0x08;
  54. public static final int SERVER_CREATION_RESTRICTED = 0x10;
  55. public static final int SERVER_EVENT = 0x20;
  56. public static final int SERVER_FREE = 0x40;
  57. // Server Ages
  58. public static final int SERVER_AGE_ALL = 0x00;
  59. public static final int SERVER_AGE_15 = 0x0F;
  60. public static final int SERVER_AGE_18 = 0x12;
  61. public static final int ON = 0x01;
  62. public static final int OFF = 0x00;
  63. static class Attribute
  64. {
  65. public int id;
  66. public int value;
  67. Attribute(int pId, int pValue)
  68. {
  69. id = pId;
  70. value = pValue;
  71. }
  72. }
  73. public ServerStatus()
  74. {
  75. _attributes = new ArrayList<>();
  76. }
  77. public void addAttribute(int id, int value)
  78. {
  79. _attributes.add(new Attribute(id, value));
  80. }
  81. @Override
  82. public byte[] getContent()
  83. {
  84. writeC(0x06);
  85. writeD(_attributes.size());
  86. for (Attribute temp : _attributes)
  87. {
  88. writeD(temp.id);
  89. writeD(temp.value);
  90. }
  91. return getBytes();
  92. }
  93. }