summaryrefslogtreecommitdiff
path: root/world/map/npc/021-2/kylian.txt
blob: 5a162242b568f1965b571895578466b1b5d5ad05 (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
// Kylian is a businessman from Argeas who wants to eventually open a shop in Tulimshar
// asks the player for several information about the city
// Quest uses Nibble 4 and 5 of QUEST_NorthTulimshar
// Author: Jenalya

// Nibble 4 is used as flags to indicate if the player knows certain places/persons
// Bit 0: player talked to Yanis in the government building
// Bit 1: player talked to Latoy on the market in North Tulimshar
// Bit 2: player talked to Weellos as the historic building
// Bit 3: player was in the casino rooms

// Nibble 5 is used to save the quest progress with Kylian
// state 1: player has the task to get the luggage from the harbor
// state 2: Adrian gave the luggage to the player
// state 3: player gave luggage to Kylian and Kylian asks who to talk to for the shop license
// after the player answered this, @KylianNTLicense is set.
// the player can only continue the quest when logging out and therefore setting that value to 0 again
// state 4: Kylian asks for a historical building to get some cultural knowledge
// state 5: Kylian asks where to get some typical food
// after the player answered this, @KylianNTSightSeeing is set.
// the player can only continue the quest when logging out and therefore setting that value to 0 again
// state 6: Kylian asks where to go to have some fun in the evening (casino)
// state 7: Kylian asks where to get exquisite clothing before going out in the evening
// after the player answered this, @KylianNTSightSeeing is set.
// the player can only continue the quest when logging out and therefore setting that value to 0 again
// state 8: Kylian was in the casino and gives a desert hat as reward
// state 9: Shop approved, go talk Kylian's shopkeeper if you are looking for work.
// state 10: Meet Shop keeper
// state 11: Start Time Trial 
// state 12: Return
// state 13: Start Daily Timed
// state 14: Return
// state 15: Completed 
// Kylian_Timer is used to denote start time.

// temporary variables used to check if the player logged out or left the building in the meanwhile
// this is to ensure some 'time in between' different actions of the quest
// @KylianNTLicense
// @KylianNTSightSeeing
// @KylianNTCasino

-|script|#businessmanNTconfig|-1
{
    end;

OnInit:
    // Nibble 4
    // Used in Random Quest later as a Nibble
    set $@knowYanisNT, (1 << 16);
    set $@knowLatoyNT, (1 << 17);
    set $@knowWeellosNT, (1 << 18);
    set $@knowCasinoNT, (1 << 19);

    // Random Quests for Later
    setarray $@random_quests$, "None", "Falkurn", "Old Wizard", "Baktar";
    set $@delivery_money, 100;
    set $@delivery_exp_mod, 10;
    end;
}
021-2.gat,25,67,0|script|#KylianOut|32767,1,1
{
    set @KylianNTLicense, 0;
    set @KylianNTSightSeeing, 0;
    set @KylianNTCasino, 0;
    end;
}
021-2.gat,89,55,0|script|Kylian|193
{
    set @state, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT);

    set @acorn_amount, 12;
    set @suitcase_money, 100;
    set @suitcase_exp, 50;
    set @license_money, 50;
    set @license_exp, 20;
    set @sightseeing_money, 50;
    set @sightseeing_exp, 20;
    set @food_money, 50;
    set @food_exp, 20;
    set @clothes_money, 50;
    set @clothes_exp, 20;
    set @fun_money, 50;
    set @fun_exp, 20;

    // This NPC previously used the variable TMW_Quest
    callfunc "ClearVarTMW_Quest";
    set @bernard, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);

    if (@state == 15) goto L_Done;
    if (@state >= 11) goto L_Helping;
    if (@state == 10) goto L_OfferedJob;
    if (@state == 9) goto L_Shop;
    if (@KylianNTCasino) goto L_CasinoDone;
    if (@state == 8) goto L_DesertHat;
    if (@state == 7) goto L_Clothes;
    if (@KylianNTSightSeeing) goto L_SightSeeingDone;
    if (@state == 6) goto L_Casino;
    if (@state == 5) goto L_Food;
    if (@KylianNTLicense) goto L_LicenseDone;
    if (@state == 4) goto L_SightSeeing;
    if (@state == 3) goto L_ShopLicense;
    if (@state >= 1) goto L_Suitcase;

    mes "[Kylian]";
    mes "\"Ah, are you the room service? I've some requests.\"";
    menu
        "Sure, what can I do for you?",L_Luggage,
        "No, I'm not!",L_Next;

L_Next:
    mes "[Kylian]";
    mes "\"Too bad. Would you be interested in earning some quick money with some errands regardless?\"";
    menu
        "I'm a great adventurer! I don't do errands.",L_Close,
        "No, I'm busy.",L_Close,
        "Mh, ok.",L_Luggage;

L_Luggage:
    mes "[Kylian]";
    mes "\"I need someone to get my luggage from the docks. Show this paper to the sailor who's watching the luggage.\"";
    mes "He gives you his ticket which you store in your pocket, separated from your inventory.";
    set @state, 1;
    callfunc "SetKylianQuest";
    goto L_Close;

L_Suitcase: // @state >= 1, but below 3
    mes "[Kylian]";
    mes "\"Did you already get my luggage from the docks?\"";
    if (@state != 2)
        goto L_Close;
    menu
        "Here it is.",L_Continue,
        "I'm on my way, don't worry.",L_Close;

L_Continue:
    if (countitem("LeatherSuitcase") < 1)
        goto L_NoItem;
    delitem "LeatherSuitcase", 1;
    set Zeny, Zeny + @suitcase_money;
    getexp @suitcase_exp, 0;
    set @state, 3;
    callfunc "SetKylianQuest";
    mes "[Kylian]";
    mes "\"Ah, very good. I really need to have a look at some of my papers in there.\"";
    mes "He gives you some money.";
    next;
    mes "[Kylian]";
    mes "\"Oh, and I have some acorns left, I had them with me as travelling fare. You can have them, they're tasty.";
    mes "In case you don't like them, you could also bring them to the Tulimshar bakery. I heard they use them to make some special flour.\"";
    getitem "Acorn", @acorn_amount;
    next;
    goto L_ShopLicense;

L_ShopLicense: // @state == 3
    mes "[Kylian]";
    mes "\"I'm a salesman and came to Tulimshar because I'm thinking about establishing a shop here. While I'm going through my papers, could you find out who I have to talk to about opening a shop in this city?\"";
    if (!(QUEST_NorthTulimshar & $@knowYanisNT))
        goto L_Close;
    menu
        "You need to talk to Yanis in the government building.",L_GovBuild,
        "I'll see what I can do.",L_Close;

L_GovBuild:
    set Zeny, Zeny + @license_money;
    getexp @license_exp, 0;
    set @state, 4;
    callfunc "SetKylianQuest";
    set @KylianNTLicense, 1;
    mes "[Kylian]";
    mes "\"Ah, excellent. That's very helpful. Could you tell me how to get to that building?\"";
    mes "You explain the way to the building.";
    next;
    goto L_LicenseDone;

L_LicenseDone: // the player didn't log out yet after telling about Yanis
    mes "[Kylian]";
    mes "\"I need to prepare my papers now. I might have some more questions later.\"";
    goto L_Close;

L_SightSeeing: // @state == 4 and logged out sometime between getting to that state and now
    mes "[Kylian]";
    mes "\"You just came here the right moment. I have finished my business affairs. I think I should use my time here to also get a bit of cultural knowledge about the area. Can you tell me if there are any historical places to visit?\"";
    if (!(QUEST_NorthTulimshar & $@knowWeellosNT))
        goto L_Close;
    menu
        "There is a very old historic building not far from here.",L_HistBuild,
        "I don't know, but will have a look around.",L_Close;

L_HistBuild:
    set Zeny, Zeny + @sightseeing_money;
    getexp @sightseeing_exp, 0;
    set @state, 5;
    callfunc "SetKylianQuest";
    mes "[Kylian]";
    mes "\"This sounds interesting. Please tell me the way.\"";
    mes "You tell him how to get to the historic building.";
    next;
    goto L_Food;

L_Food: // @state == 5
    mes "[Kylian]";
    mes "\"While I'm out, I could also get something to eat. Maybe some typical dish for this region. Do you have a good suggestion for that?\"";
    if (@bernard < 4) // didn't yet help Bernard to make his soup
        goto L_Close;
    menu
        "Bernard on the bazaar makes a great soup.",L_SoupBer,
        "No idea, I'll try to find out.",L_Close;

L_SoupBer:
    set Zeny, Zeny + @food_money;
    getexp @food_exp, 0;
    set @state, 6;
    callfunc "SetKylianQuest";
    set @KylianNTSightSeeing, 1;
    goto L_SightSeeingDone;

L_SightSeeingDone:
    mes "[Kylian]";
    mes "\"I'm going to see the historic building you told me about and try this local soup on the bazaar. Thank you for the suggestions.\"";
    goto L_Close;

L_Casino: // @state == 6 and logged out sometime between getting to that state and now
    mes "[Kylian]";
    mes "\"Hello. I just came back from my sight-seeing tour. And this soup from Bernard really was delicious. I wonder what it's made of...\"";
    next;
    mes "\"However, I was wondering if you know about a good place to spend the evening? Some place to have fun?\"";
    if (!(QUEST_NorthTulimshar & $@knowCasinoNT))
        goto L_Close;
    menu
        "Of course! The casino!",L_CasinoFound,
        "Not really.",L_Close;

L_CasinoFound:
    set Zeny, Zeny + @casino_money;
    getexp @casino_exp, 0;
    set @state, 7;
    callfunc "SetKylianQuest";
    mes "[Kylian]";
    mes "\"Oh, there's a casino in this city? That's a wonderful thing. Where can I find it?\"";
    mes "You explain how to get to the casino.";
    next;
    goto L_Clothes;

L_Clothes: // @state == 7
    mes "[Kylian]";
    mes "\"I should get proper clothing before I go to the casino tonight. Do you know a reputable shop where clothing of high quality is sold?\"";
    if (!(QUEST_NorthTulimshar & $@knowLatoyNT))
        goto L_Close;
    menu
        "At the market near the harbor district...",L_HarborDistrict,
        "Mh, I don't know.",L_Close;

L_HarborDistrict:
    set Zeny, Zeny + @clothes_money;
    getexp @clothes_exp, 0;
    set @state, 8;
    callfunc "SetKylianQuest";
    set @KylianNTCasino, 1;
    mes "You explain about Latoy and his high quality shop.";
    mes "[Kylian]";
    mes "\"This seems to be exactly what I need. Thanks a lot.\"";
    goto L_Close;

L_CasinoDone:
    mes "[Kylian]";
    mes "\"I'm looking forward to going to the casino tonight. See me tomorrow.\"";
    goto L_Close;

L_DesertHat: // @state == 8
    mes "Kylian looks a bit tired.";
    mes "[Kylian]";
    mes "\"That was an interesting night. Thanks for your suggestion to visit the casino.\"";
    next;
    getinventorylist;
    mes "\"You helped me a lot, so I bought a souvenir for you while I was shopping.\"";
    if ((checkweight("DesertHat", 1) == 0) || (@inventorylist_count == 100))
        goto L_Inventory;
    getitem "DesertHat", 1;
    set @state, 9;
    callfunc "SetKylianQuest";
    next;
    goto L_Close;

L_Shop:
    mes "[Kylian]";
    mes "\"The Council of Wizards approved my shop license!\"";
    mes "\"I purchased a store just acorss the way from the hotel exit.\"";
    next;
    mes "\"If you are looking for work, go see the shop keeper I have working for me.\"";
    mes "\"Mention your name and he will know I sent you.\"";
    set @state, 10;
    callfunc "SetKylianQuest";
    goto L_Close;

L_OfferedJob:
    mes "[Kylian]";
    mes "\"I spoke with the shopkeeper, They said you haven't stopped in yet.\"";
    next;
    mes "\"I wish you would consider working for KPS.\"";
    next;
    mes "\"KPS needs a well-traveled go getter like you.\"";
    goto L_Close;

L_Helping:
    mes "[Kylian]";
    mes "\"I've heard you decided to come work for me. That is great news.\"";
    mes "\"Keep up the good work and I might have something a little extra for you.\"";
    goto L_Close;

L_Done:
    mes "[Kylian]";
    mes "\"Thanks a bunch, buisness is booming!\"";
    mes "\"For your hard work take this.\"";
    next;
    set Zeny, Zeny + $@delivery_money;
    getexp ($@delivery_exp_mod * BaseLevel), 0;
    set @run_cnt, 0;
    callfunc "SetKylianRunCnt";
    set @state, 12;
    callfunc "SetKylianQuest";
    mes "[" + $@delivery_money + " money]";
    mes "[" + ($@delivery_exp_mod * BaseLevel) + " experience points]";
    next;
    goto L_Close;

L_Inventory:
    mes "[Kylian]";
    mes "\"Oh, you're carrying a lot of things. Come back when you have more room.\"";
    goto L_Close;

L_NoItem:
    mes "[Kylian]";
    mes "\"I don't see it! Are you trying to tease me? This is not funny!\"";
    goto L_Close;

L_Close:
    set @acorn_amount, 0;
    set @suitcase_money, 0;
    set @suitcase_exp, 0;
    set @license_money, 0;
    set @license_exp, 0;
    set @sightseeing_money, 0;
    set @sightseeing_exp, 0;
    set @food_money, 0;
    set @food_exp, 0;
    set @clothes_money, 0;
    set @clothes_exp, 0;
    set @fun_money, 0;
    set @fun_exp, 0;
    set @inventorylist_count, 0;
    set @bernard, 0;
    // NOT set to zero: @KylianNTLicense, @KylianNTSightSeeing and @KylianNTCasino
    // those are used to check if the player logged out in the meanwhile
    close;
}
function|script|SetKylianQuest
{
    set QUEST_NorthTulimshar, (QUEST_NorthTulimshar & ~(NIBBLE_5_MASK)) | (@state << NIBBLE_5_SHIFT);
    return;
}
function|script|KylianDebug
{
    set @state, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT);
    callfunc "ClearVarTMW_Quest";
    set @bernard, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
    set @run, ((QUEST_NorthTulimshar & TWOBIT_8_MASK) >> TWOBIT_8_SHIFT);
    set @run_cnt, ((QUEST_NorthTulimshar & TWOBIT_9_MASK) >> TWOBIT_9_SHIFT);
    goto L_Menu;

L_Menu:
    mes "[Kylian Debug]";
    menu
        "Show Quest State", L_ShowState,
        "Set Quest State", L_SetState,
        "Reset Timer to now", L_WorkTimer,
        "Reset Timer + 24 hours", L_MoreWorkTimer,
        "Close.", L_Close;

L_ShowState:
    mes "State: " + @state;
    mes "Timer: " + Kylian_Timer;
    mes "Time: " + gettimetick(2);
    mes "Elapsed Time: " + (gettimetick(2) - Kylian_Timer);
    mes "Reset Timer: 86400 > " + (gettimetick(2) - Kylian_Timer);
    mes "Run: " + @run;
    mes "Run NPC: " + $@random_quests$[@run];
    mes "Run Count: " + @run_cnt;
    goto L_Menu;

L_SetState:
    mes "\"Input the quest state desired.\"";
    input @state;
    callfunc "SetKylianQuest";
    goto L_Menu;

L_WorkTimer:
    set Kylian_Timer, gettimetick(2);
    goto L_Menu;

L_MoreWorkTimer:
    set Kylian_Timer, (gettimetick(2) - 86401);
    goto L_Menu;

L_Close:
    close;
}
021-2.gat,87,55,0|script|KylianDebug#1|193
{
    callfunc "KylianDebug";
    end;
OnInit:
    if (!debug)
        disablenpc "KylianDebug#1";
    end;
}
021-2.gat,29,124,0|script|KylianDebug#2|193
{
    callfunc "KylianDebug";
    end;
OnInit:
    if (!debug)
        disablenpc "KylianDebug#2";
    end;
}