summaryrefslogtreecommitdiff
path: root/npc/020-2-20/riskim.txt
blob: f68b9825baf6adf5a574816e8ee69b699ac46259 (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
// The Mana World scripts.
// Author:
//    Micksha
// Description:
//    Riskim, the baker in Tulimshar.
// THIS IS A PLACEHOLDER!

020-2-20,49,30,0	script	Riskim	NPC_CHEF_LEGACY,{
    function foodQuestline;
    .@q=getq(General_Cooking);
    speech
        l("Hi there."),
        l("Need a Donut?"),
        l("Well, tell me the recipe and I will bake for you whatever you need, for a small fee."),
		l("But: No recipe, no desserts.");
    if (.@q > 10)
        foodQuestline;
    close;

function foodQuestline {
    .@q=getq(General_Cooking);
    .@q2=getq2(General_Cooking);
    mes "";
    select
        rif(.@q == 11, l("Aww, but I was hoping to learn a recipe!")),
        rif(.@q >= 14, l("I needed Acorn Flour.")),
        rif(.@q >= 14, l("Do you need acorn flour yourself?")),
        rif(.@q >= 14, l("I want to cook!")),
        l("=(");
    mes "";
    switch (@menu) {
    case 1:
        mesn;
        mesq l("What? Get out of here you noob. The recipes are the pride of this inn-bakery and I'm not going to give them away just because you asked.");
        next;
        mesn;
        mesq l("Besides, I already have an apprentice - He should be cleaning the basement at this moment, including.");
        next;
        mesn;
        mesq l("Get out of my face and don't say that again.");
        setq1 General_Cooking, 12;
        break;
    case 2:
        mesn;
        mesq l("Only the best %s can make fine recipes.", getitemlink(AcornFlour));
        next;
        mesn;
        mesq l("I'm willing to make you one flour for each %d %s you bring me. Three for you, and two as commission.", 5, getitemlink(Acorn));
        next;
        mesn;
        mesq l("So, how many do you want?");
        menuint
            rif(countitem(Acorn) >= 5, l("I want %d", 1)), 1,
            rif(countitem(Acorn) >= 25, l("I want %d", 5)), 5,
            rif(countitem(Acorn) >= 50, l("I want %d", 10)), 10,
            rif(countitem(Acorn) >= 125, l("I want %d", 25)), 25,
            rif(countitem(Acorn) >= 250, l("I want %d", 50)), 50,
            rif(countitem(Acorn) >= 500, l("I want %d", 100)), 100,
            rif(countitem(Acorn) >= 5, l("As many as you can.")), countitem(Acorn)/5,
            l("Ehrm, none, thanks."), 0;
        mes "";
        if (!@menuret)
            break;
        inventoryplace AcornFlour, @menuret;
        delitem Acorn, @menuret*5;
        getitem AcornFlour, @menuret;
        mesn;
        mesq l("Here you go. A pleasure doing business with you.");
        break;
    case 3:
        // DailyQuest(lvl, cost, count, item)
        DailyQuest(20, 3, 1, AcornFlour);
        break;
    case 4:
        mesn;
        mesq l("My charge is %d E per batch.", .price);
        if (Zeny < .price)
            break;
        next;
        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)
            {
                    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;
            Zeny-=.price;
            if (Zeny < .price)
                .@tryAgain = false;
            clear;
        } while (.@tryAgain);
        break;
    }
    return;
}

OnInit:
    .distance = 4;
    .price = 120;
    end;
}