RequestExRqItemLink.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 com.l2jserver.gameserver.model.L2ItemInstance;
  17. import com.l2jserver.gameserver.model.L2Object;
  18. import com.l2jserver.gameserver.model.L2World;
  19. import com.l2jserver.gameserver.network.L2GameClient;
  20. import com.l2jserver.gameserver.network.serverpackets.ExRpItemLink;
  21. /**
  22. *
  23. * @author KenM
  24. */
  25. public class RequestExRqItemLink extends L2GameClientPacket
  26. {
  27. private int _objectId;
  28. /**
  29. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#getType()
  30. */
  31. @Override
  32. public String getType()
  33. {
  34. return "[C] DO:1E RequestExRqItemLink";
  35. }
  36. /**
  37. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#readImpl()
  38. */
  39. @Override
  40. protected void readImpl()
  41. {
  42. _objectId = readD();
  43. }
  44. /**
  45. * @see com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket#runImpl()
  46. */
  47. @Override
  48. protected void runImpl()
  49. {
  50. L2GameClient client = this.getClient();
  51. if (client != null)
  52. {
  53. L2Object object = L2World.getInstance().findObject(_objectId);
  54. if (object instanceof L2ItemInstance)
  55. {
  56. L2ItemInstance item = (L2ItemInstance)object;
  57. client.sendPacket(new ExRpItemLink(item));
  58. }
  59. }
  60. }
  61. }