RequestExCubeGameReadyAnswer.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.clientpackets;
  16. import java.util.logging.Logger;
  17. import com.l2jserver.gameserver.instancemanager.HandysBlockCheckerManager;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. /**
  20. * @author mrTJO
  21. * Format: chddd
  22. *
  23. * d: Arena
  24. * d: Answer
  25. */
  26. public final class RequestExCubeGameReadyAnswer extends L2GameClientPacket
  27. {
  28. private static final String _C__D0_5C_REQUESTEXCUBEGAMEREADYANSWER = "[C] D0:5C RequestExCubeGameReadyAnswer";
  29. private static Logger _log = Logger.getLogger(RequestExCubeGameReadyAnswer.class.getName());
  30. int _arena;
  31. int _answer;
  32. @Override
  33. protected void readImpl()
  34. {
  35. // client sends -1,0,1,2 for arena parameter
  36. _arena = readD() + 1;
  37. // client sends 1 if clicked confirm on not clicked, 0 if clicked cancel
  38. _answer = readD();
  39. }
  40. @Override
  41. public void runImpl()
  42. {
  43. L2PcInstance player = getClient().getActiveChar();
  44. if(player == null) return;
  45. switch (_answer)
  46. {
  47. case 0:
  48. // Cancel - Answer No
  49. break;
  50. case 1:
  51. // OK or Time Over
  52. HandysBlockCheckerManager.getInstance().increaseArenaVotes(_arena);
  53. break;
  54. default:
  55. _log.warning("Unknown Cube Game Answer ID: "+_answer);
  56. break;
  57. }
  58. }
  59. @Override
  60. public String getType()
  61. {
  62. return _C__D0_5C_REQUESTEXCUBEGAMEREADYANSWER;
  63. }
  64. }