prontera,146,154,5 script Event Manager 4_M_MAYOR,{
set @header$,"[ ^0000ffEvent Manager^000000 ]";
mes @header$;
mes "Hello ^66CC66" + strcharinfo(0) + "^000000!";
mes " ";
mes "Do you have Event Coins in your pocket?, We can have a transaction if you do!";
next;
switch(select("What are the exchange rates?:I'm here for exchanges:I'm here for transaction:I don't have one, sorry.")) {
case 1:
next;
mes @header$;
mes "There are 3 types of Event Coins in this server:";
mes " ";
mes "- Gold Coin";
mes "- Silver Coin, and";
mes "- Bronze Coin";
next;
mes @header$;
mes "The exchange rates between Event Coins are:";
mes " ";
mes "1 Gold Coin = 5 Silver Coins";
mes "1 Silver Coin = 5 Bronze Coins";
next;
mes @header$;
mes "Here are the list of the items that you can purchase using Event Coins:";
mes " ";
mes "(^FF0000Note that in this list, we have: GC = Gold Coins, SC = Silver Coins and BC = Bronze Coins^000000)";
close;
case 2:
next;
mes @header$;
mes "Please remember the exchange rates are:";
mes " ";
mes "1 Gold Coin = 5 Silver Coins";
mes "1 Silver Coin = 5 Bronze Coins";
next;
mes @header$;
mes "So, which type of conversion would you like to do?";
// Build Menu
.@page_size = 10;
.@trade_id_size = getarraysize(.trade_id);
.@page_total_size = ( .@trade_id_size / .@page_size ) - 1;
.@page_index = 0;
do {
.@menu$ = "";
for ( .@index = 0; .@index < .@page_size; .@index++ ) {
.@a = (( .@page_index * .@page_size ) + .@index );
.@menu$ = .@menu$ +.coin_amt[.@a] +" "+ getitemname(.coin_id[.@a]) +"s"+" --> "+ .trade_amt[.@a] +" "+ getitemname(.trade_id[.@a]) +"s" + ":";
}
.@option = select( .@menu$+ "Next Page" );
.@coin_choice = ( ( .@page_index * .@page_size ) + .@option - 1 );
if ( .@option > .@page_size && .@page_index < .@page_total_size ) {
.@page_index++;
}
else if ( .@coin_choice < .@trade_id_size ) {
break;
}
else .@page_index = 0;
} while ( .@option >= .@page_size );
if (countitem(.coin_id[.@coin_choice]) < .coin_amt[.@coin_choice]) {
mes " ";
mes "You don't have enough "+.coin_amt[.@coin_choice]+"x "+getitemname( .coin_id[.@coin_choice] )+".";
close;
}
mes " ";
mes "Ok! Let me do a little magic...";
if (checkweight(.trade_id[.@item_choice],.trade_amt[.@item_choice])) {
next;
mes @header$;
mes "and.... here you go, Enjoy!";
delitem .coin_id[.@coin_choice], .coin_amt[.@coin_choice];
getitem .trade_id[.@coin_choice], .trade_amt[.@coin_choice];
close;
} else {
next;
mes @header$;
mes "Wait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.";
close;
}
case 3:
next;
mes @header$;
mes "Okay, then you can now pick on my list!:";
mes " ";
mes "(^FF0000Note that in this list, we have: GC = Gold Coins, SC = Silver Coins and BC = Bronze Coins^000000)";
// Build Menu
// for (.@a = 0; .@a < getarraysize(.shop); .@a += 5) {
// set .@menu$, .@menu$ + (.@menu$ == "" ? "" : ":") +"[^FF0000"+ .shop[.@a+4] +"^000000]"+" "+ getitemname(.shop[.@a+3]) +" for "+ .shop[.@a+2] +" ";
// if(.shop[.@a] == 2) .@menu$ += "GC";
// else if(.shop[.@a] == 1) .@menu$ += "SC";
// else .@menu$ += "BC";
// }
//
// .@item_choice = (select(.@menu$) - 1);
//.@a = 5*.@item_choice;
// Build Menu
.@page_size = 10;
.@trade_id_size = getarraysize(.shop) / 5;
.@page_total_size = ( .@trade_id_size / .@page_size ) - 1;
.@page_index = 0;
do {
.@menu$ = "";
.@count = 0;
for ( .@index = 0; .@index < .@page_size; .@index++ ) {
.@a = (( .@page_index * .@page_size ) + ( .@index * 5 ) );
.@menu$ = .@menu$ + "[^FF0000"+ .shop[.@a+4] +"^000000]"+" "+ getitemname(.shop[.@a+3]) +" for "+ .shop[.@a+2] +" ";
if(.shop[.@a] == 2) .@menu$ += "GC";
else if(.shop[.@a] == 1) .@menu$ += "SC";
else .@menu$ += "BC";
.@menu$ = .@menu$ + ":";
}
.@option = select( .@menu$+ "Next Page" );
.@coin_choice = ( ( .@page_index * .@page_size ) + ( (.@option-1) * 5 ));
dispbottom ".@option = "+.@option ;
if ( .@option > .@page_size && .@page_index < .@page_total_size ) {
.@page_index++;
}
else if ( .@coin_choice <= .@trade_id_size ) {
break;
}
else .@page_index = 0;
} while ( .@option >= .@page_size );
if (countitem(.shop[.@coin_choice+1]) < .shop[.@coin_choice+2]) {
// if (countitem(.shop[.@a+1]) < .shop[.@a+2]) {
next;
mes @header$;
mes "You don't have enough "+.shop[.@coin_choice+2]+"x "+getitemname( .shop[.@coin_choice+1] )+".";
close;
}
if (checkweight(.shop[.@coin_choice+3],.shop[.@coin_choice+4])) {
next;
mes @header$;
mes "Done! Thank you for the transaction hope you enjoy it!.";
delitem .shop[.@coin_choice+1], .shop[.@coin_choice+2];
getitem .shop[.@coin_choice+3], .shop[.@coin_choice+4];
close;
} else {
next;
mes @header$;
mes "Wait a second! Right now, you're carrying too many items with you. Please come back after putting some of your things into Kafra Storage.";
close;
}
case 4:
next;
mes @header$;
mes "Okay, You can always comeback..";
close;
}
OnInit:
// Coin Exchange
// setarray .coin_id[0],3118,3119,3118,3117;
// setarray .coin_amt[0],1,1,5,5;
// setarray .trade_id[0],3117,3118,3119,3118;
// setarray .trade_amt[0],5,5,1,1;
// Coin Exchange
setarray .coin_id[0],
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504;
setarray .coin_amt[0],
1,1,5,5,
11,11,15,15,
21,21,25,25,
31,31,35,35,
41,41,45,45,
51,51,55,55,
61,61,65,65,
71,71,75,75,
81,81,85,85,
91,91,95,95;
setarray .trade_id[0],
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504,
501,502,503,504;
setarray .trade_amt[0],
5,5,1,1,
15,15,11,11,
25,25,21,21,
35,35,31,31,
45,45,41,41,
55,55,51,51,
65,65,61,61,
75,75,71,71,
85,85,81,81,
95,95,91,91;
// ExchangeName,required_id,amount,exchange_id,amount
// ExchangeName:
// BC = 0
// SC = 1
// GC = 2
setarray .shop[0],
0,3117,1,969,50,
0,3117,1,608,100,
0,3117,1,607,50,
1,3118,1,12535,25,
1,3118,1,12202,10,
1,3118,1,12203,10,
1,3118,1,12204,10,
1,3118,1,12205,10,
1,3118,1,12206,10,
1,3118,1,12207,10,
1,3118,2,12114,300,
1,3118,2,12115,300,
1,3118,2,12116,300,
1,3118,2,12117,300,
1,3118,2,12029,300,
1,3118,2,12032,300,
1,3118,2,12033,300,
1,3118,2,12028,300,
2,3119,2,7086,1,
2,3119,2,7073,2,
2,3119,2,7074,2,
2,3119,2,7075,2,
2,3119,2,7076,2,
2,3119,2,7077,2,
2,3119,2,7078,2,
2,3119,2,7079,2,
2,3119,2,7080,2,
2,3119,2,7081,2,
2,3119,2,7082,2,
2,3119,2,7083,2,
2,3119,2,7084,2,
2,3119,2,7085,2,
2,3119,2,7087,2,
2,3119,2,7088,2,
2,3119,2,7089,2,
2,3119,2,7090,2,
2,3119,2,7091,2,
2,3119,2,7092,2,
2,3119,5,4399,1,
2,3119,6,4365,1,
2,3119,7,4363,1,
2,3119,8,4367,1,
2,3119,10,4361,1,
2,3119,10,4357,1,
2,3119,10,4359,1;
end;
}