summaryrefslogtreecommitdiff
path: root/npc/annuals/xmas/helpers.txt
blob: 28d5e6502716b8d63c61254cf96631d5072737eb (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
function	script	XmasHelperPoints	{
    @xmas_helper_count = 0;
    @xmas_helper_loop = 0;
    if((@xmas_helper_done_state) || !(@xmas_helper_start_state))
        goto L_Return;
    goto L_Loop;

L_Loop:
    if(XMASTIME & $@xmas_helper_list[@xmas_helper_loop])
        goto L_AddOne;
    goto L_LoopAgain;

L_AddOne:
    @xmas_helper_count = (@xmas_helper_count + 1);
    goto L_LoopAgain;

L_LoopAgain:
    if((@xmas_helper_loop + 1) == getarraysize($@xmas_helper_list))
        goto L_HelperTally;
    @xmas_helper_loop = (@xmas_helper_loop + 1);
    goto L_Loop;

L_HelperTally:
    if(@xmas_helper_count == $@xmas_perfect_helpers_count)
        goto L_PerfectHelpers;
    if(@xmas_helper_count > $@xmas_required_helpers_count)
        goto L_SetHelperState;
    goto L_Return;

L_PerfectHelpers:
    XMASTIME = XMASTIME | $@xmas_all_helpers_bit;
    goto L_SetHelperState;

L_SetHelperState:
    @xmas_state = $@xmas_helpers_done_state;
    callfunc "XmasSetState";
    goto L_Return;

L_Return:
    @xmas_helper_count = 0;
    @xmas_helper_loop = 0;
    return;
}