-
[Add-on] MapleBank System
Alright this was coded by Me. It was Sharky's idea though. I did most of the work this time but w/e. I hope you enjoy it, its basically a bank that stores a "long" value of mesos, we made it only hold 1tril, but you can change that if you think its too much.
Lets get started with the source code:
MySQL:
Code:
ALTER TABLE `characters` ADD COLUMN `mesosInBank` BIGINT(15) NOT NULL DEFAULT 0;
MapleCharacter:
PHP Code:
private long mesosInBank;
public long getMesosInBank() {
return mesosInBank;
}
public void depositMesosToBank(long mesos) {
if(getMeso() >= mesos) {
this.mesosInBank += mesos;
if(getMesosInBank() >= 1000000000000L) {
long difference = getMesosInBank() - 1000000000000L;
this.mesosInBank = 1000000000000L;
dropMessage("You currently have 1 Trillion mesos in the bank, so you cannot deposit any more mesos.");
gainMeso((int) -(mesos - difference), true);
} else {
gainMeso((int) -mesos, true);
dropMessage("You have successfully deposited "+ mesos +" mesos to the bank. You now have "+ getMesosInBank() +" mesos saved.");
}
} else {
dropMessage("You do not have enough mesos to complete this deposit.");
}
}
public void withdrawMesosFromBank(long mesos) {
if(getMesosInBank() > mesos) {
if(getMeso() + mesos <= 2100000000) {
this.mesosInBank -= mesos;
gainMeso((int) mesos, true);
dropMessage("You have successfully withdrawn "+ mesos +" mesos from the bank. You now have "+ getMesosInBank() +" mesos in the bank.");
} else {
dropMessage("You cannot withdraw "+ mesos +" mesos or else you will go over the limit for the max mesos you can hold.");
}
} else {
dropMessage("You cannot withdraw "+ mesos +" from the bank. You only have "+ getMesosInBank() +" mesos saved.");
}
}
In getDefault:
PHP Code:
ret.mesosInBank = 0;
In loadCharFromDB:
PHP Code:
ret.mesosInBank = rs.getLong("mesosInBank");
In saveToDB:
Where you see this:
PHP Code:
ps = con.prepareStatement("UPDATE characters SET level = ?, reborns = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, ................. WHERE id = ?
Change it to this:
PHP Code:
ps = con.prepareStatement("UPDATE characters SET level = ?, reborns = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, ................., mesosInBank = ? WHERE id = ?
Where you see this:
PHP Code:
ps = con.prepareStatement("INSERT INTO characters (level, reborns, fame, str, dex, luk, `int`, ..................... accountid, name, world)
Change it to this:
PHP Code:
ps = con.prepareStatement("INSERT INTO characters (level, reborns, fame, str, dex, luk, `int`, ..................... mesosInBank, accountid, name, world)
And add a ? to the list of ?'s to the right of what you just changed.
Then scroll down until you see something like this (your numbers will be different):
PHP Code:
if (update) {
ps.setInt(60, id);
} else {
ps.setInt(60, accountid);
ps.setString(61, name);
ps.setInt(62, world);
}
Right above the if (update) { line, add this:
PHP Code:
ps.setLong(mesosInBank, 60);
//I'm using the number 60 there because that was the number before the id int. 'ps.setInt(60, id)' You will use the number of your id row as well.
//Then push the if (update) { block of code back 1 number, like so:
PHP Code:
ps.setLong(mesosInBank, 60);
if (update) {
ps.setInt(61, id);
} else {
ps.setInt(61, accountid);
ps.setString(62, name);
ps.setInt(63, world);
}
NPCConversationManager:
PHP Code:
private int getMesosInBank() {
return getPlayer().getMesosInBank();
}
private void depositMesosToBank(int mesos) {
getPlayer().depositMesosToBank(mesos);
}
private void withdrawMesosFromBank(int mesos) {
getPlayer().withdrawMesosFromBank(mesos);
}
Now for the NPC:
PHP Code:
/**
*
* @author Soulfist
*/
var status = 0;
var choice = ["Check my Balance", "Withdraw Mesos", "Deposit Mesos"];
var sel;
function start() {
var msg = "Hey there #h #, welcome to the #rMapleBank#k, how may I service you today?#b";
for (var i = 0; i < choice.length; i++)
msg += "\r\n\t#L"+i+"#"+choice[i]+"#l";
cm.sendSimple(msg);
}
function action(m, t, s) {
if (m < 1) {
cm.dispose();
return;
} else {
status++;
}
if (status == 1) {
sel = s;
if (s == 0) {
cm.sendOk("#h #, you have #b" + cm.getMesosInBank() + "#k in your bank.");
cm.dispose();
} else if (s == 1) {
cm.sendGetNumber("How many mesos would you like to withdraw today?", 1, 1, 2147483647);
} else if (s == 2) {
cm.sendGetNumber("How many mesos would you like to deposit today?", 1, 1, 2147483647);
}
} else if (status == 2) {
if (sel == 1) {
cm.withdrawMesosFromBank(s);
cm.sendOk("Here you are, #g" + s + "# mesos. Please come again!");
cm.dispose();
} else if (sel == 2) {
cm.depositMesosToBank(s);
cm.sendOk("Wow, your rich! You now have #b" + cm.getMesosInBank() + "# mesos in your bank account. Please come again.");
cm.dispose();
}
}
}
Enjoy your banking!
Edited upon request.
Updated the SQL part and the methods
-
Re: [Add-on] MapleBank System
This is way better than using etc items as 'currency'. GJ.
-
Re: [Add-on] MapleBank System
I've never understood the concept of billions of money.
Why don't we just put the meso rate lower and make everything cheaper?
-
Re: [Add-on] MapleBank System
Nice release, Seems useful.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
mertjuh
I've never understood the concept of billions of money.
Why don't we just put the meso rate lower and make everything cheaper?
Probably for the same reason that people like to hit 1bil damage when it's clearly more than necessary.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
mertjuh
I've never understood the concept of billions of money.
Why don't we just put the meso rate higher and make everything cheaper?
Tell that to Nexon America :glare:
-
Re: [Add-on] MapleBank System
This system is bad structured. It's exploitable. Also, in the withdraw part, you only lose mesos, never gain.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
This system is bad structured. It's exploitable.
Explain.
Quote:
Originally Posted by
XxОsirisxX
Also, in the withdraw part, you only lose mesos, never gain.
Fixed.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Soulfist
Explain.
Fixed.
Nevermind about the exploit part. I'm a little unsure, but there is still a chance. I can't do it since my computer is weird and can't do some stuff, such as packet editing.
The exploit that I suggest lays when ever you decide to set the sendGetNumber value to a negative value. You can overflow mesos and also gain mesos from bank.
-
Re: [Add-on] MapleBank System
First Methods gave some errors when I put them in my IDE, so I fixed them.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
The exploit that I suggest lays when ever you decide to set the sendGetNumber value to a negative value. You can overflow mesos and also gain mesos from bank.
I had assumed you were talking about this when you said there was an exploit. But as it seems, this 'exploit' would really just be an error in the person's NPC script.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Sharky
I had assumed you were talking about this when you said there was an exploit. But as it seems, this 'exploit' would really just be an error in the person's NPC script.
Not really... since it will go trough the method. I forgot the name of the person that made billions of mesos in almost all worlds in GMS by just doing this to Dailar (Grandpa that does the medal thing) with the donation thing. (Of course, patched)
Your methods and NPC does not check for this... the only thing I'm unsure of is if the bounds in the chat can be affected by the PE, that's about it.
EDIT:
Also MoongraMS got some similar "attack" before with this.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
Not really... since it will go trough the method. I forgot the name of the person that made billions of mesos in almost all worlds in GMS by just doing this to Dailar (Grandpa that does the medal thing) with the donation thing. (Of course, patched)
Your methods and NPC does not check for this... the only thing I'm unsure of is if the bounds in the chat can be affected by the PE, that's about it.
EDIT:
Also MoongraMS got some similar "attack" before with this.
The sendGetNumber method should prevent a negative value from being used.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Sharky
The sendGetNumber method should prevent a negative value from being used.
"SHOULD"... I know, but even then, IIRC it did affected GMS and MMS. So, yeah... good luck with that :)
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
I forgot the name of the person that made billions of mesos in almost all worlds in GMS by just doing this to Dailar (Grandpa that does the medal thing) with the donation thing. (Of course, patched)
And I was just about to go try that hack, thanks for crushing my hopes :(:
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
"SHOULD"... I know, but even then, IIRC it did affected GMS and MMS. So, yeah... good luck with that :)
I've tested it for the maximum value, but I haven't tried for negatives, although I assume it will block it. It was probably something GMS overlooked, nobody's perfect. And I have no idea why it would affect Moongra.
It does deserve some testing, but I don't think it's an exploit ._. If you can prove there is an exploit (other than a flaw in the NPC script if somebody were to edit it), I'd love to try to prevent it.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Sharky
I've tested it for the maximum value, but I haven't tried for negatives, although I assume it will block it. It was probably something GMS overlooked, nobody's perfect. And I have no idea why it would affect Moongra.
It does deserve some testing, but I don't think it's an exploit ._. If you can prove there is an exploit (other than a flaw in the NPC script if somebody were to edit it), I'd love to try to prevent it.
Well, in the NPC, "sel" doesn't even exist.
I can't thinks of another exploit though.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
XxОsirisxX
This system is bad structured. It's exploitable. Also, in the withdraw part, you only lose mesos, never gain.
Geez, cut him some slack. He did most of the work, you don't need to call it bad , especially since it's one of the more useful releases since 2-3 weeks..
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Soulfist
PHP Code:
public void withdrawMesosFromBank(long mesos) {
PHP Code:
private void withdrawMesosFromBank(int mesos) {
getPlayer().withdrawMesosFromBank(mesos);
}
Why do you ask for a long when you're withdrawing or depositing. The can only withdraw or deposit the max integer value anyways.
-
Re: [Add-on] MapleBank System
Wait, whats the point of this if we have storage that put items and mesos and you can do all that transfer/withdraw as well o.o, Well if this was to do it for the hell of it then nice release..
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
FateJiki
Geez, cut him some slack. He did most of the work, you don't need to call it bad , especially since it's one of the more useful releases since 2-3 weeks..
o_0 All he's doing is pointing out a possible exploit, so they can try fixing it... nothing wrong with that 0_o
@OnTopic: I think I see a flaw. In your SQL statement, you have it as INT... thing is, in MySQL, INT can only go up to 4.2 billion and that's if it's an unsigned INT. I think you'd have to have it as BIGINT instead.
Source
-
Re: [Add-on] MapleBank System
Ok so nexon coded the storage for the lulz?
Fk these things, whats so cool about having so many mesos when all of the servers that use this have a all-in-one 1 meso shop -.-
Posted via Mobile Device
-
Re: [Add-on] MapleBank System
Hmm, good idea thought, you can probably put an "interest" system. Lulz. Daily 3% or so on.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
kevintjuh93
Ok so nexon coded the storage for the lulz?
Fk these things, whats so cool about having so many mesos when all of the servers that use this have a all-in-one 1 meso shop -.-
Posted via Mobile Device
I don't see the point of collect mesos either. Since, you will never use it as how much gain it.
-
Re: [Add-on] MapleBank System
Quote:
Originally Posted by
Shawn
o_0 All he's doing is pointing out a possible exploit, so they can try fixing it... nothing wrong with that 0_o
@OnTopic: I think I see a flaw. In your SQL statement, you have it as INT... thing is, in MySQL, INT can only go up to 4.2 billion and that's if it's an unsigned INT. I think you'd have to have it as BIGINT instead.
Source
Thanks Shawn, Osiris, Julien and Akira o_o
---------- Post added at 04:46 PM ---------- Previous post was at 04:37 PM ----------
Quote:
Originally Posted by
iAkira
Wait, whats the point of this if we have storage that put items and mesos and you can do all that transfer/withdraw as well o.o, Well if this was to do it for the hell of it then nice release..
Can teh storage hold 1 Tril :P?