//https://upaste.me/a34345394862f242d
//https://rathena.org/board/topic/110562-woe-countdown-timer/
//Skormie's WOE Waitingroom Timer v1.02
//Should natively work with Euphy's WOE Controller.
prontera,150,150,5 script Woe Time 100,{
end;
OnInit:
function s;
function woe_update;
.@Euphy_Len = getarraysize( $WOE_CONTROL );
if( .@Euphy_Len ) {
for( .@i = 0; .@i < .@Euphy_Len; .@i += 4 ) {
.woe_day[ getarraysize( .woe_day ) ] = $WOE_CONTROL[.@i];
.woe_hour[ getarraysize( .woe_hour ) ] = $WOE_CONTROL[.@i+1];
}
} else {
setarray .woe_day, 5, 4; //Day of the week WOE Starts on. (0 for Sunday, 6 is Saturday)
setarray .woe_hour, 16, 20; //rAthena works on a 24 hour clock.
}
woe_update();
while ( 1 ) {
.@woe_tick = .woe_time[.current] - gettimetick(2);
.@day = .@woe_tick / 86400;
.@hour = .@woe_tick % 86400 / 3600;
.@min = .@woe_tick % 3600 / 60;
.@sec = .@woe_tick % 60;
.@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) +
( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) +
( .@min ? .@min +" minute"+ s( .@min ) : "" ) +
( .@sec ? .@sec +" second"+ s( .@sec, 1 ) : "" );
delwaitingroom strnpcinfo(0);
waitingroom agitcheck() ? "WOE is Active!" : .@mes$, 0;
sleep 1000;
}
end;
OnAgitEnd:
woe_update();
end;
function s {
return ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " );
}
function woe_update {
.@woe_len = getarraysize( .woe_day );
for( .@a = 0; .@a < .@woe_len; .@a++ ) {
.@woe_day[.@a] = ( .woe_day[.@a] - gettime(4) + 7 ) % 7 * 86400;
.@woe_hour[.@a] = ( .woe_hour[.@a] * 3600 ) - gettimetick(1);
.woe_time[.@a] = gettimetick(2) + .@woe_day[.@a] + .@woe_hour[.@a];
if(gettimetick(2) > .woe_time[.@a])
.woe_time[.@a] = .woe_time[.@a] + 7 * 86400;
if( .woe_time[.@a] <= .woe_time[.current] )
.current = .@a;
}
}
}