summaryrefslogtreecommitdiff
path: root/world/map/npc/009-2/nicholas.txt
blob: 568f9a71efece8c12467058df1ea9c54c006a043 (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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
//#################################################################################
//#
//# Nicholas the Smith.
//# Participates in iron ore smithery and the following quests:
//# - Together with Pachua: Iron Shield quest (repeatable)
//#    (6 iron ingots, 2 infantry helmets, 20000 GP, leather patch) -> iron shield
//# - Primary participant in the Setzer quest (monster oil/golden stinger subquests)
//#
//# Variables used:  @QUEST_Forestbow_state, nibble 3 (setzer quest)
//#                  @QUEST_Forestbow_state, nibble 4 (iron shield quest)
//#
//#################################################################################

009-2.gat,185,55,0|script|Nicholas|135
{
    set @SETZER_XP, 100000;
    set @SHIELD_XP, 20000;

    set @SHIELD_INITIAL, 0;
    set @SHIELD_KNOWS_PATCH, 1; // knows that a leather patch is needed
    set @SHIELD_COMPLETED, 2; // shield completed once

    set @SETZER_INITIAL, 0;
    set @SETZER_KNOWS_OIL, 1;
    set @SETZER_KNOWS_STINGER, 2;
    set @SETZER_FLAG_MADE_OIL, 4;
    set @SETZER_FLAG_MADE_SETZER, 8;

    set @Q_SETZER_MASK, NIBBLE_3_MASK;
    set @Q_SETZER_SHIFT, NIBBLE_3_SHIFT;

    set @Q_SHIELD_MASK, NIBBLE_4_MASK;
    set @Q_SHIELD_SHIFT, NIBBLE_4_SHIFT;

    set @Q_SETZER_status, (QUEST_Forestbow_state & @Q_SETZER_MASK) >> @Q_SETZER_SHIFT;
    set @Q_SHIELD_status, (QUEST_Forestbow_state & @Q_SHIELD_MASK) >> @Q_SHIELD_SHIFT;

    mes "[Nicholas]";
    mes "\"Hello, there!  I'm an expert blacksmith. If you get me some Coal and Iron Ingots, I could make you a very valuable shield or helmet.\"";
    next;
    menu
        "I have Iron Ingots!", L_Check,
        "Where can I get Coal and Iron Ingots?", L_Info,
        "I'm okay, thanks.", L_Pass;

L_Check:
    mes "[Nicholas]";
    mes "\"Let me take a look at how much you have...\"";
    next;
    if ( (countitem("IronIngot")<3) || (countitem("Coal") < 6) )
        goto L_NoItem;
    if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
        goto L_StageA;
    if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
        goto L_StageB;
    goto L_StageC;

L_Info:
    mes "[Nicholas]";
    mes "\"You can find Coal and Iron Ore in mines. Once you have Coal and Iron Ore, find a smith that will smelt the Iron Ore and cast them into Iron Ingots.\"";
    next;
    mes "[Nicholas]";
    mes "\"Come back here with some Coal and Iron Ingots, and I'll make something nice for you.\"";
    close;

L_Pass:
    mes "[Nicholas]";
    mes "\"Oh, okay. Come back any time.\"";
    close;

L_StageA:
    mes "[Nicholas]";
    mes "\"That's just enough for me to make you a winged Knight's Helmet, but it'll cost you 10,000GP, 6 Coal and 3 Iron Ingots.\"";
    next;
    goto L_main_menu;

L_StageB:
    mes "[Nicholas]";
    mes "\"Ahh, with that much Coal and Iron Ingots I can make you one of two helmets, for only 10,000GP, or I can make you a shield, for 20,000GP.\"";
    mes "";
    mes "\"What would you like?\"";
    next;
    goto L_main_menu;

L_StageC:
    mes "[Nicholas]";
    mes "\"Excellent, that's enough to make three different types of helmet. My fee is 10,000GP. I can also make a shield, but that will cost you 20,000 GP.\"";
    mes "";
    mes "\"Which will it be?\"";
    next;
    goto L_main_menu;

L_main_menu:

    set @CHOICE_KNIGHT, 1;
    set @CHOICE_CRUSADE, 2;
    set @CHOICE_WARLORD, 3;
    set @CHOICE_SHIELD, 4;
    set @CHOICE_SETZER, 5;
    set @CHOICE_CANCEL, 6;

    setarray @choice$, "", "", "", "", "", "";
    set @choices_nr, 0;
    setarray @choice_idx, 0, 0, 0, 0, 0, 0;

    if (countitem("ShortSword") < 1)
        goto L_main_menu_post_setzer;
    set @choice$[@choices_nr], "Can you make my Short Sword better?";
    set @choice_idx[@choices_nr], @CHOICE_SETZER;
    set @choices_nr, 1 + @choices_nr;
    goto L_main_menu_post_setzer;

L_main_menu_post_setzer:

    if ( (countitem("IronIngot")<3) || (countitem("Coal") <6) )
        goto L_no_more_helmets;
    set @choice$[@choices_nr], "Knight's Helmet (3 Iron Ingots & 6 Coal).";
    set @choice_idx[@choices_nr], @CHOICE_KNIGHT;
    set @choices_nr, 1 + @choices_nr;

    if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
        goto L_no_more_helmets;
    set @choice$[@choices_nr], "Crusade Helmet (6 Iron Ingots & 12 Coal).";
    set @choice_idx[@choices_nr], @CHOICE_CRUSADE;
    set @choices_nr, 1 + @choices_nr;

    set @choice$[@choices_nr], "Steel Shield (6 Iron Ingots & 12 Coal).";
    set @choice_idx[@choices_nr], @CHOICE_SHIELD;
    set @choices_nr, 1 + @choices_nr;

    if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
        goto L_no_more_helmets;
    set @choice$[@choices_nr], "Warlord Helmet (9 Iron Ingots & 18 Coal).";
    set @choice_idx[@choices_nr], @CHOICE_WARLORD;
    set @choices_nr, 1 + @choices_nr;
    goto L_no_more_helmets;

L_no_more_helmets:
    set @choice$[@choices_nr], "No thanks.";
    set @choice_idx[@choices_nr], @CHOICE_CANCEL;
    set @choices_nr, 1 + @choices_nr;
    menu
        @choice$[0], L_MenuItems,
        @choice$[1], L_MenuItems,
        @choice$[2], L_MenuItems,
        @choice$[3], L_MenuItems,
        @choice$[4], L_MenuItems,
        @choice$[5], L_MenuItems;

L_MenuItems:
    set @menu, @menu - 1;
    if (@menu >= @choices_nr)
    close;

    set @choice, @choice_idx[@menu];
    if (@choice == @CHOICE_KNIGHT)
        goto L_YesKnight;
    if (@choice == @CHOICE_CRUSADE)
        goto L_YesCrusade;
    if (@choice == @CHOICE_WARLORD)
        goto L_YesWarlord;
    if (@choice == @CHOICE_SHIELD)
        goto L_YesShield;
    if (@choice == @CHOICE_SETZER)
        goto L_SetzerQuest;
    if (@choice == @CHOICE_CANCEL)
        goto L_end;
    close;

L_NoItem:
    mes "[Nicholas]";
    mes "\"It appears you don't have enough Coal and Iron Ingots for me to work with. Please do come back when you have more, though.\"";
    close;

L_NoMoney:
    mes "[Nicholas]";
    mes "\"Oh dear, it seems you don't have enough money.\"";
    close;

L_YesKnight:
    if (Zeny < 10000)
        goto L_NoMoney;
    if ( (countitem("IronIngot")<3) || (countitem("Coal") < 6) )
        goto L_NoItem;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_TooMany;
    set Zeny, Zeny - 10000;
    delitem "IronIngot", 3;
    delitem "Coal", 6;
    getitem "KnightsHelmet", 1;
    goto L_Done;

L_YesCrusade:
    if (Zeny < 10000) goto L_NoMoney;
    if ( (countitem("IronIngot")<6) || (countitem("Coal") < 12) )
        goto L_NoItem;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_TooMany;
    set Zeny, Zeny-10000;
    delitem "IronIngot", 6;
    delitem "Coal", 12;
    getitem "CrusadeHelmet", 1;
    goto L_Done;

L_YesWarlord:
    if (Zeny < 10000) goto L_NoMoney;
    if ( (countitem("IronIngot")<9) || (countitem("Coal") < 18) )
        goto L_NoItem;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_TooMany;
    set Zeny, Zeny-10000;
    delitem "IronIngot", 9;
    delitem "Coal", 18;
    getitem "WarlordHelmet", 1;
    goto L_Done;

L_YesShield:
    mes "[Nicholas]";
    mes "Nicholas examines your Iron Ingots.";
    mes "\"No, this iron is too brittle; for something as large as a shield I need to mix in softer iron. Can I see if you have anything suitable?\"";
    next;
    menu
        "Sure, have a look!", L_Next,
        "No.", L_Pass;

L_Next:
    if (countitem("InfantryHelmet") == 1)
        goto L_MoreInfantry;
    if (countitem("InfantryHelmet") == 0)
        goto L_NoInfantry;

    mes "[Nicholas]";
    mes "Nicholas pulls out two of your Infantry Helmets.";
    mes "\"I can use those... yes, that should work. Now all I need is a Leather Patch for the handle, and 20,000 GP.\"";
    if (@Q_SHIELD_status < @SHIELD_KNOWS_PATCH)
        set @Q_SHIELD_status, @SHIELD_KNOWS_PATCH;
    callsub L_Update_Var;
    next;
    menu
        "Here you are!", L_Next1,
        "Where can I get a Leather Patch?", L_WhereLeather,
        "No way.", L_Pass;

L_Next1:
    if (Zeny < 20000)
        goto L_ShieldNoZeny;
    if (countitem("InfantryHelmet") < 2)
        goto L_ShieldNoInfantry;
    if (countitem("IronIngot") < 6)
        goto L_ShieldNoIngot;
    if (countitem("Coal") < 12)
        goto L_ShieldNoCoal;
    if (countitem("LeatherPatch") < 1)
        goto L_ShieldNoLeatherPatch;
    // No inventory check needed, as infantry helms are removed, opening two slots

    mes "[Nicholas]";
    mes "\"Yes, it looks as if you have all that is needed!\"";
    mes "You watch Nicholas melt the ingots and helmets and form a shield out of the resulting iron. He then cuts your Leather Patch apart and adds it to the handles.";
    mes "\"Here is your shield!\"";
    delitem "InfantryHelmet", 1;
    delitem "InfantryHelmet", 1;
    delitem "LeatherPatch", 1;
    delitem "IronIngot", 6;
    delitem "Coal", 12;
    set Zeny, Zeny - 20000;

    if (@Q_SHIELD_status < @SHIELD_COMPLETED)
        getexp @SHIELD_XP, 0;
    if (@Q_SHIELD_status < @SHIELD_COMPLETED)
        mes "[" + @SHIELD_XP + " experience points]";
    set @Q_SHIELD_status, @SHIELD_COMPLETED; // get XP only once
    callsub L_Update_Var;
    getitem "SteelShield", 1;
    close;

L_ShieldNoZeny:
    mes "[Nicholas]";
    mes "\"I am sorry, but I must ask that you pay 20,000 GP; this is quality work.\"";
    close;

L_ShieldNoInfantry:
    mes "[Nicholas]";
    mes "\"Now this is strange... I could have sworn that you had two Infantry Helmets right here. Well, come back if you have some more!\"";
    close;

L_ShieldNoIngot:
    mes "[Nicholas]";
    mes "\"How odd... didn't I put your Iron Ingots on the table right here?  Well, I will need them back to make the shield.\"";
    close;

L_ShieldNoCoal:
    mes "[Nicholas]";
    mes "\"How odd... didn't I put your Coal on the table right here?  Well, I will need it back to make the shield.\"";
    close;

L_ShieldNoLeatherPatch:
    mes "[Nicholas]";
    mes "\"You don't have a suitable Leather Patch. I'm sorry, but a shield without one would chafe terribly.\"";
    close;

L_MoreInfantry:
    mes "[Nicholas]";
    mes "Nicholas takes your Infantry Helmet and examines it.";
    mes "\"Yes, this is perfect!  If you can bring me another one of those, I can make your shield.\"";
    close;

L_NoInfantry:
    mes "[Nicholas]";
    mes "Nicholas shakes his head.";
    mes "\"No, none of these items are suitable. Try looking for somewhat large metal items.\"";
    close;

L_WhereLeather:
    mes "[Nicholas]";
    mes "\"Hmm. You should look for someone who can work with some kind of leather. Rumor has it that there is someone in the eastern desert who can, but I haven't been there.\"";
    close;

L_SetzerQuest:
    mes "[Nicholas]";
    if (@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER)
            mes "\"Another one?  Sure, why not.\"";
    mes "Nicholas examines your Short Sword, then nods.";
    mes "\"This is good quality. I can make something special out of it, with three ingot bars of iron, six lumps of coal and 50,000 GP -- but I will also need a potion of monster oil.\"";
    if (@Q_SETZER_status < @SETZER_KNOWS_OIL)
        set @Q_SETZER_status, @SETZER_KNOWS_OIL;
    callsub L_Update_Var;
    next;
    menu
        "Here you are.", L_Next2,
        "Monster oil?  What's that?", L_ExplainMonsterOil,
        "HOW much?  Nevermind then!", L_Pass;

L_Next2:
    if (Zeny < 50000)
        goto L_SetzerNoZeny;
    if ( (countitem("IronIngot") < 3) || (countitem("Coal") < 6) )
        goto L_SetzerNoIngot;
    if (countitem("MonsterOilPotion") < 1)
        goto L_SetzerNoMonsterOil;
    if (countitem("ShortSword") < 1)
        goto L_SetzerNoSword;
    // No inventory check needed, as the short sword is removed, opening a slot

    mes "[Nicholas]";
    mes "Nicholas takes the items, heats up your sword and pounds it with a heavy hammer. As you watch, it turns thinner and flatter. Finally he pours the monster oil over it, heats the metal up again and douses it in water.";
    set Zeny, Zeny - 50000;
    delitem "IronIngot", 3;
    delitem "Coal", 6;
    delitem "MonsterOilPotion", 1;
    delitem "ShortSword", 1;
    getitem "Setzer", 1;
    if (!(@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER))
        mes "[" + @SETZER_XP + " experience points]";
    if (!(@Q_SETZER_status & @SETZER_FLAG_MADE_SETZER))
        getexp @SETZER_XP, 1;
    set @Q_SETZER_status, @Q_SETZER_status | @SETZER_FLAG_MADE_SETZER;
    callsub L_Update_Var;
    next;
    mes "[Nicholas]";
    mes "Nicholas hands you the completed sword. It feels strangely light in your hands.";
    mes "\"I made it lighter and faster, it should also cut a little better now. This kind of sword is called a Setzer, after a famous gambler who invented it as a weapon in between a knife and a sword.\"";
    next;
    mes "[Nicholas]";
    mes "\"I'm quite happy with this one. Be careful around the edge, though, it is quite sharp!\"";
    close;

L_ExplainMonsterOil:
    mes "[Nicholas]";
    mes "\"Monster oil is a special oil that can be used to harden thin sheets of metal, if used properly. Unfortunately, it is very hard to get. Perhaps one of our local alchemists can help you with it?\"";
    close;

L_SetzerNoZeny:
    mes "[Nicholas]";
    mes "\"I am sorry, but I must ask that you pay 50,000 GP; the kind of weapon I am thinking of is not easy to make.\"";
    close;

L_SetzerNoIngot:
    mes "[Nicholas]";
    mes "\"Without 3 ingots of iron, and six lumps of coal, I can't improve your sword.\"";
    close;

L_SetzerNoMonsterOil:
    mes "[Nicholas]";
    mes "\"I know that monster oil is hard to come by, but I can't do much without it. Ask an alchemist if you need help making it.\"";
    close;

L_SetzerNoSword:
    mes "[Nicholas]";
    mes "\"I will need your old Short Sword as a basis. Please bring it to me first.\"";
    close;

L_end:
    close;

L_Done:
    mes "[Nicholas]";
    mes "\"Here you go!\"";
    mes "";
    mes "\"Come back any time.\"";
    close;

L_Update_Var:
    set QUEST_Forestbow_state, (QUEST_Forestbow_state & ~(@Q_SHIELD_MASK | @Q_SETZER_MASK) | (@Q_SHIELD_status << @Q_SHIELD_SHIFT) | (@Q_SETZER_status << @Q_SETZER_SHIFT));
    return;

L_TooMany:
    mes "[Nicholas]";
    mes "\"You don't have room for it. Come back later when you do.\"";
    close;
}