Jump to content
  • 0

CODE H5 FOR IL (Auction House)


Question

Posted (edited)

Hi, I need help adapting this code from H5 to IL, it's the "Auction House" system, I've adapted a lot, but I'm having this error when the item returns to its owner when the time that has been stipulated expires , in the H5 he uses the email system thing that is different from IL, could someone help me, any idea, suggestion of what I can do?
 

ReturnItemsToOwnerThread

+	private synchronized void returnItemToOwner(AuctionHouseEntranceItem item)
+	{
+		if (item.isRemoved())
+		{
+			return;
+		}
+		
+		item.setIsRemoved(true);
+		
+		final ItemContainer container = _containersByCharId.get(item.getCharId());
+		if ((container == null) || (container.getSize() == 0))
+		{
+			return;
+		}
+		
+		if (item.getItemInstance().getItemLocation() != ItemLocation.AUCTION)
+		{
+			_log.warn(getClass().getSimpleName() + ": The item " + item.getObjectId() + " that is being returned to the owner doesnt belong to the auction house");
+			return;
+		}
+		
+		ThreadPoolManager.getInstance().scheduleGeneral(new ReturnItemsToOwnerThread(container, item), 100);
+	}
+	
+	private class ReturnItemsToOwnerThread implements Runnable
+	{
+		private final ItemContainer _container;
+		private final AuctionHouseEntranceItem _item;
+		
+		public ReturnItemsToOwnerThread(ItemContainer container, AuctionHouseEntranceItem item)
+		{
+			_container = container;
+			_item = item;
+		}
+		
+		@Override
+		public void run()
+		{
+			synchronized (_entrancesById)
+			{
+				final String message = "Your item couldn't be sold on the set period, so it's now returning to you\nThanks for using our Auction House system";
+				final Message msg = new Message(_item.getCharId(), "Auction House Return", message, Message.SendBySystem.NONE);
+				final Mail attachments = msg.createAttachments();
+				final L2ItemInstance newItem = _container.transferItem("AuctionHouse", _item.getObjectId(), _item.getQuantity(), attachments, null, null);
+				if (newItem == null)
+				{
+					_log.warn(getClass().getSimpleName() + ": Error adding attachment item " + _item.getObjectId() + " for char " + _item.getCharId() + " (newitem == null)");
+					return;
+				}
+				newItem.setItemLocation(newItem.getItemLocation(), msg.getId());
+				
+				MailManager.getInstance().sendMessage(msg);
+				
+				modifyAuctionItemCountToDB(_item, -1);
+			}
+		}
+	}

 

DOWNLOAD CODE FULL FOR H5.

 

Edited by L2shaken

1 answer to this question

Recommended Posts

  • 0
Posted

The best would be to move items to personal warehouse (if not full), and if unsuccessful (via a check slots count) on inventory (if not full).

If both are full, items could be lost.

Freight warehouse could be used, but only if items aren't "bound" to a character (custom "bind on acquisition" system, or "one item per character" scenario - such as custom tutorial or unique quest).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • We will help you pass verification on any service or application you need! Fast, reliable, and secure. Pay for the first verification and get a 10% discount on the second one. Learn more: Go to
    • We will help you pass verification on any service or application you need! Fast, reliable, and secure. Pay for the first verification and get a 10% discount on the second one. Learn more: Go to
    • Long-term rental of virtual numbers — maximum control and convenience. No need to change numbers every time or worry about losing access anymore. Now you can rent virtual numbers for hours, days, or months and use them as permanent ones: — stable SMS reception from popular services — permanent access to accounts — an ideal solution for registration, verification, and repeated logins — one number — full control for the entire rental period This is the choice for those who value reliability, uninterrupted access, and predictable results. Important: even many top SMS services are unable to offer such an exclusive long-term rental option. Go to the SMS service
    • We are looking for partners and account suppliers for cooperation We are open to partnerships with reliable account suppliers for the following dating services: ➡ Tinder ➡ Badoo ➡ Bumble ➡ Hinge ➡ Happn ➡ Meetic ➡ VK Dating We are considering long-term cooperation, stable volumes, and mutually beneficial terms. If you have any offers, we will be glad to discuss the details. Contact us using the details below. ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • We are looking for partners and account suppliers for cooperation We are open to partnerships with reliable account suppliers for the following dating services: ➡ Tinder ➡ Badoo ➡ Bumble ➡ Hinge ➡ Happn ➡ Meetic ➡ VK Dating We are considering long-term cooperation, stable volumes, and mutually beneficial terms. If you have any offers, we will be glad to discuss the details. Contact us using the details below. ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock