- script hourlypoints FAKE_NPC,{
OnInit:
announce "[Mileage Point System]: The system have been reloaded, please relog again to get more mileage points.", bc_all;
.point_name$ = "Mileage points";
.point_amt = 1; // Normal points gained.
.point_amt_vip = 2; // Normal points gained.
.dlimit = 1800; // Stop points if afk greater then in seconds. 600s = 10 minutes
.enable = 1;
.level = 50;
.maxpoints = 300;
.online_time = 3600; // One hour = 3600 seconds
bindatcmd "mileage", "hourlypoints::OnAtCommand", 0, 99;
end;
OnPCLoginEvent:
if (BaseLevel < .level){
dispbottom "You must be level 50 above to start the Mileage points system.",0xFFFF00;
showscript "You must be level 50 above to start the Mileage points system.";
#idle = 1;
}
if (#TIMEPOINTS >= .maxpoints){
#idle = 1;
showscript "You have reached the maximum mileage 300 points, please spend your points to earn again.";
}
if (#vendmode >= 1){
#idle = 1;
sleep2 2000;
#idle = 0;
#vendmode = 0;
}
if (BaseLevel >= .level)
{
if (countitem(408) >= 1){
showscript "Premium Mileage points system has started. x2 Mileage Points per hour.";
dispbottom "Premium Mileage points system has started. x2 Mileage Points per hour.",0xFFFFFF;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFFFF;
} else {
showscript "Normal Mileage points system started. x1 Mileage Point per hour";
dispbottom "Normal Mileage points system started. x1 Mileage Point per hour",0xFFFFFF;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFFFF;
}
#idle = 0;
@backup_time = 0;
if (!#acctick || #acctick > .online_time)
#acctick = gettimetick(2) + .online_time;
else
#acctick += gettimetick(2);
while(.enable)
{
//@idle_time = checkidle();
//if (checkvending() >= 1 || checkchatting() == 1 || @idle_time >= .dlimit)
//if (checkvending() >= 1)
if (Class == Job_Novice || #TIMEPOINTS >= .maxpoints || checkvending() >= 1 )
//if (Class == Job_Novice || #TIMEPOINTS >= .maxpoints )
//if (Class == Job_Ninja)
{
#acctick += @idle_time; // Add idle time
#idle = 1;
if (checkvending() >= 1) {
showscript "Mileage point system has been stopped.";
dispbottom "Vending will stop the mileage system.",0xEE4B2B;
dispbottom "Please re-login to start the system again.",0xFFFFFF;
}
if (Class == Job_Novice) {
showscript "Mileage point system has been stopped.";
dispbottom "The Mileage points system has been stopped because you are still a Novice and you must be level 50 with Job Class.",0xEE4B2B;
dispbottom "Please re-login if you changed class to start the system again.",0xFFFFFF;
}
if (#TIMEPOINTS >= .maxpoints) {
showscript "Mileage point system has been stopped.";
dispbottom "Mileage point system has been stopped.",0xEE4B2B;
sleep2 1000;
dispbottom "You've reached the maximum " +.maxpoints+ " mileage points.",0x00ff00;
sleep2 1000;
dispbottom "Spend your points to start collecting points again.",0x00ff00;
sleep2 500;
dispbottom "Please re-login if you spent points to start the system again.",0xFFFFFF;
}
}
else
{
sleep2 1000;
@backup_time = .@time_left = #acctick - gettimetick(2);
if (.@time_left <= 0) {
if (countitem(408) >= 1){
#TIMEPOINTS += .point_amt_vip;
#acctick = gettimetick(2) + .online_time;
showscript "[Premium Mileage] - Gained " + .point_amt_vip + " " + .point_name$ + ". Total " + #TIMEPOINTS + " points.";
dispbottom "[Premium Mileage] - Gained " + .point_amt_vip + " " + .point_name$ + ". Total " + #TIMEPOINTS + " points.",0xFFFFFF;
}
if (countitem(408) >= 1) goto TIME;
#TIMEPOINTS += .point_amt;
#acctick = gettimetick(2) + .online_time;
showscript "[Normal Mileage] - Gained " + .point_amt + " " + .point_name$ + ". Total " + #TIMEPOINTS + " points.";
dispbottom "[Normal Mileage] - Gained " + .point_amt + " " + .point_name$ + ". Total " + #TIMEPOINTS + " points.",0xFFFFFF;
} else {
TIME:
.@time_left = .online_time - .@time_left;
.@Time$ = "";
.@Minutes = .@time_left / 60;
.@time_left -= (.@Minutes * 60);
if (.@Minutes > 1)
.@Time$ += .@Minutes + " minutes, ";
else if (.@Minutes > 0)
.@Time$ += .@Minutes + " minute, ";
if (.@time_left > 1 || .@time_left == 0)
.@Time$ += .@time_left + " seconds";
else if (.@time_left == 1)
.@Time$ += .@time_left + " second";
if (.@Minutes == 15 && .@time_left == 0 || .@Minutes == 30 && .@time_left == 0 || .@Minutes == 45 && .@time_left == 0)
dispbottom "You spend a total of [" + .@Time$ + "] playing.",0xFFFFFF;
}
}
if (#idle)
break;
}
}
end;
OnPCLogoutEvent:
// BackUP online time
if (BaseLevel >= .level)
{
if (@backup_time)
#acctick = @backup_time;
}
end;
OnAtCommand:
if (BaseLevel >= .level)
{
if (#idle)
{
.@Time$ = "";
.@Minutes = @idle_time / 60;
.@time_left = @idle_time - (.@Minutes * 60);
if (.@Minutes > 1)
.@Time$ += .@Minutes + " minutes, ";
else if (.@Minutes > 0)
.@Time$ += .@Minutes + " minute, ";
if (.@time_left > 1 || .@time_left == 0)
.@Time$ += .@time_left + " seconds";
else if (.@time_left == 1)
.@Time$ += .@time_left + " second";
//dispbottom "You been idle for " + .@Time$ + ". Please relog again.",0xFFFF00;
dispbottom "Mileage point system has been stopped.",0xEE4B2B;
sleep2 1000;
dispbottom "It's either you reached the maximum " +.maxpoints+ " points.",0x00ff00;
sleep2 1000;
dispbottom "Vending mode",0x00ff00;
sleep2 1000;
dispbottom "Or your are still a novice and need to change class.",0x00ff00;
sleep2 1000;
dispbottom "One more thing is you need to be level 50+ to start the Mileage System",0x00ff00;
sleep2 1000;
dispbottom "You have a total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
sleep2 500;
dispbottom "Please re-login if you spent points, changed to 1st class, or reached level 50+ to start the system again.",0xFFFFFF;
goto MILEAGE;
}
else
{
.@time_left = @backup_time;
.@Time$ = "";
.@Minutes = .@time_left / 60;
.@time_left -= (.@Minutes * 60);
if (.@Minutes > 1)
.@Time$ += .@Minutes + " minutes, ";
else if (.@Minutes > 0)
.@Time$ += .@Minutes + " minute, ";
if (.@time_left > 1 || .@time_left == 0)
.@Time$ += .@time_left + " seconds";
else if (.@time_left == 1)
.@Time$ += .@time_left + " second";
//dispbottom "You have [" + .@Time$ + "] left in able to gain a Mileage points.",0xFFFF00;
//dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
MILEAGE:
mes "[Mileage System]";
mes "Greetings Adventurer";
mes "What do you want to do?";
switch (select("- How's Mileage system work?","- Check time and points","- Exchange Points to Mileage Coupon")) {
case 1:
next;
mes "[Mileage System]";
mes "You can activate the system if you mee the following requirements:";
mes "^ff0000Base Level 50+^000000";
mes "^ff0000Must be 1-1, 2-1, 2-2 Class^000000";
next;
mes "[Mileage System]";
mes "^0000ffOne mileage point^000000 is automatically accumulated every hour for the character who activated the system.";
next;
mes "[Mileage System]";
mes "^0000ffTwo mileage point^000000 will be accumulated every if the user is a premium member.";
next;
mes "[Mileage System]";
mes "Mileage can be accumulated only upto 300 points.";
next;
mes "[Mileage System]";
mes "Through mileage system you can exchange your points into Mileage Coupons to buy headgears and other stuff at the Mileage Shop!";
next;
mes "[Mileage System]";
mes "Exchange ratio is 5:1";
mes "5 Points = 1 Mileage Coupon";
next;
mes "[Mileage System]";
mes "Mileage system ^ff0000will stop^000000 if you";
mes "are in ^ff0000Vending Mode^000000 or ";
mes "^ff0000Reached 300 mileage points^000000";
close;
case 2:
next;
mes "[Mileage System]";
mes "You have ^0000ff[" + .@Time$ + "]^000000 left in able to gain a Mileage points.";
mes "Total ^ff0000" + #TIMEPOINTS + "^000000. Mileage points";
mes "^008000Normal^000000: 1 point per hour";
mes "^FFC300Premium^000000: 2 points per hour";
close;
case 3:
next;
//mes "[Mileage System]";
if(#TIMEPOINTS >= 0 ) {
mes "[Mileage System]";
mes "How many points";
mes "Exchange ratio is ^0000ff5:1^000000";
mes "do you want to exchange?";
next;
mes "[Mileage System]";
mes "Select an option to exchange";
mes "Total ^ff0000" + #TIMEPOINTS + "^000000. Mileage points";
next;
switch (select("5 Points > 1 Mileage Coupon","50 Points > 10 Mileage Coupons","100 Points > 20 Mileage Coupons","200 Points > 40 Mileage Coupons","300 Points > 60 Mileage Coupons")) {
case 1:
mes "[Mileage System]";
mes "So you want to exchange";
mes "5 Points into 1 Coupon";
next;
switch (select("Yes","No")) {
case 1:
mes "[Mileage System]";
if(#TIMEPOINTS < 5) {
//mes "[Mileage System]";
mes "I'm sorry but you don't have enough points to exchange.";
mes "You currently have " + #TIMEPOINTS + " Points.";
close;
}
#TIMEPOINTS -= 5;
getitem 456,1;
mes "Okay you can use the Mileage Coupon at the Mileage Coupon Exchanger.";
dispbottom "-5 Mileage points.",0xFF0000;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
close;
case 2:
close;
}
case 2:
mes "[Mileage System]";
mes "So you want to exchange";
mes "50 Points into 10 Coupons";
next;
switch (select("Yes","No")) {
case 1:
mes "[Mileage System]";
if(#TIMEPOINTS < 50) {
//mes "[Mileage System]";
mes "I'm sorry but you don't have enough points to exchange.";
mes "You currently have " + #TIMEPOINTS + " Points.";
close;
}
#TIMEPOINTS -= 50;
getitem 456,10;
mes "Okay you can use the Mileage Coupon at the Mileage Coupon Exchanger.";
dispbottom "-50 Mileage points.",0xFF0000;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
close;
case 2:
close;
}
case 3:
mes "[Mileage System]";
mes "So you want to exchange";
mes "100 Points into 20 Coupons";
next;
switch (select("Yes","No")) {
case 1:
mes "[Mileage System]";
if(#TIMEPOINTS < 100) {
//mes "[Mileage System]";
mes "I'm sorry but you don't have enough points to exchange.";
mes "You currently have " + #TIMEPOINTS + " Points.";
close;
}
#TIMEPOINTS -= 100;
getitem 456,20;
mes "Okay you can use the Mileage Coupon at the Mileage Coupon Exchanger.";
dispbottom "-100 Mileage points.",0xFF0000;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
close;
case 2:
close;
}
case 4:
mes "[Mileage System]";
mes "So you want to exchange";
mes "200 Points into 40 Coupons";
next;
switch (select("Yes","No")) {
case 1:
mes "[Mileage System]";
if(#TIMEPOINTS < 200) {
//mes "[Mileage System]";
mes "I'm sorry but you don't have enough points to exchange.";
mes "You currently have " + #TIMEPOINTS + " Points.";
close;
}
#TIMEPOINTS -= 200;
getitem 456,40;
mes "Okay you can use the Mileage Coupon at the Mileage Coupon Exchanger.";
dispbottom "-200 Mileage points.",0xFF0000;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
close;
case 2:
close;
}
case 5:
mes "[Mileage System]";
mes "So you want to exchange";
mes "300 Points into 60 Coupons";
next;
switch (select("Yes","No")) {
case 1:
mes "[Mileage System]";
if(#TIMEPOINTS < 300) {
//mes "[Mileage System]";
mes "I'm sorry but you don't have enough points to exchange.";
mes "You currently have " + #TIMEPOINTS + " Points.";
close;
}
#TIMEPOINTS -= 300;
getitem 456,60;
mes "Okay you can use the Mileage Coupon at the Mileage Coupon Exchanger.";
dispbottom "-300 Mileage points.",0xFF0000;
dispbottom "Total " + #TIMEPOINTS + " Mileage points.",0xFFFF00;
close;
case 2:
close;
}
}
}
}
}
}
end;
}