summaryrefslogtreecommitdiff
path: root/npc/008-2-16/stove.txt
blob: 40dfeca965b3f552d513303c56762d64b87eae94 (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
// Evol scripts.
// Author:
//    Jesusalva
// Description:
//    Stove to make sandwiches

008-2-16,32,29,0	script	Stove	NPC_NO_SPRITE,{
    // If player haven't finished Hinnak quest yet, they can't use the stove
    .@q=getq(HurnscaldQuests_Hinnak);
    if (.@q < 3)
    {
        setcamnpc "Yannika";
        mesn l("Yannika");
        mesq l("Please don't touch my stove without my authorization.");
        close;
    }

    // Cooking loop
    do
    {
        mesc lg("It is time to make some sandwiches myself!");
        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)
        {
                narrator
                    l("You don't know how any recipe 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))
            {
                narrator
                    l("Where are the ingredients?");
                .@tryAgain=true;
            }
            else
            {
                // Even if the recipe is right, if you don't have it on your
                // recipe book, it should be deemed invalid.
                if (RECIPES[.@entry])
                {
                    usecraft .@craft;
                    narrator
                        l("Done!"),
                        l("Do you want to try again?");
                }
               else
                {
                    narrator
                        l("You don't know how any recipe with that."),
                        l("Do you want to try again?");
                }

                if (askyesno() == ASK_YES)
                    .@tryAgain=true;
                else
                    .@tryAgain=false;
            }
        }

        // Clear unused variables and clear the screen.
        deletecraft .@craft;
        clear;
    } while (.@tryAgain);

    closeclientdialog;
    close;

OnInit:
    .sex = G_OTHER;
    .distance = 2;
    end;
}