ExOlympiadMatchResult.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.serverpackets;
  20. import java.util.List;
  21. import com.l2jserver.gameserver.model.olympiad.OlympiadInfo;
  22. /**
  23. * @author JIV
  24. */
  25. public class ExOlympiadMatchResult extends L2GameServerPacket
  26. {
  27. private final boolean _tie;
  28. private int _winTeam; // 1,2
  29. private int _loseTeam = 2;
  30. private final List<OlympiadInfo> _winnerList;
  31. private final List<OlympiadInfo> _loserList;
  32. public ExOlympiadMatchResult(boolean tie, int winTeam, List<OlympiadInfo> winnerList, List<OlympiadInfo> loserList)
  33. {
  34. _tie = tie;
  35. _winTeam = winTeam;
  36. _winnerList = winnerList;
  37. _loserList = loserList;
  38. if (_winTeam == 2)
  39. {
  40. _loseTeam = 1;
  41. }
  42. else if (_winTeam == 0)
  43. {
  44. _winTeam = 1;
  45. }
  46. }
  47. @Override
  48. protected void writeImpl()
  49. {
  50. writeC(0xFE);
  51. writeH(0xD4);
  52. writeD(0x01); // Type 0 = Match List, 1 = Match Result
  53. writeD(_tie ? 1 : 0); // 0 - win, 1 - tie
  54. writeS(_winnerList.get(0).getName());
  55. writeD(_winTeam);
  56. writeD(_winnerList.size());
  57. for (OlympiadInfo info : _winnerList)
  58. {
  59. writeS(info.getName());
  60. writeS(info.getClanName());
  61. writeD(info.getClanId());
  62. writeD(info.getClassId());
  63. writeD(info.getDamage());
  64. writeD(info.getCurrentPoints());
  65. writeD(info.getDiffPoints());
  66. }
  67. writeD(_loseTeam);
  68. writeD(_loserList.size());
  69. for (OlympiadInfo info : _loserList)
  70. {
  71. writeS(info.getName());
  72. writeS(info.getClanName());
  73. writeD(info.getClanId());
  74. writeD(info.getClassId());
  75. writeD(info.getDamage());
  76. writeD(info.getCurrentPoints());
  77. writeD(info.getDiffPoints());
  78. }
  79. }
  80. }