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 (edited)

change this

player.addAdena("Sell", totalPrice, merchant, false);

to

player.addAdena("Sell", 1, merchant, false);

 

the best solution is to write for all items sold that cost is 1 adena in the window so you wont confuze players

Edited by Nightw0lf
  • 0
Posted
5 hours ago, Nightw0lf said:

change this

player.addAdena("Sell", totalPrice, merchant, false);

to

player.addAdena("Sell", 1, merchant, false);

 

the best solution is to write for all items sold that cost is 1 adena in the window so you wont confuze players

 

did not work :(

  • 0
Posted

Nightw0lf's answer is the correct one. You just need to edit the visual sell price too in order to work perfect.

 

SellList.java

-			writeD(item.getItem().getReferencePrice() / 2);
+			writeD(1);



RequestSellItem.java

-		player.addAdena("Sell", totalPrice, merchant, false);
+		player.addAdena("Sell", 1, merchant, false);

 

  • 0
Posted
8 hours ago, Nightw0lf said:

:thinking:

when you change total price to 1, it worse because all item stackable example (11 piece item) is still 1 adena in total, if we want to antisipation adena population we can change price per item to this 

 

totalPrice = SafeMath.addAndCheck(totalPrice, SafeMath.mulAndCheck((item.getReferencePrice() / "your rate setting"), count) / 2); <= this code from my pack so maybe diff from another pack

or item.getReferencePrice(), count)/ "your rate setting"

 

*"your rate setting" = like item drop rate

so all item still have uniqe price not 1 adena,

 

to antisipation player to make trash in every town floor <= still can be anticipation to make all item drop by player destroy by xx sec like drop by monster

 

#Still newbee, correct me if im wrong

  • 0
Posted
15 hours ago, L2 TokTil said:

when you change total price to 1, it worse because all item stackable example (11 piece item) is still 1 adena in total, if we want to antisipation adena population we can change price per item to this 

 

totalPrice = SafeMath.addAndCheck(totalPrice, SafeMath.mulAndCheck((item.getReferencePrice() / "your rate setting"), count) / 2); <= this code from my pack so maybe diff from another pack

or item.getReferencePrice(), count)/ "your rate setting"

 

*"your rate setting" = like item drop rate

so all item still have uniqe price not 1 adena,

 

to antisipation player to make trash in every town floor <= still can be anticipation to make all item drop by player destroy by xx sec like drop by monster

 

#Still newbee, correct me if im wrong

 

On 11/20/2019 at 8:46 AM, Nightw0lf said:

change this

player.addAdena("Sell", totalPrice, merchant, false);

to

player.addAdena("Sell", 1, merchant, false);

 

the best solution is to write for all items sold that cost is 1 adena in the window so you wont confuze players

 

  • 0
Posted
On 11/20/2019 at 1:29 PM, melron said:

Nightw0lf's answer is the correct one. You just need to edit the visual sell price too in order to work perfect.

 


SellList.java

-			writeD(item.getItem().getReferencePrice() / 2);
+			writeD(1);



RequestSellItem.java

-		player.addAdena("Sell", totalPrice, merchant, false);
+		player.addAdena("Sell", 1, merchant, false);

 

 

Hello. first of all thank you so much for helping me. 
In my SellList.java there is no such line that you have replaced. take a look look at the print.

 

x9b3Tvv.png

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

    • 🏰 Clan Donations System – Power Through Unity This system allows clan members to support their clan directly through donations, turning contribution into strength.   How it works: Every donation made by a clan member is automatically listed in the clan donation panel. Each donation is permanently linked to the clan — no loss, no reset. The Clan Leader manages rewards manually for full transparency.   🎁 Clan Donation Rewards For every donation: The clan receives 5% Real Money or 10% Donate Coins (Leader chooses how the reward is given)   📌 After the reward is delivered, the donation is marked as PAID in the system. 🧾 Full Transparency Player name Donation amount Reward value (Real / Donate Coins) Date & status (Pending / Paid)   Everything is visible. Everything is tracked. Nothing is forgotten.   ⚔️ Support your clan. Strengthen your alliance. Power is built — not given.   https://www.l2dead.com/ https://discord.gg/TGnATuZmdt
    • up  corrected some retail crashes and hooked some new memory adresses that were missing  fix some missing retail behaviors on some recipes , you can also get the server as c4 with fixed scripts fully retail  what has been done to the c4  ( client is already configured) totally fixed npcposes  totally fixed raidbosses and minions bugged quests are fixed (known) a lot of recipes that were wrong  wrong values in several stats and corrected hero weapons behaviors/atk range
    • ποιο ειναι αρχαιο ακριβως? εκανες τον κοπο να ανοιξεις τα λινκς που εστειλα? 
    • Rates: xp45x / sp50x / adena50x (all adena is divided by 100/all shops prices too) Server: Full Official interlude server  with custom modifications Gameplay: l2Gold weapons - jewels, Buffs 1 hour, rebirth, No class change quests, increased movement speed on all classes   Download patch here: https://mega.nz/file/oZdG2KTa#1uTYSyEkNQV9U0Zxj-KLDE88mLj4pzQJZSYs2k3tpzo   Our server is waiting for all Lineage 2 fans who want to relive the good old days. This server is non-profit and fully dedicated to the community. There is no corruption, no pay-to-win, and no hidden agendas—just pure classic L2 fun.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..