RequestExCubeGameReadyAnswer.java 2.0 KB

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