summaryrefslogtreecommitdiff
path: root/npc/008-2-4/bernard.txt
blob: 3859c7e61454ac5cf99cb4d01918ee484d5ddca9 (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
// Evol scripts.
// Author:
//    gumi
// Quest states:
//    [1] 0 - cannot do the quest
//    [1] 1 - can do the quest
//    [1] 2 - bernard wants roasted maggot
//    [1] 3 - brought maggot
//    [1] 4 - bernard wants maggot slime
//    [1] 5 - brought maggot slime
//    [1] 6 - mikhail needs maggot slime
//    [1] 7 - brought maggot slime
//    [2] unused
//    [3] unused
//    [t] unused
// Description:
//    Bernard wants to make a maggot slime soup

008-2-4,34,29,0	script	Bernard	NPC_BERNARD,{

    if (BaseLevel < .min_level)
    {
        npctalk3 generic(16 | 32);
        end;
    }

    function soup_intro {
        if (rand(2) == 1)
        {
            speech 4,
                l("The fields are crawling with maggots."),
                l("Where is Mikhail?"),
                l("What is taking them so long?"),
                l("Could I ask a favor of you?");
        }
        else
        {
            speech 4,
                l("The taste of maggots in soup is... unforgettable."),
                l("They taste simply divine!"),
                l("I sent someone to kill me some maggots and they have yet to return."),
                l("Would you help me kill some?");
        }

        if (selectd(l("Yes."), l("No.")) == 2)
        {
            return;
        }

        if (rand(2) == 1)
        {
            speech 4,
                l("Great!"),
                l("I need a %s for my soup.", getitemlink(.first_item));
        }
        else
        {
            speech 4,
                l("Bring me a %s.", getitemlink(.first_item)),
                l("I'll give you something if you do.");
        }

        speech 8,
            l("Please bring it to me!");

        setq .quest, 2;
        close;
    }

    function soup_reminder_roasted {
        speech
            l("Oh, please hurry and bring me a %s.", getitemlink(.first_item)),
            l("I'm yearning for maggot soup!");
        close;
    }

    function soup_no_room {
        speech 1 | 8,
            "...",
            l("It seems you don't have room for my reward."),
            l("I'll wait until you do.");
        close;
    }

    function soup_reward_roasted {
        speech 4,
            l("Oooh, perfect! It's perfect!"),
            l("You brought me my %s!", getitemlink(.first_item)),
            l("Here, have some %s for your troubles.",
                getitemlink(.first_reward_item));

        if (checkweight(.first_reward_item, .first_reward_amount) != true)
            soup_no_room;

        if (countitem(.first_item) < 1)
            close;

        delitem .first_item, 1;
        getitem .first_reward_item, .first_reward_amount;
        getexp .first_reward_exp, 0;
        setq .quest, 3;

        speech 8,
            l("Now let's see...");
        close;
    }

    function soup_ask_slime {
        speech
            l("Thank you so much!"),
            l("But... something is missing to make the soup creamy."),
            l("I need %d %s for that.",
                .second_item_qty, getitemlink(.second_item)),
            l("Bring them to me, and I'll give you something nice.");

        setq .quest, 4;
        close;
    }

    function soup_reminder_slime {
        speech
            l("Please do hurry and bring me %d %s, so I can finish my soup!",
                .second_item_qty, getitemlink(.second_item));
        close;
    }

    function soup_reward_slime {
        speech
            l("Nice!"),
            l("They're perfect, just perfect!"),
            l("You brought me the %d %s!",
                .second_item_qty, getitemlink(.second_item)),
            l("Here, have some %s as reward.",
                getitemlink(.second_reward_item));

        if (checkweight(.second_reward_item, .second_reward_amount) != true)
            soup_no_room;

        if (countitem(.second_item) < .second_item_qty)
            close;

        delitem .second_item, .second_item_qty;
        getitem .second_reward_item, .second_reward_amount;
        getexp .second_reward_exp, 0;
        setq .quest, 5;

        close;
    }

    function soup_thanks_slime {
        speech
            l("I didn't mention it before, but I also put beer in my soup."),
            l("I hope you like beer as much as I do, because, you see..."),
            l("Beer is life!");
        close;
    }

    function soup_thanks_mikhail {
        speech
            l("My help, Mikhail, finally returned with the slimes I needed."),
            l("I wonder what took him so long?");
        close;
    }


    // OnTalk:
    switch (getq(.quest))
    {
        case 0:
        case 1: soup_intro; break;
        case 2:
            if (countitem(.first_item) < 1)
                soup_reminder_roasted;
            else
                soup_reward_roasted;
            break;
        case 3: soup_ask_slime; break;
        case 4:
            if (countitem(.second_item) < .second_item_qty)
                soup_reminder_slime;
            else
                soup_reward_slime;
            break;
        case 5:
        case 6: soup_thanks_slime; break;
        default: soup_thanks_mikhail;
    }

    closeclientdialog();
    close;

OnPCLoginEvent:
OnPCBaseLvUpEvent:
    if (BaseLevel >= .min_level && getq(.quest) < 1)
    {
        setq .quest, 1; // allow the player to do the quest
        dispbottom l("New quest available: %s (level %d+)",
            getquestlink(.quest), .min_level); // XXX: requires new manaplus versions, maybe show a different message for old versions?
    }
    end;

OnInit:
    .min_level = 10; // min level to do the quest

    .first_item = RoastedMaggot;
    .first_reward_item = CherryCake;
    .first_reward_amount = 5;
    .first_reward_exp = 100;

    .second_item = MaggotSlime;
    .second_item_qty = 3;
    .second_reward_item = Beer;
    .second_reward_amount = 3;
    .second_reward_exp = 100;

    .quest = HurnscaldQuests_Soup;
    .quest_debug = .quest;
    .sex = GENDER_HIDDEN;
    .distance = 3;

////////// UNFINISHED //////////
////////////////////////////////
// REMOVE THIS CODE WHEN THIS //
// NPC IS NO LONGER A WIP //////
////////////////////////////////
//if (!debug) disablenpc(.name$);
///////// UNFINISHED ///////////

    end;
}