summaryrefslogtreecommitdiff
path: root/npc/008-2-16/yannika.txt
blob: ecf9551a93d2e64f4407341483433022eb963210 (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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
// The Mana World scripts.
// Author:
//    Micksha
//    Jesusalva
// Description:
//    Yannika, Hinnaks Wife.
//    Makes delicious sandwiches for the player
// Variables:
//    General_Cooking
//  0: Doesn't knows the quest
//  1: Received the quest for the Cookbook
//  2: Completed the quest for the Cookbook
//    RECIPES
//  Controls which recipes you know and doesn't.
//  It is an array with Craft Constants.

008-2-16,28,29,0	script	Yannika	NPC_YANNIKA,{
    function yannika_intro;
    function yannika_knives;
    function yannika_recipe;
    function sudo_make_sandwich;
    function teach_cooking;

    // If player haven't finished Hinnak quest yet, Yannika says so
    .@q=getq(HurnscaldQuests_Hinnak);
    if (.@q < 3)
    {
        speech
            lg(l("Hello madam."), l("Hi Sir.")),
            l("Isn't my husband Hinnak so hardworking?"),
            lg("Come back later.");
        close;
    }

    // Player completed Hinnak quest, we can continue in making Sandwiches
    switch (getq(.quest))
    {
        case 0:
            yannika_intro();
            break;
        case 1:
            yannika_knives();
            break;
        default:
        speech
            lg(l("Hello madam."), l("Hi Sir.")),
            l("Thanks for helping my husband Hinnak."),
            l("He likes to eat sandwiches. A good thing they are so easy to make!");

        select
            l("Easy to make? Could you make one for me?"),
            l("Easy to make? Could you teach me how to make them?"),
            l("Good to know, thanks.");
        mes "";

        if (@menu == 1)
            sudo_make_sandwich();
        else if (@menu == 2)
            teach_cooking();

        next;
        break;
    }
    closeclientdialog;
    goodbye;
    close;



    ////////////////////////////////////////////////////
    // Quest state 0
    function yannika_intro
    {
        speech
            lg(l("Hello madam."), l("Hi Sir.")),
            l("Thanks for helping my husband Hinnak."),
            l("Could you please bring me 2 new knives?"),
            l("Hinnak wasted all my good kitchen knives trying to get rid of his accursed Pinkies.");

        select
            l("Yes, sure thing."),
            lg("Not my problem.");

        if (@menu == 1)
        {
            speech
                l("I'll be waiting for you, then!");
            setq .quest, 1;
            next;
        }
    }

    // Quest state 1
    function yannika_knives
    {
        speech
            lg(l("Hello madam."), l("Hi Sir.")),
            l("Thanks for helping my husband Hinnak."),
            l("Did you brought me 2 new knives?");

        select
            rif(countitem(Knife) >= 2, l("Yes, here they are.")),
            lg("Not yet, I'll be back.");

        if (@menu == 1)
        {
            // No need to countitem() because it is already at the menu
            // Technically, a hacked client could bypass earlier check though
            // Jesusalva doesn't likes hacks, so he puts delitem first.
            // delitem halts the script if it cannot delete all items.
            inventoryplace RecipeBook, 1;
            delitem Knife, 2;
            getitembound RecipeBook, 1, IBT_ACCOUNT;
            setq .quest, 2;

            speech
                l("Many thanks. I can now do sandwiches again!"),
                l("Well, of course. First of all, you need a @@. You can have mine, if you want.", getitemlink(RecipeBook)),
                l("The recipes, of course, you must collect yourself. Even sandwiches are not so simple as to simply put ingredients and hope for the best."),
                l("Cooking is an art. You need to know how to cook something. You can use my stove to prepare."),
                lg("Or, you can just forget all that, and let me prepare sandwiches for you, too! %%H"), // %%H - Smile Emote
                l("Oh, but I'll still need the book. Even if all pages are white.");
            next;
        }
    }

    // Learn a new Sandwich Recipe
    // yannika_recipe ( Craft ID, Sandwich ID, Ammo 1, Item 1, Ammo 2, Item 2,  Ammo 3, Item 3, {alt1, alt2} )
    function yannika_recipe
    {
        .@craft=getarg(0);
        .@sanid=getarg(1);
        .@ammo1=getarg(2);
        .@item1=getarg(3);
        .@ammo2=getarg(4);
        .@item2=getarg(5);
        .@ammo3=getarg(6);
        .@item3=getarg(7);
        .@alt1=getarg(8);
        .@alt2=getarg(9);
        mesn;
        mes l("For this recipe, you'll need to bring me:");
        mesf("%d/%d %s", countitem(.@item1), .@ammo1, getitemlink(.@item1));
        mesf("%d/%d %s", countitem(.@item2), .@ammo2, getitemlink(.@item2));
        mesf("%d/%d %s", countitem(.@item3), .@ammo3, getitemlink(.@item3));
        mesf("%s or %s", getitemlink(.@alt1), getitemlink(.@alt2));

        select
            rif(countitem(.@alt1), l("(%s) Yes, in fact, you can take them now.", getitemname(.@alt1))),
            rif(countitem(.@alt2), l("(%s) Yes, in fact, you can take them now.", getitemname(.@alt2))),
            l("Maybe later.");

        if (@menu < 3)
        {
            if (countitem(.@item1) < .@ammo1 ||
                countitem(.@item2) < .@ammo2 ||
                countitem(.@item3) < .@ammo3)
            {
                speech
                    l("You don't have everything I have asked for.");
                close;
            }
            delitem .@item1, .@ammo1;
            delitem .@item2, .@ammo2;
            delitem .@item3, .@ammo3;
            if (@menu == 1)
                delitem .@alt1, 1;
            if (@menu == 2)
                delitem .@alt2, 1;

            // Learn recipe
            RECIPES[.@craft]=true;
            mesn;
            mesq l("Look and learn.");
            next;
            mesn;
            mesq l("This is how you do it! HAAH!");
            next;
            mesc l("You learned how to cook @@.", getitemlink(.@sanid));
            next;
            mesn;
            mesq l("Please come back later and I may have something else to show you.");
        }
        return;
    }

    // Yannika can make sandwiches for players
    // FIXME: Actually, Yannika will cook anything for players >__>
    function sudo_make_sandwich
    {
        speech
            l("When cooking, the order of ingredients matter."),
            l("Even a simple sandwich will be ruined if you place lettuce above the cheese!"),
            l("Anyway, to make a sandwich, you'll need to place, in this order:"),
            l("1x @@, 3x @@, 2x @@, and the ingredient of your choice.", getitemlink(Bread), getitemlink(LettuceLeaf), getitemlink(Cheese));

            do
            {
                mes "##B" + l("Drag and drop the items from your inventory in the frames.") + "##b";

                // Crafting skin with 4 columns
                setskin "craft4";
                .@var$ = requestcraft(4); // Limit: 4 items
                .@craft = initcraft(.@var$);
                .@entry = findcraftentry(.@craft, CRAFT_COOKING);
                setskin "";

                // Does the recipe exist and is a sandwich?
                if (.@entry < 0)
                {
                        speech
                            l("Sorry. I can't make a sandwich with that."),
                            l("Do you want to try again?");
                        if (askyesno() == ASK_YES)
                            .@tryAgain=true;
                        else
                            .@tryAgain=false;
                }
                else
                {
                    // Did player cheat? If not, proceed with the craft
                    if (!validatecraft(.@craft))
                    {
                        speech
                            l("Sorry, my eyesight is a bit poor nowadays. Where are the ingredients?");
                        .@tryAgain=true;
                    }
                    else
                    {
                        usecraft .@craft;
                        speech
                            l("@@ skillfully cuts the bread in half, throws the ingredients in air, and they land in the sandwich!", .name$),
                            l("There you go. Please enjoy yourself! ^.^");

                        .@tryAgain=false;
                    }
                }

                // Clear unused variables and clear the screen. Then print recipe again.
                deletecraft .@craft;
                if (.@tryAgain) {
                    clear;
                    mesc l("1x @@, 3x @@, 2x @@, and the ingredient of your choice.", getitemlink(Bread), getitemlink(LettuceLeaf), getitemlink(Cheese));
                }
            } while (.@tryAgain);
        return;
    }

    // Teach player how to cook, providing a recipe book if they don't have one
    function teach_cooking
    {
        // Check if your stats aren't enough (bonuses aren't counted)
        if (readparam(bInt) < 10 ||
            readparam(bDex) < 20)
        {
            speech
                l("Well, cooking is an art, and thus, you need intelligence and dexterity to learn."),
                l("Please come again with at least 10 INT and 20 DEX. Stat Bonuses aren't counted.");
            close;
        }

        // First part: Carp Sandwich
        if (!RECIPES[CraftCarpSandwich]) {
            mesn;
            mesq l("Well, of course, I can show you how to cook sandwiches. But you'll need to bring ingredients for practice.");
            next;
            mesn;
            mesq l("Should we start with something simple? Hmmm... Do you have a %s? It is hard to find one around these parts, but you don't seem to be from here.", getitemlink(FishingRod));
            next;
            // pre-req
            if (!countitem(FishingRod)) {
                mesn;
                mesq l("Please try getting one. You'll need some carps for the recipe I'm going to teach you.");
                if (countitem(CommonCarp) || countitem(GrassCarp))
                    mesq l("Cooking begins with collecting your own ingredients. That is what makes it so tasty. So, bring me a fishing rod!");
                return;
            }
            // warn about main req
            if (!countitem(CommonCarp) && !countitem(GrassCarp)) {
                mesn;
                mesq l("Ah, good, you've brought one!");
                next;
                mesn;
                mesq l("Now you'll need to fish a carp. It can be a %s or a single %s, for the sandwhich.", getitemlink(CommonCarp), getitemlink(GrassCarp));
                next;
            }
            mesn;
            mesq l("I'll also be needing the usual sandwich stuff: Bread, Lettuce and Cheese.");
            next;
            yannika_recipe(CraftCarpSandwich, CarpSandwich, 1, Bread, 3, LettuceLeaf, 2, Cheese, CommonCarp, GrassCarp);
            return;
        }

        // Main quest (TODO)
        .@q=getq(.quest);
        .@q2=getq2(.quest);
        .@s=getq(General_SmearedHands);

        // Snarfles/Crane dependency
        if (!.@s) {
            mesn;
            mesq l("No, not at the moment.");
            next;
            return;
        }

        // Backup SmearedHands to cooking for ease of access
        setq2 General_Cooking, getq2(General_SmearedHands);

        // Switch General_Cooking quest
        switch (.@q) {
        case 2:
            setq1 General_Cooking, 3;
            // FALLTHROUGH
        case 3:
        case 4:
        case 5:
        case 9:
        case 10:
        case 12:
        case 13:
        case 14:
        case 17:
            mesn;
            mesq l("Could you do a favor for me, first?");
            next;
            mesn;
            mesq l("Could you bring a couple fresh fish to %s? Carps should do.", b(l("the Chef in Dimond's Cove")));
            next;
            mesn;
            mesq l("He promised to make me some %s if I could provide him the fish.", getitemlink(SeafoodPlate));
            next;
            mesn;
            mesq l("Sandwiches are handy, but they won't beat a full meal, which we hadn't in a while.");
            next;
            mesn;
            mesq l("I'll be waiting your return!");
            next;
            break;
        case 6:
            select
                l("What did you want, again?"),
                l("I need some %s.", getitemname(.@q2 == VEGAN ? MananaSandwich : PioulegSandwich));
            mes "";
            if (@menu == 1) {
                mesn;
                mesq l("A %s pretty please.", getitemlink(SeafoodPlate));
                break;
            }
            mesn;
            mesq l("Ehh, I usually only make %s... You know cooking is not just throwing ingredients and vói-la, right?", getitemlink(CarpSandwich));
            next;
            mesn;
            mesq l("But actually... Perhaps the chef in Candor?");
            next;
            mesn;
            mesq l("I forgot their name, but they are not very normal. Err.");
            next;
            mesn;
            mesq l("You probably can find them by the shorelines.");
            setq1 General_Cooking, 7;
            break;
        case 7:
            mesn;
            mesq l("Candor's Chef is not very normal, so be careful when asking him about the sandwiches you want to make.");
            break;
        case 8:
            mesn;
            mesq l("How things went with Candor's Chef?");
            next;
            select
                l("Great!"),
                l("Not so great!");
            mes "";
            if (@menu == 1) {
                mesn;
                mesq l("That's good to hear!");
            } else {
                mesn;
                mesq l("Oh no... Did he asked you to help you with something crazy? I feared he would do that...");
                next;
                mesn;
                mesq l("But that's how I learned the carp sandwich recipe, you know?");
                next;
                mesn;
                mesq l("Was trying to eat fried carp, but it always smeared my hands. Never thought he would come up with a sandwich recipe when I gave him that!");
                next;
                mesn;
                mesq l("But he is still crazy, in my opinion...");
            }
            break;
        case 11:
            select
                l("What did you want, again?"),
                l("Do you know where Tulimshar bakery is?");
            mes "";
            if (@menu == 1) {
                mesn;
                mesq l("A %s pretty please.", getitemlink(SeafoodPlate));
                break;
            }
            mesn;
            mesq l("What, don't tell me you never have been at Tulimshar! Nearly everyone of your age already has been there at least once.");
            next;
            mesn;
            mesq l("Tulimshar used to have a great Inn, but after the war, their business started to decline.");
            next;
            mesn;
            mesq l("However, they had a bakery which has since flourished!");
            next;
            mesn;
            mesq l("So if you fail finding the bakery, look for the Inn - it is on the same building.");
            break;
        case 15:
        case 16:
            select
                l("What did you want, again?"),
                l("Where can I find salad?");
            mes "";
            if (@menu == 1) {
                mesn;
                mesq l("A %s pretty please.", getitemlink(SeafoodPlate));
                break;
            }
            mesn;
            mesq l("This is a strange question. But I might be able to answer.");
            next;
            mesn;
            mesq l("Hubby exports a lot of crops to Tulimshar. The purchaser is the Magic Academy of Tulimshar.");
            next;
            mesn;
            mesq l("I'm not sure if this is of any help to you, though? I forgot who is the responsible for the Academy, so good luck!");
            break;
        case 18:
            mesn;
            mesq l("So? Did you got me a %s? I'm hungry...", getitemlink(SeafoodPlate));
            next;
            if (countitem(SeafoodPlate) < 1)
                break;
            if (askyesno() == ASK_NO)
                break;
            delitem SeafoodPlate, 1;
            getitem EmptyPlate, 1;
            getexp 10000, 1000;
            setq1 General_Cooking, 19;
            mesn;
            mesq l("Ah - Many thanks. Here, I'll return you a plate.");
            next;
            mesc l("Food Questline Complete!");
            mesc l("Stay tuned for more updates!");
            mes "";
            mesc l("- The Mana World Development Team");
            break;
        default:
            mesn;
            mesq l("No, not at the moment.");
        }

        return;
    }

OnInit:
    .bodytype = BODYTYPE_2;
    .distance = 4;
    .quest=General_Cooking;

    end;
}