ExSendUIEvent.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.model.L2Object;
  17. public class ExSendUIEvent extends L2GameServerPacket
  18. {
  19. private static final String _S__FE_8E_EXSENDUIEVENT = "[S] FE:8E ExSendUIEvent";
  20. private L2Object _player;
  21. private boolean _isHide;
  22. private boolean _isIncrease;
  23. private int _startTime;
  24. private int _endTime;
  25. private String _text;
  26. public ExSendUIEvent(L2Object player, boolean isHide, boolean isIncrease, int startTime, int endTime, String text)
  27. {
  28. _player = player;
  29. _isHide = isHide;
  30. _isIncrease = isIncrease;
  31. _startTime = startTime;
  32. _endTime = endTime;
  33. _text = text;
  34. }
  35. @Override
  36. protected void writeImpl()
  37. {
  38. writeC(0xFE);
  39. writeH(0x8E);
  40. writeD(_player.getObjectId());
  41. writeD(_isHide ? 0x01 : 0x00); // 0: show timer, 1: hide timer
  42. writeD(0x00); // unknown
  43. writeD(0x00); // unknown
  44. writeS(_isIncrease ? "1" : "0"); // "0": count negative, "1": count positive
  45. writeS(String.valueOf(_startTime / 60)); // timer starting minute(s)
  46. writeS(String.valueOf(_startTime % 60)); // timer starting second(s)
  47. writeS(_text); // text above timer
  48. writeS(String.valueOf(_endTime / 60)); // timer length minute(s) (timer will disappear 10 seconds before it ends)
  49. writeS(String.valueOf(_endTime % 60)); // timer length second(s) (timer will disappear 10 seconds before it ends)
  50. }
  51. @Override
  52. public String getType()
  53. {
  54. return _S__FE_8E_EXSENDUIEVENT;
  55. }
  56. }