SSQInfo.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.serverpackets;
  16. import com.l2jserver.gameserver.SevenSigns;
  17. /**
  18. * Changes the sky color depending on the outcome
  19. * of the Seven Signs competition.
  20. *
  21. * packet type id 0xf8
  22. * format: c h
  23. *
  24. * @author Tempy
  25. */
  26. public class SSQInfo extends L2GameServerPacket
  27. {
  28. private static final String _S__F8_SSQINFO = "[S] 73 SSQInfo";
  29. private static int _state = 0;
  30. public SSQInfo()
  31. {
  32. int compWinner = SevenSigns.getInstance().getCabalHighestScore();
  33. if (SevenSigns.getInstance().isSealValidationPeriod())
  34. if (compWinner == SevenSigns.CABAL_DAWN)
  35. _state = 2;
  36. else if (compWinner == SevenSigns.CABAL_DUSK)
  37. _state = 1;
  38. }
  39. public SSQInfo(int state)
  40. {
  41. _state = state;
  42. }
  43. @Override
  44. protected final void writeImpl()
  45. {
  46. writeC(0x73);
  47. if (_state == 2) // Dawn Sky
  48. {
  49. writeH(258);
  50. }
  51. else if (_state == 1) // Dusk Sky
  52. {
  53. writeH(257);
  54. }
  55. else
  56. {
  57. writeH(256);
  58. }
  59. }
  60. /* (non-Javadoc)
  61. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  62. */
  63. @Override
  64. public String getType()
  65. {
  66. return _S__F8_SSQINFO;
  67. }
  68. }