Jump to content
  • 0

RequestSellItem.java


Question

Posted

how do i get a player to sell anything in npc for 1 adena? 

 

7NPq0L3.jpg

 

 

 

Note: There is the option to go item by item and set the price to 1. but that would bring me a lot of work, in the code there is an easier way?

 

 

		
		long totalPrice = 0;
		// Proceed the sell
		for (UniqueItemHolder i : _items)
		{
			L2ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
			if ((item == null) || (!item.isSellable()))
			{
				continue;
			}
			
			long price = item.getReferencePrice() / 100;
			totalPrice += price * i.getCount();
			if (((MAX_ADENA / i.getCount()) < price) || (totalPrice > MAX_ADENA))
			{
				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
				return;
			}
			
			if (Config.ALLOW_REFUND)
			{
				item = player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant);
			}
			else
			{
				item = player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant);
			}
		}
		player.addAdena("Sell", totalPrice, merchant, false);
		
		// Update current load as well
		StatusUpdate su = player.makeStatusUpdate(StatusUpdate.CUR_LOAD);
		player.sendPacket(su);
		player.sendPacket(new ExBuySellList(player, taxRate, true));
	}
	

 

Recommended Posts

  • 0
Posted

i think need one more file change for show price 0 adena i dont have your project for check i think you can share this and you find all point use price adena * item.getReferencePrice() /  2 *

  • 0
Posted
42 minutes ago, filimon said:

long price = item.getReferencePrice() / 1;

this he take the price of item and he make it / 1 so if your weapon cost 1.000.000 you sell it 500.000

  • 0
Posted (edited)

Go to RequestSellitem and make that

 

   
            long price = item.getReferencePrice() / 2;
            totalPrice += price * 0;
            if (((MAX_ADENA / i.getCount()) < price) || (totalPrice > MAX_ADENA))
            {
                Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
                return;
            }
           and now all item you sell 0

 totalPrice += price * 0;

Edited by AlexHack

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...