summaryrefslogtreecommitdiff
path: root/world/map/npc/002-2/bleacher.txt
blob: 68bad782efbb645b1146fb0a8a64d85402bb7c34 (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
// IMPORTANT: add your items to DyeConfig, do not edit Candide

002-2,72,92,0|script|Candide|156
{
    mes "[Candide]";
    mes "\"I've figured out how that volcanic ash bleaches cloth.";
    mes "I could do it for you, but I'll need three piles of ash and 5,000 GP for supplies per item.\"";
    next;
    if (countitem("PileOfAsh") < 3) goto L_no_ash;
    if (Zeny < 5000) goto L_no_money;
    menu
        "I'd like to bleach something.", L_bleach_menu,
        "No thanks.", L_Close;

L_bleach_menu:
    cleararray @CANDIDE_items,0,getarraysize(@CANDIDE_items);
    cleararray @CANDIDE_color,0,getarraysize(@CANDIDE_color);
    cleararray @CANDIDE_menu$,"",getarraysize(@CANDIDE_menu$);
    set @w, 0;
    freeloop 1; // do not check for infinity loop
    callsub S_LoopArray;
    freeloop 0; // re-enable infinity loop check
    set @w, 0;
    set @c, 0;
    set @p, 0;
    menu
        "Nevermind.", L_Close,
        @CANDIDE_menu$[0], L_MenuItems, // base array was too big for a dynamic menu so we can't use it
        @CANDIDE_menu$[1], L_MenuItems,
        @CANDIDE_menu$[2], L_MenuItems,
        @CANDIDE_menu$[3], L_MenuItems,
        @CANDIDE_menu$[4], L_MenuItems,
        @CANDIDE_menu$[5], L_MenuItems,
        @CANDIDE_menu$[6], L_MenuItems,
        @CANDIDE_menu$[7], L_MenuItems,
        @CANDIDE_menu$[8], L_MenuItems,
        @CANDIDE_menu$[9], L_MenuItems,
        @CANDIDE_menu$[10], L_MenuItems,
        @CANDIDE_menu$[11], L_MenuItems,
        @CANDIDE_menu$[12], L_MenuItems,
        @CANDIDE_menu$[13], L_MenuItems,
        @CANDIDE_menu$[14], L_MenuItems,
        @CANDIDE_menu$[15], L_MenuItems,
        @CANDIDE_menu$[16], L_MenuItems,
        @CANDIDE_menu$[17], L_MenuItems;

S_LoopArray:
    set @c, 0;
    callsub S_LoopColor;
    set @w, @w + 1;
    if(@w < getarraysize($@DYE_items$)) goto S_LoopArray;
    return;

S_LoopColor:
    if(countitem($@DYE_colors$[@c] + $@DYE_items$[@w]) > 0)
        goto L_AddToMenu;
    goto L_LoopColor2;

L_AddToMenu:
    set @CANDIDE_items[@p], @w;
    set @CANDIDE_color[@p], @c;
    set @CANDIDE_menu$[@p], $@DYE_color_names$[@c]+" "+$@DYE_item_names$[@w];
    set @p, @p + 1;
    goto L_LoopColor2;

L_LoopColor2:
    set @c, @c + 1;
    if(@c < getarraysize($@DYE_colors$)) goto S_LoopColor;
    return;

L_MenuItems:
    if (countitem("PileOfAsh") < 3) goto L_no_ash;
    if (Zeny < 5000) goto L_no_money;
    set @m, @menu - 2;
    set @it$, $@DYE_colors$[@CANDIDE_color[@m]] + $@DYE_items$[@CANDIDE_items[@m]];
    if(getitemname(@it$) == "Unknown Item") mapexit;
    delitem @it$, 1;
    delitem "PileOfAsh", 3;
    set Zeny, Zeny - 5000;
    getitem $@DYE_items$[@CANDIDE_items[@m]], 1;
    goto L_again;

L_again:
    mes "[Candide]";
    mes "\"Would you like to bleach something else?\"";
    next;
    menu
        "Yes.", L_bleach_menu,
        "No.", L_Close;

L_no_ash:
    mes "[Candide]";
    mes "\"You don't have enough ash for me to bleach anything.";
    mes "I need three piles.\"";
    goto L_Close;

L_no_money:
    mes "[Candide]";
    mes "\"You don't have enough gold for me to bleach anything.";
    mes "I need 5,000 GP for supplies.\"";
    goto L_Close;

L_Close:
    mes "[Candide]";
    mes "\"Come again.\"";
    close;
}