//===== Custom eAthena Script =======================================
//= Guild Bank
//===== By: =========================================================
//= Mercurial
//===== Description =================================================
//= A Guild Bank where every member of a guild can deposit/withdraw
//= money.
//===== Version Change Log ==========================================
//= 1.3 - Added Guild Rank Security(darkpurple) and optimized it a bit lol.(need more suggestions)
//= 1.2 - Optimized the script and changed the way script works. not supports unlimited Bank Accounts :).
//= 1.1 - Added Guild Master Control Panel(Theres only Set Password Option for now)
//= 128x5 Guild Bank Account Limit
//= 1.0 - First Guild Banker Release
//===================================================================
prontera,140,182,4 script Guild Banker 964,{
set .@gb$,"[Guild Banker]";
if( getcharid(2) == 0 )
{
mes .@gb$;
mes "Sorry, But you cannot have a guild bank without a guild.";
close;
}
else if(strcharinfo(0)==getguildmaster(getcharid(2)))
{
mes .@gb$;
mes "I am the Guild Banker";
next;
mes .@gb$;
mes "What would you like todo?";
switch(select("Register Guild","Set/Change Guild Password","Withdraw","Deposit","Set Rank Number Privilege"))
{
case 1:
next;
mes .@gb$;
mes "Guild Bank Registration requires 100,000z";
mes "Would you like to continue?";
switch(select("Yes","No"))
{
case 1:
if(zeny<100000)
{
next;
mes .@gb$;
mes "Sorry, but you don't have enough zeny to register a Guild Bank";
close;
}
else
{
if(getd("$greg"+getcharid(2))==1)
{
next;
mes .@gb$;
mes "The Guild "+strcharinfo(2)+" is already registered in our database";
mes "Thank you.";
close;
}
else
{
set zeny,zeny-100000;
setd "$gzeny"+getcharid(2),0;
setd "$greg"+getcharid(2),1;
setd "$gpassword"+getcharid(2)+"$","empty";
next;
mes .@gb$;
mes "The Guild "+strcharinfo(2)+" has been register.";
mes "You now have access to guild bank";
close;
}
}
break;
case 2:
goto GB_End;
break;
}
break;
case 2:
if(getd("$greg"+getcharid(2))==1)
{
next;
mes .@gb$;
mes "Are you sure you want to set a password or change password for the guild bank?";
switch(select("Yes","No"))
{
case 1:
gpas_return:
next;
mes .@gb$;
mes "Please enter the password.";
mes "Note: if you don't want any password input 'empty' without quotes";
mes "If you have just registered recently you might need to set a password before using Guild Bank.";
input .gpassword$;
setd "$gpassword"+getcharid(2)+"$",.gpassword$;
next;
mes .@gb$;
mes "Please enter the password again for verification.";
input .gpassword$;
if(getd("$gpassword"+getcharid(2)+"$")!=.gpassword$)
{
next;
mes .@gb$;
mes "Password does not match, Please try again.";
setd "$gpassword"+getcharid(2)+"$","empty";
goto gpas_return;
end;
}
else
{
next;
mes .@gb$;
mes "You have succesfully set a password for your Guild Bank";
mes "Thank you, Come again.";
close;
}
break;
case 2:
goto GB_End;
break;
}
close;
}
else
goto GB_NoReg;
break;
case 3:
goto gb_withdraw;
break;
case 4:
goto gb_deposit;
break;
case 5:
next;
mes .@gb$;
mes "Please Input the Rank that will be able to withdraw.";
mes "0-19";
mes "0-Guild Master & 19-Newbie";
mes "Example: you input 18... therefore 18 and below can withdraw in this guild bank";
input .position;
setd "$position"+getcharid(2),.position;
close;
break;
}
}
else
{
mes .@gb$;
mes "I am the Guild Banker";
next;
mes .@gb$;
mes "What would you like todo?";
switch(select("Withdraw","Deposit"))
{
case 1:
gb_withdraw:
query_sql "SELECT `position` FROM `guild_member` WHERE `name` = '"+strcharinfo(0) +"'",.position;
if(.position>getd("$position"+getcharid(2)))
goto GB_NoWithdraw;
else if(getd("$greg"+getcharid(2))==1)
{
next;
mes .@gb$;
mes "Your Guild has "+getd("$gzeny"+getcharid(2))+" zeny.";
mes "Would you like to withdraw some zeny?";
switch(select("Yes","No"))
{
case 1:
gpassword_x:
if(getd("$gpassword"+getcharid(2)+"$")!="empty")
{
next;
mes .@gb$;
mes "You are required to enter a password before you can withdraw some zeny";
mes "Please enter the password";
input .gpassword$;
if(.gpassword$!=getd("$gpassword"+getcharid(2)+"$"))
{
next;
mes .@gb$;
mes "Incorrect Password Please Try again.";
goto gpassword_x;
}
else
goto password_o;
}
else
{
password_o:
next;
mes .@gb$;
mes "How much zeny would you like to withdraw?";
input @gwithdraw;
if(@gwithdraw>getd("$gzeny"+getcharid(2)))
{
next;
mes .@gb$;
mes "The Guild Bank doesn't have enough zeny.";
close;
}
else
{
set zeny,zeny+@gwithdraw;
setd "$gzeny"+getcharid(2),getd("$gzeny"+getcharid(2))-@gwithdraw;
next;
mes .@gb$;
mes "There you go, Come again!";
close;
}
}
break;
case 2:
goto GB_End;
break;
}
close;
}
else
goto GB_NoReg;
break;
case 2:
gb_deposit:
if(getd("$greg"+getcharid(2))==1)
{
next;
mes .@gb$;
mes "Your have "+zeny+" zeny.";
mes "Would you like to deposit some zeny?";
switch(select("Yes","No"))
{
case 1:
next;
mes .@gb$;
mes "How much zeny would you like to deposit?";
input @gdeposit;
if(@gdeposit>zeny)
{
next;
mes .@gb$;
mes "You don't have enough zeny.";
close;
}
else
{
set zeny,zeny-@gdeposit;
setd "$gzeny"+getcharid(2),getd("$gzeny"+getcharid(2))+@gdeposit;
next;
mes .@gb$;
mes "There you go, Come again!";
close;
}
break;
case 2:
goto GB_End;
break;
}
}
else
goto GB_NoReg;
break;
}
}
end;
GB_NoWithdraw:
next;
mes .@gb$;
mes "Your Guild Rank is not authorized to withdraw zeny, Thank you";
close;
GB_NoReg:
next;
mes .@gb$;
mes "Your Guild is not registered in the Guild Bank Database";
close;
GB_End:
next;
mes .@gb$;
mes "Ok, Good Bye!";
close;
}