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

  • 0
Posted (edited)

have this in SellList.java 

writeQ(item.getItem().getReferencePrice() / 2);

change it 

writeQ(1);

 

 

Edited by tazerman2
  • 0
Posted

all right. but can you show for the player that will be sold for 1 adena? why the modification works. but "player" will think it will sell for the price that is shown and is not.

 

see the video:

 

https://www.youtube.com/watch?v=kqQXrmU82ao

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

    • hello guys im searching these days to find something like a patch interface i dont know what it is i logged in many servers i love like those graphics the titles and names are more smooth with bold letters ..i logged in euro-pvp.com but deazel(lucera dev) told me that euro-pvp has multiprotocol with interlude and classic ... and i found a server with name l2gamepower thats only interlude and has same graphics .. can someone explain me or help me how can i have this graphics with namers titles more bold letters and in log in has a name with a patch    https://imgur.com/a/0HzBKWk
    • For the first time in thousands of posts I've read on this forum, I’ve actually found a message that is enriching on both a personal and professional level. I’ll take your advice to heart: I’m going to start creating more and stop overthinking things that get me nowhere. I totally agree about the toxic community; it's a shame. Time to keep working. Thanks a lot for your input.   Exactly, that’s why the Scryde method and their merge system work so well. People don't lose their progress and can still keep rushing new servers. Obviously, gameplay has mutated into something much faster-paced, but obviously, this happens in real life too, everyone is more accelerated and on edge. Thanks to social media and mental conditioning. But, well, it’s something we have to accept. Don't even get me started on gambling and online casinos; that’s a whole other topic regarding all the P2W servers.   Really, amen bro.
    • Hello, the server lifespan isn't something that only affects Argentina; just look at the South American and European communities. Those distant days you mentioned, when we were younger, which I completely agree with, are long gone. Today, the community plays RUSH for 30 or 60 days and seeks the adrenaline rush of starting over. As for free or paid packs, there are many options, but in all of them, you'll have to create your own unique style.  
    • Introducing: NimeraCP V2! What's New: Realtime Tickets (Receive + Send messages without refreshing page, instant delivery to player) Powered by WebSockets Realtime Rankings/Stats (Receive instant updates without refreshing page) Powered by WebSockets - PvP/Boss Rankings/Clan Rankings etc... oAuth Login + Register (VK, Discord, Google) Two Factor Authentication (Authenticator App) Passkey coming soon! Theme Editor New Arcade Game: Rock Paper Scissors Let players gamble wagering their topped up wallet balance! Discord Webhooks: Receive messages to discord via Bot or Webhook for certain events New Player registration New Payment received New Ticket Opened and more Complete UI Overhaul NimeracCP V2 is now fully multilangual supporting the following languages: English Ελληνικά Português / Brasileiro Español Русский Українська 한국어 Onboarding: Easy installation wizard via /onboarding on first use of the panel for easy installation. Feature Flags: You have full control over the UI. Disable/Enable pages + features via Admin CP CloudFlare R2 Bucket integration: The panel comes with Bucket storage integration for all kinds of assets uploaded to the panel.   A new website shop at https://nimeracp.com/ is also coming soon, including full installation docs.  You can join the discord for further updates/questions: https://discord.nimeracp.com/
  • 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..

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