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

002-2,72,92,0|script|Candide|156
{
    mes "[Candide]";
    mes "\"Greetings! I am Candide the Bleacher.";
    mes "Tulimshar is my homeland, where I learned the ancient art of bleaching.\"";
    next;
    mes "\"Bleaching was originally done by the sun, but now we use ash combined with special ingredients to remove color from fabric.\"";
    next;
    menu
        "What is needed for the bleaching process?", L_Materials,
        "I'd like to bleach something.", L_bleach_menu,
        "So long.", L_Close;

L_Materials:
    mes "[Candide]";
    mes "\"For each item, I will need 3 piles of ash and 5,000 GP for the special ingredients.\"";
    next;
    menu
        "I'd like to bleach something.", L_bleach_menu,
        "So long.", L_Close;

L_bleach_menu:
    if (countitem("PileOfAsh") < 3) goto L_no_ash;
    if (Zeny < 5000) goto L_no_money;
    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;
    if(@CANDIDE_menu$[0] == "") goto L_Nothing;
    mes "[Candide]";
    mes "\"Yes?\"";
    next;
    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_Nothing:
    mes "[Candide]";
    mes "\"Sorry, you have nothing to bleach.\"";
    next;
    goto L_Close;

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.\"";
    next;
    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.\"";
    next;
    goto L_Close;

L_Close:
    mes "[Candide]";
    mes "\"Come again.\"";
    close2;
    emotion EMOTE_GRIN, strcharinfo(0);
    end;
}