summaryrefslogtreecommitdiff
path: root/npc/001-1/qpid.txt
blob: 3fd27a6d0251cdc0504cb1898b7e06d88f3e3bbf (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
// Evol scripts.
// Authors:
//    Reid
// Description:
//    Potion seller, she is part of the Enora's noob quests.

001-1,65,116,0	script	Q'Pid#001-1	NPC_QPID,{

    function verify_riddle_answer {
        .@answer$ = getarg (0);
        .@good$ = getarg (1);
        .@good_translated$ = l(getarg(1));

        .@size_answer = getstrlen (.@answer$);
        .@size_good = getstrlen (.@good$);
        .@size_good_translated = getstrlen (.@good_translated$);

        if (.@size_answer > .@size_good)
        {
            .@max = (.@size_answer > .@size_good_translated)
                ? .@size_answer
                : .@size_good_translated;
        }
        else
        {
            .@max = (.@size_good > .@size_good_translated)
                ? .@size_good
                : .@size_good_translated;
        }

        for (.@j = 0; .@j < .@max; .@j++)
        {
            if (strtolower (charat (.@answer$, .@j)) == charat (.@good$, .@j))
            {
                .@k++;
            }
            if (strtolower (charat (.@answer$, .@j)) == charat (.@good_translated$, .@j))
            {
                .@k_translated++;
            }
        }
        .@k *= 10;
        .@k_translated *= 10;
        .@size_good *= 7;
        .@size_good_translated *= 7;
        if (.@k >= .@size_good  || .@k_translated >= .@size_good_translated)
        {
            return 1;
        }
        return 0;
    }

    function riddle_enigma {
        speech 5,
            l("Ok fine, you have up to 3 tries, here is the riddle:"),
            l("What is growing and shrinking at the same time?");
        narrator 4,
            l("You need to type the answer of this riddle in the NPC window."),
            l("The answer is a single word, without conjugation."),
            l("You can also answer in your native language or in English.");

        do
        {
            input .@answer$;
            .@i++;

            if (verify_riddle_answer (.@answer$, "life"))
            {
                speech 5,
                    l("Oh..."),
                    l("You seem more cultivated than you look.");

                if (getq (ArtisQuests_Enora) == 7)
                {
                    setq (ArtisQuests_Enora, 9);
                    speech 12,
                        l("Fine, take these potions, I will replenish them in the next couple hours anyway.");
                }

                break;
            }
            else if (.@i < 3)
            {
                speech 5,
                    l("Too bad, try again.");
            }
            else
            {
                if (getq (ArtisQuests_Enora) == 7)
                {
                    setq (ArtisQuests_Enora, 8);
                    speech 5,
                        l("You failed!"),
                        l("Ivan is the one that you should look at now."),
                        l("He is on a small house between the dock's warehouse and the dojo."),
                        l("Follow the river to the north-east and you will find it."),
                        l("And get out of here, I'm not a map!");
                }
                else
                {
                    speech 5,
                        l("You failed!");
                }

                break;
            }
        } while (1);

        return;
    }

    function enora_quest {
        speech 5,
            l("She wants? What if I don't want?"),
            l("I'm not a pawn of the Legion, I don't have to obey you!"),
            l("Oh and guess what! I'm almost out of potions anyway.");

        switch (select (l("And where can I find these potions?"),
                        l("You bored me, see you later.")))
        {
            case 1:
                break;
            case 2:
                return;
        }

        speech 5,
            l("You don't seem to be from the Legion, let's do a game."),
            l("If you find the correct answer, I will give you these potions..."),
            l("But if you fail, you will have to get them from the alchemist."),
            l("Deal?");

        if (askyesno() == ASK_YES)
        {
            riddle_enigma;
        }
        return;
    }

    function alchemist_information {
        speech 5,
            l("Do? I don't do them."),
            l("I'm sure that you already knew the answer, didn't you?"),
            l("You tried to embarrass me, am I right?!"),
            l("It's Ivan... I'm sure that he sent you to annoy me..."),
            l("I'm just a merchant, I trade and make deals, yes \"excuse\" me if I'm not as skilled as this stupid alchemist."),
            l("But rare are those that receive grants from the Legion itself. For anybody else only a hard work can pay your bills!");
        emotion 11;

        switch (select (l("Sorry I didn't mean to bother you."),
                        l("You are just sitting on the shadow of your store.")))
        {
            case 1:
                mes "";
                mesn;
                break;
            case 2:
                speech 5, l("You are honest, I like it.");
                break;
        }
        mesq l("Is that all you had to say?");
        next;

        return;
    }

    speech 4,
        l("What?");

    do
    {
        .@enora = getq(ArtisQuests_Enora);

        menuint
            rif (.@enora == 7, l("Enora wants her potions.")), 0,
            menuaction(l("Trade")), 1,
            rif (.@enora > 7, l("What was your riddle?")), 2,
            l("How do you do your potions?"), 3,
            l("What are you reading?"), 4,
            menuaction(l("Quit")), 5;

        switch (@menuret)
        {
            case 0:
                enora_quest;
                break;
            case 1:
                closedialog;
                shop "Store#Potion001-1";
                close;
            case 2:
                riddle_enigma;
                break;
            case 3:
                alchemist_information;
                break;
            case 4:
                speech 5,
                    l("It's a poem, about poems... Why are you asking that?"),
                    l("Because I am an orc I can't read such things? That's rubbish."),
                    l("I borrowed it from the library, you should try to cultivate yourself more instead of insinuate things about people you don't know!");
                break;
            case 5:
                break;
        }
    } while (@menuret != 5);

    closedialog;
    goodbye;
    close;

OnInit:
    .sex = G_FEMALE;
    .distance = 3;
    end;
}