summaryrefslogtreecommitdiff
path: root/world/map/npc/018-2/miners.txt
blob: 59e9729789fe33c54a0107b297cc61b66bdb031e (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// This NPC makes gem powders out of gemstones
// Authors: Ali-G, enchilado, Jenalya

018-2.gat,85,23,0|script|Malek|109,
{
    callfunc "ClearVariables";

    set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);

    set @MIN_GEM_AMOUNT, 7;

    if (@inspector == 10) goto L_NohMask;

    mes "[Malek]";
    mes "\"Hi, can I help you at all?\"";
    menu
        "I'm looking for someone able to make gem powder.", L_GemPowder,
        "I was just having a look, have a nice day.", L_Close;

L_NohMask:
    mes "[Malek]";
    mes "\"Hi, can I help you at all?\"";
    menu
        "I'm looking for someone able to make gem powder.", L_GemPowder,
        "I was just having a look, have a nice day.", L_Close,
        "The inspector sent me here to investigate.", L_Investigation;

L_Investigation:
    set @inspector, 11;
    set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
    mes "\"Yeah, we did hear a commotion. We thought we heard someone go down to the basement, but we checked the whole place over and didn't see anything out of the ordinary.\"";
    goto L_Close;

L_GemPowder:
    mes "[Malek]";
    mes "\"My father taught me how to make that sort of powder. Put the gem on a firm surface, hold your pickaxe tight and whack that gem hard. It'll be crushed into powder pretty soon if you keep at it.\"";
    mes "\"Do you want me to make any for you?\"";
    menu
        "Yes, I really need some.", L_GemPowderStart,
        "Actually, I don't want anything. Have a nice day.", L_Close;

L_GemPowderStart:
    mes "[Malek]";
    mes "\"Well, I can do that. Bring me a gem and I'll make you some powder - hope you don't mind if I keep a little as payment!\"";
    menu
        "I've got some gems.", L_Check_Gems,
        "I'll be back with a gem soon.", L_Close,
        "Actually, I prefer my gems whole. Thanks anyway.", L_Close;

L_Check_Gems:
    mes "[Malek]";
    mes "\"Which gem do you want me to powder for you?\"";
    next;
    setarray @menuitems$, "", "", "", "", "", "", "";
    set @c, 0;
    goto L_Check_Diamond;

L_Check_Diamond:
    if (countitem("Diamond") < 1)
        goto L_Check_Ruby;
    set @menuitems$[@c], "A diamond.";
    set @menuid[@c], 0;
    set @c, @c + 1;
    goto L_Check_Ruby;

L_Check_Ruby:
    if (countitem("Ruby") < 1)
        goto L_Check_Emerald;
    set @menuitems$[@c], "A ruby.";
    set @menuid[@c], 1;
    set @c, @c + 1;
    goto L_Check_Emerald;

L_Check_Emerald:
    if (countitem("Emerald") < 1)
        goto L_Check_Sapphire;
    set @menuitems$[@c], "An emerald.";
    set @menuid[@c], 2;
    set @c, @c + 1;
    goto L_Check_Sapphire;

L_Check_Sapphire:
    if (countitem("Sapphire") < 1)
        goto L_Check_Topaz;
    set @menuitems$[@c], "A sapphire.";
    set @menuid[@c], 3;
    set @c, @c + 1;
    goto L_Check_Topaz;

L_Check_Topaz:
    if (countitem("Topaz") < 1)
        goto L_Check_Amethyst;
    set @menuitems$[@c], "A topaz.";
    set @menuid[@c], 4;
    set @c, @c + 1;
    goto L_Check_Amethyst;

L_Check_Amethyst:
    if (countitem("Amethyst") < 1)
        goto L_Choose_Gem;
    set @menuitems$[@c], "An amethyst.";
    set @menuid[@c], 5;
    set @c, @c + 1;
    goto L_Choose_Gem;

L_Choose_Gem:
    set @menuitems$[@c], "None right now, thanks.";
    set @menuid[@c], 6;
    set @c, @c + 1;
    menu
        @menuitems$[0], L_MenuItems,
        @menuitems$[1], L_MenuItems,
        @menuitems$[2], L_MenuItems,
        @menuitems$[3], L_MenuItems,
        @menuitems$[4], L_MenuItems,
        @menuitems$[5], L_MenuItems,
        @menuitems$[6], L_MenuItems;

L_MenuItems:
    set @menu, @menu - 1;
    if (@menu >= @c)
        goto L_Close;
    if (@menuid[@menu] == 0)
        set @gem$, "Diamond";
    if (@menuid[@menu] == 1)
        set @gem$, "Ruby";
    if (@menuid[@menu] == 2)
        set @gem$, "Emerald";
    if (@menuid[@menu] == 3)
        set @gem$, "Sapphire";
    if (@menuid[@menu] == 4)
        set @gem$, "Topaz";
    if (@menuid[@menu] == 5)
        set @gem$, "Amethyst";
    if (@menuid[@menu] == 6)
        goto L_Close;

    getinventorylist;
    if (countitem(@gem$) < 1)
        goto L_no_gem;
    if (@inventorylist_count == 100
        && countitem(@gem$) > 1)
            goto L_TooMany;
    delitem @gem$, 1;
    if (@gem$ == "Diamond")
        getitem "DiamondPowder", @MIN_GEM_AMOUNT + rand(6);
    if (@gem$ == "Ruby")
        getitem "RubyPowder", @MIN_GEM_AMOUNT + rand(6);
    if (@gem$ == "Emerald")
        getitem "EmeraldPowder", @MIN_GEM_AMOUNT + rand(6);
    if (@gem$ == "Sapphire")
        getitem "SapphirePowder", @MIN_GEM_AMOUNT + rand(6);
    if (@gem$ == "Topaz")
        getitem "TopazPowder", @MIN_GEM_AMOUNT + rand(6);
    if (@gem$ == "Amethyst")
        getitem "AmethystPowder", @MIN_GEM_AMOUNT + rand(6);

    mes "[Malek]";
    mes "\"Here's your powder. Hope it's fine enough for you.\"";
    mes "\"Do you need me to make any more?\"";
    menu
        "Yes please.", L_Check_Gems,
        "No thank you, this is enough.", L_Close;

L_TooMany:
    mes "[Malek]";
    mes "\"Doesn't look like you've got room for this powder. Come back when you do.\"";
    goto L_Close;

L_no_gem:
    mes "[Malek]";
    mes "\"You don't have that gem.\"";
    goto L_Close;

L_Close:
    set @inspector, 0;
    close;
}