2
0

RequestConfirmTargetItem.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.L2World;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.SystemMessageId;
  20. import com.l2jserver.gameserver.network.serverpackets.ExPutItemResultForVariationMake;
  21. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  22. /**
  23. * Format:(ch) d
  24. * @author -Wooden-
  25. */
  26. public final class RequestConfirmTargetItem extends AbstractRefinePacket
  27. {
  28. private static final String _C__D0_29_REQUESTCONFIRMTARGETITEM = "[C] D0:29 RequestConfirmTargetItem";
  29. private int _itemObjId;
  30. @Override
  31. protected void readImpl()
  32. {
  33. _itemObjId = readD();
  34. }
  35. @Override
  36. protected void runImpl()
  37. {
  38. final L2PcInstance activeChar = getClient().getActiveChar();
  39. if (activeChar == null)
  40. return;
  41. final L2ItemInstance item = (L2ItemInstance)L2World.getInstance().findObject(_itemObjId);
  42. if (item == null)
  43. return;
  44. if (!isValid(activeChar, item))
  45. {
  46. // Different system message here
  47. if (item.isAugmented())
  48. {
  49. activeChar.sendPacket(new SystemMessage(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN));
  50. return;
  51. }
  52. activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM));
  53. return;
  54. }
  55. activeChar.sendPacket(new ExPutItemResultForVariationMake(_itemObjId));
  56. }
  57. /**
  58. * @see com.l2jserver.gameserver.BasePacket#getType()
  59. */
  60. @Override
  61. public String getType()
  62. {
  63. return _C__D0_29_REQUESTCONFIRMTARGETITEM;
  64. }
  65. }