2
0

RequestInfoItemAuction.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.instancemanager.ItemAuctionManager;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. import com.l2jserver.gameserver.model.itemauction.ItemAuction;
  19. import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
  20. import com.l2jserver.gameserver.network.serverpackets.ExItemAuctionInfoPacket;
  21. /**
  22. * @author Forsaiken
  23. */
  24. public final class RequestInfoItemAuction extends L2GameClientPacket
  25. {
  26. private int _instanceId;
  27. @Override
  28. protected final void readImpl()
  29. {
  30. _instanceId = super.readD();
  31. }
  32. @Override
  33. protected final void runImpl()
  34. {
  35. final L2PcInstance activeChar = super.getClient().getActiveChar();
  36. if (activeChar == null)
  37. return;
  38. if (!getClient().getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
  39. return;
  40. final ItemAuctionInstance instance = ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
  41. if (instance == null)
  42. return;
  43. final ItemAuction auction = instance.getCurrentAuction();
  44. if (auction == null)
  45. return;
  46. activeChar.updateLastItemAuctionRequest();
  47. activeChar.sendPacket(new ExItemAuctionInfoPacket(true, auction, instance.getNextAuction()));
  48. }
  49. @Override
  50. public final String getType()
  51. {
  52. return "[C] D0:3A RequestBidItemAuction";
  53. }
  54. }