radjabov

Untitled

Jan 6th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1.  
  2. package ru.catssoftware.gameserver.network.serverpackets;
  3.  
  4. import ru.catssoftware.gameserver.model.L2ShortCut;
  5. import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
  6.  
  7. /**
  8. *
  9. * ShortCutInit
  10. * format d *(1dddd)/(2ddddd)/(3dddd)
  11. *
  12. * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/03/27 15:29:39 $
  13. */
  14. public class ShortCutInit extends L2GameServerPacket {
  15.  
  16. private static final String _S__57_SHORTCUTINIT = "[S] 45 ShortCutInit";
  17. private L2ShortCut[] _shortCuts;
  18. private L2PcInstance _activeChar;
  19.  
  20. public ShortCutInit(L2PcInstance activeChar) {
  21. _activeChar = activeChar;
  22.  
  23. if (_activeChar == null) {
  24. return;
  25. }
  26.  
  27. _shortCuts = _activeChar.getAllShortCuts();
  28. }
  29.  
  30. @Override
  31. protected final void writeImpl() {
  32. writeC(0x45);
  33. writeD(_shortCuts.length);
  34.  
  35. for (L2ShortCut sc : _shortCuts) {
  36. writeD(sc.getType());
  37. writeD(sc.getSlot() + sc.getPage() * 12);
  38.  
  39. switch (sc.getType()) {
  40. case L2ShortCut.TYPE_ITEM: //1
  41. writeD(sc.getId());
  42. writeD(0x01);
  43. writeD(-1);
  44. writeD(0x00);
  45. writeD(0x00);
  46. writeH(0x00);
  47. writeH(0x00);
  48. break;
  49. case L2ShortCut.TYPE_SKILL: //2
  50. writeD(sc.getId());
  51. writeD(sc.getLevel());
  52. writeC(0x01); // C5
  53. writeD(0x01); // C6
  54. break;
  55. case L2ShortCut.TYPE_ACTION: //3
  56. writeD(sc.getId());
  57. writeD(0x01); // C6
  58. break;
  59. case L2ShortCut.TYPE_MACRO: //4
  60. writeD(sc.getId());
  61. writeD(0x01); // C6
  62. break;
  63. case L2ShortCut.TYPE_RECIPE: //5
  64. writeD(sc.getId());
  65. writeD(0x01); // C6
  66. break;
  67. default: {
  68. writeD(sc.getId());
  69. writeD(0x01); // C6
  70. }
  71. }
  72. }
  73. }
  74.  
  75. @Override
  76. public String getType() {
  77. return _S__57_SHORTCUTINIT;
  78. }
  79. }
Add Comment
Please, Sign In to add comment