radjabov

Untitled

Jan 6th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package ru.catssoftware.gameserver.network.clientpackets;
  2.  
  3. import ru.catssoftware.gameserver.model.L2ShortCut;
  4. import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
  5. import ru.catssoftware.gameserver.network.serverpackets.ShortCutRegister;
  6.  
  7. public class RequestShortCutReg extends L2GameClientPacket
  8. {
  9. private static final String _C__33_REQUESTSHORTCUTREG = "[C] 33 RequestShortCutReg";
  10. @SuppressWarnings("unused")
  11. private int _type, _id, _slot, _page, _lvl, _characterType;
  12.  
  13. @Override
  14. protected void readImpl()
  15. {
  16. _type = readD();
  17. int slot = readD();
  18. _id = readD();
  19. _characterType = readD();
  20.  
  21. _slot = slot % 12;
  22. _page = slot / 12;
  23. }
  24.  
  25. @Override
  26. protected void runImpl()
  27. {
  28. L2PcInstance activeChar = getClient().getActiveChar();
  29. if (activeChar == null)
  30. return;
  31.  
  32. switch (_type)
  33. {
  34. case 0x01: // item
  35. case 0x03: // action
  36. case 0x04: // macro
  37. case 0x05: // recipe
  38. {
  39. L2ShortCut sc = new L2ShortCut(_slot, _page, _type, _id, -1, _characterType);
  40. sendPacket(new ShortCutRegister(sc));
  41. activeChar.registerShortCut(sc);
  42. break;
  43. }
  44. case 0x02: // skill
  45. {
  46. int _lvl = activeChar.getSkillLevel(_id);
  47. if(_lvl > 0)
  48. {
  49. L2ShortCut sc = new L2ShortCut(_slot, _page, _type, _id, _lvl, _characterType);
  50. sendPacket(new ShortCutRegister(sc));
  51. activeChar.registerShortCut(sc);
  52. }
  53. break;
  54. }
  55. }
  56. }
  57.  
  58. @Override
  59. public String getType()
  60. {
  61. return _C__33_REQUESTSHORTCUTREG;
  62. }
  63. }
Add Comment
Please, Sign In to add comment