//===== Hercules Script =======================================
//= Coin exchanger
//===== By: ==================================================
//= lilcooldude69
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Hercules Git
//===== Description: =========================================
//= Basic Coin exchange script
//============================================================
- script Coin Exchange -1,{
set .@bronze,10000; //bronze coin price exchange
set .@silver,100000; //silver coin price exchange
set .@gold,1000000; //gold coin price exchange
set .@mithril,100000000; //mithril coin price exchange
set .@platnum,1000000000; //platnum coin price exchange
set .@name$,"[^FF0000Coin Exchanger^000000]";
set .@pname$,strcharinfo(0);
set .@zeny,Zeny;
callfunc "F_ClearGarbage",0;
mes .@name$;
mes "Hi, "+.@pname$+", I'm the coin exchanger, I can exchange your coins into zeny and vice versa";
next;
mes .@name$;
mes "What would you like to do?";
switch(select("Zeny->Coins:Coins->Zeny")){
Case 1:
if(.@zeny<10000){
mes "Sorry you don't have any Zeny to exchange :(";
close;
end;}
mes "How much zeny would you like to convert into coins?";
switch(select("All of it!:I want to type it!")){
Case 1:
goto calczen;
Case 2:
input .@amt;
if(.@amt>zeny){
set .@amt, zeny;
}
while (.@amt>=.@bronze){
set .@result, .@result+1;
set .@amt, .@amt-.@bronze;
}
while (.@result>=10){
set .@result2, .@result2+1;
set .@result, .@result-10;}
while(.@result2>=10){
set .@result3, .@result3+1;
set .@result2, .@result2-10;}
while(.@result3>=10){
set .@result4, .@result4+1;
set .@result3, .@result3-10;}
while(.@result4>=10){
set .@result5, .@result5+1;
set .@result4, .@result4-10;}
while (.@result5>=10){
set .@fresult, .@fresult+1;
set .@result5, .@result5-10;}
goto Coins;
Coins:
if(.@result>0){
getitem 673,.@result;}
if(.@result2>0){
getitem 675,.@result2;}
if(.@result3>0){
getitem 671,.@result3;}
if(.@result4>0){
getitem 674,.@result4;}
if(.@result5>0){
getitem 674,.@result5;}
if(.@fresult>0){
getitem 677,.@fresult;}
set final, (.@result*10000)+(.@result2*100000)+(.@result3*1000000)+(.@result4*100000000)+(.@result5*100000000)+(.@fresult*1000000000);
set zeny, zeny-final;
close;
end;
}
calczen:
set .@zeny, Zeny;
freeloop(1);
while (.@zeny>=.@bronze){
set .@result, .@result+1;
set .@zeny, .@zeny-.@bronze;
}
while (.@result>=10){
set .@result2, .@result2+1;
set .@result, .@result-10;}
while(.@result2>=10){
set .@result3, .@result3+1;
set .@result2, .@result2-10;}
while(.@result3>=10){
set .@result4, .@result4+1;
set .@result3, .@result3-10;}
while(.@result4>=10){
set .@result5, .@result5+1;
set .@result4, .@result4-10;}
while (.@result5>=10){
set .@fresult, .@fresult+1;
set .@result5, .@result5-10;}
goto Coins;
Case 2:
if(countitem(673)>0 || countitem(675)>0 || countitem(671)>0 || countitem(674)>0 || countitem(677)>0){
mes "How much coins would you like to convert into zeny?";
switch(select("All of them!:I want to put in the amount!")){
Case 1:
goto calccoins;
end;
Case 2:
mes "What type of coins would you like to convert?";
switch(select("Bronze:Silver:Gold:Mithril:Platnum")){
Case 1:
input .@bamt;
if(.@bamt>countitem(673)){
mes "You don't have this many Bronze Coins.";
close2;
end;}
delitem 673,.@bamt;
set zeny, zeny+(.@bronze*.@bamt);
close;
end;
Case 2:
input .@samt;
if(.@samt>countitem(675)){
mes "You don't have this many Silver Coins.";
close2;
end;}
delitem 675,.@samt;
set zeny, zeny+(.@silver*.@samt);
close;
end;
Case 3:
input .@gamt;
if(.@gamt>countitem(671)){
mes "You don't have this many Gold Coins.";
close2;
end;}
delitem 671,.@gamt;
set zeny, zeny+(.@gold*.@gamt);
close;
end;
Case 4:
input .@mamt;
if(.@mamt>countitem(674)){
mes "You don't have this many Mithril Coins.";
close2;
end;}
delitem 674,.@mamt;
set zeny, zeny+(.@mithril*.@mamt);
close;
end;
Case 5:
input .@pamt;
if(.@pamt>countitem(677)){
mes "You don't have this many Platnum Coins.";
close2;
end;}
delitem 677,.@pamt;
set zeny, zeny+(.@platnum*.@pamt);
close;
end;}
calccoins:
set .@coin, countitem(673)*.@bronze;
set .@coin2, countitem(675)*.@silver;
set .@coin3, countitem(671)*.@gold;
set .@coin4, countitem(674)*.@mithril;
set .@coin5, countitem(677)*.@platnum;
set .@fcoin, .@coin+.@coin2+.@coin3+.@coin4+.@coin5;
if(zeny+.@fcoin>1000000000){
mes "You have too much money @_@, convert some into coins before you try to convert that much";
close2;
end;}
set zeny, zeny+.@fcoin;
delitem 673, countitem(673);
delitem 675, countitem(675);
delitem 671, countitem(671);
delitem 674, countitem(674);
delitem 677, countitem(677);
close;
end;
}
}else{mes "Sorry You have no coins ;_;"; close2; end;}
}}
prontera,155,178,4 duplicate(Coin Exchange) Coin Exchange#prt 909