• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Fix for meso exploit with shops

Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
I usually don't share fixes with the public anymore, only with Lai, though he has fixed most of the exploits I find already. :D: Anyways, decided to release the fix for this one because the guys who did it on my server yesterday are fags and they don't deserve to be able to exploit, not even on Soul's servers. I assume this works on most servers because I haven't seen this fixed in any public sources.

MapleShop.java
Code:
if (c.getPlayer().getMeso() >= item.getPrice() * quantity) {
Change that to either
Code:
if (c.getPlayer().getMeso() >= (long) item.getPrice() * quantity) {
or (I suggest to use this method, otherwise you will also have to check for the quantity not being negative.)
Code:
int price = item.getPrice() * quantity;
if (price >= 0 && c.getPlayer().getMeso() >= price) {
to prevent overflow.
 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
nice release, btw, isn't it supposed to be
Code:
int price = item.getPrice() * quantity;
if (price >= 0 && c.getPlayer().getMeso() >[COLOR="Red"]=[/COLOR] price) {

If meso > price and not >=, players will not be able to buy any items although their meso is same price as items
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Of course, just a typo. :) Fixed.
 
Last edited:
Newbie Spellweaver
Joined
Feb 19, 2009
Messages
73
Reaction score
1
well done flav. Even though thats fixed by most unstupid coders :D.
 
Newbie Spellweaver
Joined
Feb 19, 2009
Messages
73
Reaction score
1
I bet he fixed it earlier. He just now released it boy :)
 
Experienced Elementalist
Joined
Jun 8, 2008
Messages
275
Reaction score
4
This made me giggle. Careful what you say, The almighty eye is watching.

OT: Thanks Flav, Nice Release.

---------- Post added at 06:15 PM ---------- Previous post was at 06:14 PM ----------



lolwut?

almighty eye...., you mean your whispering-eye :X

OT : nice XD
 
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
Let's not turn this into some pathetic argument over who is better at what... Stick to the topic.
 
Newbie Spellweaver
Joined
Jun 15, 2010
Messages
29
Reaction score
2
Code:
if (item != null && item.getPrice() > 0) {
            if (c.getPlayer().getMeso() >= item.getPrice() * quantity) {

Wouldn't this also work? Found it in my source.
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Code:
if (item != null && item.getPrice() > 0) {
            if (c.getPlayer().getMeso() >= item.getPrice() * quantity) {

Wouldn't this also work? Found it in my source.

The problem is that if you buy so many of the item that the the price goes higher than Integer.MAX_VALUE (2,147,483,647) it goes negative again, then the player surely has more mesos than the price is. Then he gets the items and doesn't lose but gains the money he should pay.
 
Newbie Spellweaver
Joined
Jun 15, 2010
Messages
29
Reaction score
2
The problem is that if you buy so many of the item that the the price goes higher than Integer.MAX_VALUE (2,147,483,647) it goes negative again, then the player surely has more mesos than the price is. Then he gets the items and doesn't lose but gains the money he should pay.

Correct me if I'm wrong, but doesn't the price > 0 thing fix that?

Wait I feel stupid.
 
Custom Title Activated
Loyal Member
Joined
Aug 21, 2009
Messages
1,149
Reaction score
598
Indeed, price > 0 should fix it. But yeah, flav also posted that in the very first post.
 
Newbie Spellweaver
Joined
Jun 9, 2008
Messages
22
Reaction score
4
Code:
int price = item.getPrice() * quantity;
if (price >= 0 && c.getPlayer().getMeso() >= price) {

Is it possible for a player to buy so many of an expensive item the price overflows to positive again?
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
I never tried but Lai says it's not. I prefer the converting to long method, though it wastes 4 bytes.

Correct me if I'm wrong, but doesn't the price > 0 thing fix that?

Wait I feel stupid.

But you have to multiply the price with the quantity before you check for the price being >= 0.
 
return null;
Loyal Member
Joined
Dec 21, 2008
Messages
805
Reaction score
130
just wondering why are you using long and not just stick to an int?
 
Back
Top