-
Fix for meso exploit with shops
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.
-
Re: Fix for meso exploit with shops
-
Re: Fix for meso exploit with shops
nice release, btw, isn't it supposed to be
Code:
int price = item.getPrice() * quantity;
if (price >= 0 && c.getPlayer().getMeso() >= price) {
If meso > price and not >=, players will not be able to buy any items although their meso is same price as items
-
Re: Fix for meso exploit with shops
Of course, just a typo. :) Fixed.
-
Re: Fix for meso exploit with shops
well done flav. Even though thats fixed by most unstupid coders :D.
-
Re: Fix for meso exploit with shops
^ So you're saying flav was stupid for not fixing it earlier?
-
Re: Fix for meso exploit with shops
I bet he fixed it earlier. He just now released it boy :)
-
Re: Fix for meso exploit with shops
The reason for the rollback...
Anyways thanks for sharing it with us.
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
Xerixe
^ So you're saying flav was stupid for not fixing it earlier?
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 ----------
Quote:
Originally Posted by
nugyyman
The reason for the rollback...
Anyways thanks for sharing it with us.
lolwut?
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
maxcloud
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
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
xReflex
well done flav. Even though thats fixed by most unstupid coders :D.
You can't fix something you don't know "exist".
-
Re: Fix for meso exploit with shops
Let's not turn this into some pathetic argument over who is better at what... Stick to the topic.
-
Re: Fix for meso exploit with shops
Code:
if (item != null && item.getPrice() > 0) {
if (c.getPlayer().getMeso() >= item.getPrice() * quantity) {
Wouldn't this also work? Found it in my source.
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
SeanDev
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.
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
flav
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.
-
Re: Fix for meso exploit with shops
Indeed, price > 0 should fix it. But yeah, flav also posted that in the very first post.
-
Re: Fix for meso exploit with shops
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?
-
Re: Fix for meso exploit with shops
I never tried but Lai says it's not. I prefer the converting to long method, though it wastes 4 bytes.
Quote:
Originally Posted by
SeanDev
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.
-
Re: Fix for meso exploit with shops
just wondering why are you using long and not just stick to an int?
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
mertjuh
just wondering why are you using long and not just stick to an int?
Look up what a Long is, then an Integer.
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
mertjuh
just wondering why are you using long and not just stick to an int?
There's 2 solutions, both work. One uses Long and the other one uses Integer.
-
Re: Fix for meso exploit with shops
Just to add on ,this fix is also available for hiredmerchants/playershops.
-
Re: Fix for meso exploit with shops
Most meso exploits have something to do with overflow.
-
Re: Fix for meso exploit with shops
Quote:
Originally Posted by
xReflex
well done flav. Even though thats fixed by most unstupid coders :D.
Not really, seeing as it was in nearly every public server.
Quote:
Originally Posted by
xReflex
I bet he fixed it earlier. He just now released it boy :)
Nope he found out about it not long ago.
Quote:
Originally Posted by
maxcloud
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?
The almighty eye? really now? :ehh:
Quote:
Originally Posted by
mertjuh
just wondering why are you using long and not just stick to an int?
If you stick to the int the players get a negative amount of mesos after you multiple the price of an item and the amount of items. Therefore you need to make sure that total amount of mesos after multiplying isn't negative.
Quote:
Originally Posted by
flav
Most meso exploits have something to do with overflow.
cntrl + f meso
-
Re: Fix for meso exploit with shops
what about Integer.MAX_VALUE since you guys wanna get all preppy now.