summaryrefslogtreecommitdiff
path: root/world/map/npc/annuals/xmas/reagents.txt
blob: 4adcaf12abf3744b0c4d2dad41df2c7e49dfc9d0 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// This file is part of Christmas Event
// author: Jenalya, Chayenne, cinderweb, wushin
// please see #XmasConfig

function|script|CheckReagents
{
    set @xmas_reagent_loop, 0;
    if((@xmas_reagent_done_state) || !(@xmas_reagent_start_state))
        goto L_Return;
    if(@xmas_side)
        goto L_OneLoop;
    goto L_ZeroLoop;

L_ZeroLoop:
    if(countitem($@xmas_zero_reagents$[@xmas_reagent_loop]) >= $@xmas_zero_reagents_amounts[@xmas_reagent_loop])
        goto L_ZeroLoopAgain;
    goto L_Return;

L_ZeroLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$))
        goto L_AllReagents;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_ZeroLoop;

L_OneLoop:
    if(countitem($@xmas_one_reagents$[@xmas_reagent_loop]) >= $@xmas_one_reagents_amounts[@xmas_reagent_loop])
        goto L_OneLoopAgain;
    goto L_Return;

L_OneLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$))
        goto L_AllReagents;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_OneLoop;

L_AllReagents:
    set @xmas_state, $@xmas_reagents_done;
    callfunc "XmasSetState";
    goto L_Return;

L_Return:
    return;
}

function|script|DeleteReagents
{
    set @xmas_reagent_loop, 0;
    if(@xmas_side)
        goto L_OneLoop;
    goto L_ZeroLoop;

L_ZeroLoop:
    delitem $@xmas_zero_reagents$[@xmas_reagent_loop], $@xmas_zero_reagents_amounts[@xmas_reagent_loop];
    goto L_ZeroLoopAgain;

L_ZeroLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$))
        goto L_Return;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_ZeroLoop;

L_OneLoop:
    delitem $@xmas_one_reagents$[@xmas_reagent_loop], $@xmas_one_reagents_amounts[@xmas_reagent_loop];
    goto L_OneLoopAgain;

L_OneLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$))
        goto L_Return;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_OneLoop;

L_Return:
    return;
}

function|script|ListReagents
{
    set @xmas_reagent_loop, 0;
    mes "\"I'm going to need \"";
    next;

    if(@xmas_side)
        goto L_OneLoop;
    goto L_ZeroLoop;

L_ZeroLoop:
    mes "\"" + $@xmas_zero_reagents_amounts[@xmas_reagent_loop] + " " + $@xmas_zero_reagents_names$[@xmas_reagent_loop] + "\"";
    next;
    goto L_ZeroLoopAgain;

L_ZeroLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$))
        goto L_AllReagents;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_ZeroLoop;

L_OneLoop:
    mes "\"" + $@xmas_one_reagents_amounts[@xmas_reagent_loop] + " " + $@xmas_one_reagents_names$[@xmas_reagent_loop] + "\"";
    next;
    goto L_OneLoopAgain;

L_OneLoopAgain:
    if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$))
        goto L_AllReagents;
    set @xmas_reagent_loop, (@xmas_reagent_loop + 1);
    goto L_OneLoop;

L_AllReagents:
    return;
}

function|script|BadPowderMake
{
    if(countitem("PileOfAsh") < ($@xmas_red_amount + $@xmas_yellow_amount))
        goto L_NotEnough;
    if(countitem("RedDye") < $@xmas_red_amount)
        goto L_NotEnough;
    if(countitem("YellowDye") < $@xmas_yellow_amount)
        goto L_NotEnough;
    getinventorylist;
    if (@inventorylist_count > 100)
        goto L_FullInv;
    goto L_MakePowder;

L_MakePowder:
    delitem "PileOfAsh", ($@xmas_red_amount + $@xmas_yellow_amount);
    delitem "RedDye", $@xmas_red_amount;
    delitem "YellowDye", $@xmas_yellow_amount;
    getitem "RedPowder", $@xmas_red_amount;
    getitem "YellowPowder", $@xmas_yellow_amount;
    mes "\"Here is your powder, now move!\"";
    goto L_Return;

L_FullInv:
    mes "\"... Excuse me but where did you expect you were going to hold these powders...\"";
    mes "\"WAIT! no, I don't want to know. Just come back when you have some room.\"";
    goto L_Return;

L_NotEnough:
    mes "\"You don't have enough of eagents to make the powders.\"";
    mes "\"To replace the glitter we will need get " + ($@xmas_red_amount + $@xmas_yellow_amount) + " Piles of Ash, " + $@xmas_red_amount + " Red Dyes and " + $@xmas_yellow_amount + " Yellow Dyes\"";
    goto L_Return;

L_Return:
    return;
}