Description : Hey everyone, I thought I should release this basic version of Bank Loaning, of course its only a command version right now, but you guys aren't dumb enough not to add it to bank booths etc. I think this is a great Idea for all servers, it can smack the face of all those "starter" command ideas. Enjoy! Btw, if this is posted anywhere else except ********.net, it is leeched.
Difficulty : 4/10
Assumed Knowledge : Copy & Paste/Delete abilities, basic Java Knowledge.
Tested Server : MiniCraft v1.4
Files/Classes Modified : Client.java, Loans.java ( Attached )!
Picture :
Procedure
Step 1 :
Visit the following link and download the .java file, once done, add it to your source files and continue on with the next step.
Download link: [Only registered and activated users can see links. ]
Step 2 :
So, we start off inside of client.java, open it up and these commands with your others. ( customCommand method )
Code:
//Loans System! - Inside Sin
else if (command.equalsIgnoreCase("takeoutloan"))
{
sendMessage("Do you want to take out a loan of gold coins?");
NpcDialogue = 1;
}
else if (command.startsWith("deposit"))
{
try {
int amount = Integer.parseInt(command.substring(8));
server.Loans.DepositGold(amount, this);
} catch(Exception e) {
sendMessage("< Error > - Try typing: ::deposit #");
}
}
else if (command.equalsIgnoreCase("checkloan"))
{
server.Loans.CheckLoan(this);
}
//End Loans System..
Proceed...
Step 3 :
Now, once done that, search for:
Code:
SendWeapon((playerEquipment[playerWeapon]), GetItemName(playerEquipment[playerWeapon]));
You should see the starting messages and so forth there, add the following under there:
Code:
if(server.Loans.SpendCycle == 1) {
server.Loans.OweBackAmount += (server.Loans.LoanAverage / 25);
}
Proceed...
Step 4 :
Now, search the following:
Code:
public void UpdateNPCChat()
Add the following dialogue:
Code:
case 1: //Change to a non-used case.
sendFrame171(1, 2465);
sendFrame171(0, 2468);
sendFrame126("Would you like to loan out some money?", 2460);
sendFrame126("Yes, 5,000 Gold Coins", 2461);
sendFrame126("Yes, 15,000 Gold Coins", 2462);
sendFrame164(2459);
NpcDialogueSend = true;
break;
Proceed..
Step 5 :
Now search for:
Add this option dialogue there:
Code:
else if(NpcDialogue == 1) { // Loan Option One
server.Loans.LoanGold(5000, this);
NpcDialogue = 0;
RemoveAllWindows();
}
Now scroll down a bit until you see "case 9158:", add this:
Code:
else if(NpcDialogue == 1) { // Loan Option Two
server.Loans.LoanGold(15000, this);
NpcDialogue = 0;
RemoveAllWindows();
}
Proceed...
Step 6 :
Okay, now for the tricky part?
Search for:
Code:
} else if (token.equals("character-lastlogintime")) {
lastlogintime = Integer.parseInt(token2);
Add this underneath that:
Code:
} else if (token.equals("character-OweBackAmount")) {
server.Loans.OweBackAmount = Integer.parseInt(token2);
} else if (token.equals("character-LoanAverage")) {
server.Loans.LoanAverage = Integer.parseInt(token2);
} else if (token.equals("character-SpendCycle")) {
server.Loans.SpendCycle = Integer.parseInt(token2);
Now find:
Code:
characterfile.write("character-lastlogintime = ", 0, 26);
characterfile.write(Integer.toString(playerLastLogin), 0, Integer.toString(playerLastLogin).length());
characterfile.newLine();
Add these snipets underneath that code:
Code:
characterfile.write("character-OweBackAmount = ", 0, 26);
characterfile.write(Integer.toString(server.Loans.OweBackAmount), 0, Integer.toString(server.Loans.OweBackAmount).length());
characterfile.newLine();
characterfile.write("character-LoanAverage = ", 0, 24);
characterfile.write(Integer.toString(server.Loans.LoanAverage), 0, Integer.toString(server.Loans.LoanAverage).length());
characterfile.newLine();
characterfile.write("character-SpendCycle = ", 0, 23);
characterfile.write(Integer.toString(server.Loans.SpendCycle), 0, Integer.toString(server.Loans.SpendCycle).length());
characterfile.newLine();
Step 7 :
Wallaa, your done
Please report any bugs to me
Credits : 100% Made By Inside Sin