summaryrefslogtreecommitdiff
path: root/npc/annuals/check_time.txt
blob: 74980e9c1f3f4d0a175184bc309ed7bfe2a3dd91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function	script	GetEventTime	{
    $@month = gettime(6);
    $@day = gettime(5);

    if ($@start_month > $@end_month)
        goto L_YearWrap;
    goto L_Normal;

L_Normal:
    if(($@month < $@start_month)
        || ($@month == $@start_month && $@day < $@start_day))
        goto L_NoEventTime;
    if(($@month > $@end_month)
        || ($@month == $@end_month && $@day > $@end_day))
        goto L_NoEventTime;
    if(($@month > $@reward_start_month)
        || ($@month == $@reward_start_month && $@day >= $@reward_start_day))
        goto L_RewardTime;
    goto L_EventTime;

L_YearWrap:
    if(($@month == $@reward_start_month && $@day >= $@reward_start_day
            && ($@day <= $@end_day && $@reward_start_month == $@end_month
                || !($@reward_start_month == $@end_month)))
        || ($@month == $@end_month && $@day <= $@end_day
            && ($@day >= $@reward_start_day && $@reward_start_month == $@end_month
                || !($@reward_start_month == $@end_month)))
        || ($@month < $@end_month && $@month > $@reward_start_month))
        goto L_RewardTime;
    if(($@month >= $@start_month) || ($@month <= $@end_month && $@day <= $@reward_start_day))
        goto L_EventTime;
    goto L_NoEventTime;

L_NoEventTime:
    $@event_time = 0;
    return;

L_EventTime:
    $@event_time = 1;
    return;

L_RewardTime:
    $@event_time = 2;
    return;
}