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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
// TMW 2 Script
// Author:
// Jesusalva
// Micksha
// Description:
// Part of Kamelot Guild Dungeon
// TODO: Random guard (Tezer) on the cursed soldier statues (easter egg)
042-0,58,28,0 script King Arthur NPC_KING_ARTHUR,{
function arthurSpawn;
.@g=getcharid(2);
.@pos=getguildrole(.@g, getcharid(3));
if (.@pos > GPOS_VICELEADER) goto L_Refusal;
if (!$KAMELOT_COOLDOWN[.@g]) goto L_Tutorial;
if ($KAMELOT_QUEST[.@g] & 1) goto L_Progress;
// TODO: Curse lifted scene until next week
goto L_Prologue;
L_Prologue:
mesn l("King Arthur the Micksha");
mes l("Hello Adventurer.");
next;
mesn l("King Arthur the Micksha");
mes l("So good you are here. We have a huge problem.");
next;
npctalk l("JAIL THEM!!");
mesn l("King Arthur the Corrupted");
mes col(l("JAIL THEM!!"), 9)+l(" -- No, wait!");
next;
select
l("What is going on here?"),
l("Your problems are not mine. By the way, you really should consider taking a shower."),
l("[TUTORIAL]"),
l("You are weird, I have to go, sorry.");
mes "";
switch (@menu) {
case 1:
goto L_Quest;
case 2:
if (any(true, true, true, true, false))
goto L_Smash;
else
goto L_Annoyed;
case 3:
goto L_Tutorial;
case 4:
if (!any(true, true, true, true, false))
goto L_Smash;
else
goto L_Annoyed;
}
close;
L_Quest:
mesn l("King Arthur the Micksha");
mes l("Something is happening down there.");
next;
npctalk l("GUARDS! GET THEM!");
mesn l("King Arthur the Corrupted");
mes l("It is so dangerous, and it... ")+col(l("GUARDS! GET THEM!"), 9);
next;
mesn l("King Arthur the Micksha");
mes l("You must be fast! The guards are also affected.");
next;
npctalk l("OFF WITH THEIR HEADS!");
mesn l("King Arthur the Corrupted");
mes col(l("OFF WITH THEIR HEADS!"), 9)+l(" Take this key, it opens the door behind my throne.");
next;
npctalk l("AFTER THEM!!");
mesn l("King Arthur the Corrupted");
mes l("Be careful! ")+col(l("AFTER THEM!!"), 9);
next;
// Be sure the quest only starts now, and destroy any eventual artifact
getguildmember(.@g, 2); // 2 = count by account IDs
$KAMELOT_QUEST[.@g]=1;
$KAMELOT_MX[.@g]=getguildavg(.@g);
$KAMELOT_PC[.@g]=$@guildmembercount;
$KAMELOT_KEYMASK[.@g]=any(1,2,4,8);
if (!is_admin()) // FIXME: This should be unconditional
$KAMELOT_COOLDOWN[.@g] = gettimeparam(GETTIME_WEEKDAY);
mapannounce(getmap(), "##1KAMELOT CASTLE, GUILD DUNGEON: MISSION START!", bc_map);
// Spawn a few foot soldiers
arthurSpawn(1, 25, 29, 43, 37);
arthurSpawn(3, 22, 43, 43, 73);
arthurSpawn(5, 76, 55, 98, 77);
mesc l(".:: KAMELOT CASTLE, THE GUILD DUNGEON ::."), 1;
mes "";
mes l("1. Investigate Kamelot Basements");
mes l("2. Free Kamelot from its curse!");
close;
//////////////////////////////////////////////////////////////////////////
// King manages to control himself
L_Annoyed:
npctalk l("Don't bore me.");
closeclientdialog;
close;
// King loses his coolness.
L_Smash:
npctalk l("MEEEEEERLIN!!! SMASH THEM!!");
maptimer(getmap(), 300, instance_npcname(.name$)+"::OnPreSmash");
closeclientdialog;
close;
OnPreSmash:
specialeffect FX_CUPID, AREA, getcharid(3);
addtimer(380, instance_npcname(.name$)+"::OnSmash");
end;
OnSmash:
percentheal -100, -100;
end;
//////////////////////////////////////////////////////////////////////////
L_Progress:
// TODO: Victory Reward
npctalk l("What are you still doing here?! GO!!");
mes l("Read tutorial again?");
next;
if (askyesno() == ASK_YES) goto L_Tutorial;
close;
//////////////////////////////////////////////////////////////////////////
L_Tutorial:
// Update variable
if ($KAMELOT_COOLDOWN[.@g] != gettimeparam(GETTIME_WEEKDAY))
$KAMELOT_COOLDOWN[.@g]=gettimeparam(GETTIME_WEEKDAY)-1;
mes b(".:: KAMELOT CASTLE ::.");
mes "The Guild Dungeon of Kamelot Castle";
mes "";
mes l("Kamelot Castle is a GUILD DUNGEON which refreshes WEEKLY.");
mes l("Only the Guild Master and the Vice Leaders are capable of starting this quest.");
next;
mes l("An unlimited number of members can join.");
mes l("Once the quest is started, entrance will be closed.");
mes l("No one can go out during the quest, so ensure every guild member has proper equipment, potions, and time for this dungeon.");
next;
mes l("Additionally, for the optimal experience, ensure your party has at least the following members:");
mes "";
mes l("* Thief");
mes l("* Mage");
next;
mes b(".:: VICTORY REWARDS ::.");
mes l("Victory prizes include guild experience, guild money, and guild bound items.");
mes "";
mes b(".:: DEFEAT PENALTIES ::.");
mes l("If your guild is defeat during the quest, you'll need to wait the weekly cooldown to expire.");
mes "";
mes "----------------- by Lancelot";
next;
clear;
if ($KAMELOT_QUEST[.@g] & 1) goto L_Progress;
goto L_Prologue;
//////////////////////////////////////////////////////////////////////////
L_Refusal:
mesc l("This man is THE LEGENDARY KING ARTHUR!");
mes "";
mesc l("I better leave talking to him to the guild Vice Leaders and Master.");
close;
OnKillMob:
if (!playerattached()) end;
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
getexp $KAMELOT_MX[.@g], $KAMELOT_MX[.@g]/2+1;
end;
function arthurSpawn {
.@label$=instance_npcname(.name$)+"::OnKillMob";
.@gcount=getarg(0);
.@x1=getarg(1);
.@x2=getarg(3);
.@y1=getarg(2);
.@y2=getarg(4);
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
.@avg=$KAMELOT_MX[.@g];
.@m$=getmap();
for (.@i=0; .@i < .@gcount; .@i++) {
.@mobId=CursedSoldier;
.@mob=areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mobId), .@mobId, 1, .@label$);
// Reconfigure the monster
setunitdata(.@mob, UDT_LEVEL, .@avg);
setunitdata(.@mob, UDT_STR, 1+.@avg/6);
setunitdata(.@mob, UDT_AGI, 1+.@avg/7);
setunitdata(.@mob, UDT_VIT, 1+.@avg/6);
setunitdata(.@mob, UDT_INT, 1+.@avg/6);
setunitdata(.@mob, UDT_DEX, 1+.@avg/7);
setunitdata(.@mob, UDT_LUK, 1+.@avg/6);
setunitdata(.@mob, UDT_ADELAY, 2072);
setunitdata(.@mob, UDT_ATKRANGE, 1);
// Battle Status
setunitdata(.@mob, UDT_MAXHP, .@avg*20);
setunitdata(.@mob, UDT_HP, .@avg*20);
setunitdata(.@mob, UDT_ATKMIN, .@avg*3);
setunitdata(.@mob, UDT_ATKMAX, .@avg*5);
setunitdata(.@mob, UDT_DEF, 1+.@avg*6/10);
setunitdata(.@mob, UDT_MDEF, 1+.@avg*3/10);
setunitdata(.@mob, UDT_HIT, .@avg*35/10); // Advised: x3
setunitdata(.@mob, UDT_FLEE, .@avg*25/10); // Advised: x4
// Critical calculation
.@min=1;
.@max=max(.@min, min(15, .@avg/6));
setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max));
// Loop through
}
freeloop(false);
return;
}
OnInit:
.distance=4;
.sex=G_MALE;
npcsit;
end;
OnInstanceInit:
.distance=4;
.sex=G_MALE;
npcsit;
end;
}
042-0,69,24,0 script #K042-0_69_24 NPC_HIDDEN,0,0,{
end;
OnTouch:
.@g=getcharid(2);
if ($KAMELOT_QUEST[.@g] & 1) {
warp "042-1@"+.@g, 55, 99;
} else {
dispbottom l("The door is locked.");
end;
}
// Maybe event must be fired
if (!($KAMELOT_KEYMASK[.@g] & 16)) {
.@label$=instance_npcname("#KDoor0421", $@KAMELOT_ID[.@g])+"::OnArrival";
deltimer .@label$;
addtimer 15000, .@label$;
}
end;
}
042-0,86,27,0 script Guinevere NPC_GUINEVERE,{
function guinevereSpawn;
.@g=getcharid(2);
.@pos=getguildrole(.@g, getcharid(3));
if (.@pos > GPOS_VICELEADER) goto L_Refusal;
if ($KAMELOT_QUEST[.@g] & 1) goto L_Hint;
npctalk3 l("Oh, hello %s.", strcharinfo(0));
end;
L_Refusal:
mesn;
mesq l("Hello, %s.", strcharinfo(0));
next;
mesc "["+strcharinfo(0)+"]";
mesc l("She doesn't seems to trust me... Maybe I should bring a guild vice-leader, or even better, the guild master himself.");
close;
L_Hint:
mesc l("Guinevere is the King's Wife. If you talk to her, the King will be upset and will send soldiers to you."), 1;
next;
mesc l("However, she may have a better assessment of the current situation better than you and your allies."), 1;
next;
mesc l("Continue anyway? You'll die if your allies cannot protect you!"), 1;
next;
if (askyesno() == ASK_NO)
close;
// Okay... So here we go (again), spawning monsters
guinevereSpawn(1);
mesn;
mesq l("Ah, %s, a good thing you're here. You must help!", strcharinfo(0));
next;
guinevereSpawn(1);
mesn;
mesq l("Something very terrible happened.");
next;
guinevereSpawn(2);
mesn;
mesq l("They're back - and they took hold of your majesty - my husband - king Arthur!");
next;
guinevereSpawn(2);
mesn;
mesq l("Of course, he doesn't likes the fact you're talking to me.");
next;
guinevereSpawn(3);
mesn;
mesq l("*They* couldn't take hold of me, but I'm bound to this castle; I can't leave.");
next;
guinevereSpawn(3);
mesn;
mesq l("They are in the basement, pulling the strings from behind.");
next;
guinevereSpawn(3);
mesn;
mesq l("The way is full of dangers. Not only king soldiers, but the beast has an army of their own!");
next;
guinevereSpawn(4);
mesn;
mesq l("You need to be very careful. Use the sewers to reach... them.");
next;
guinevereSpawn(4);
mesn;
mesq l("Also, listen well, because there are traps and dangers on the whole way. Their leader sealed themselves in safety.");
next;
guinevereSpawn(5);
mesn;
mesq l("I'm afraid you'll need a key to reach them. But there's a fork on the way.");
next;
guinevereSpawn(3);
mesn;
switch ($KAMELOT_KEYMASK[.@g]) {
case 1:
.@path$=l("West"); break;
case 2:
.@path$=l("North West"); break;
case 4:
.@path$=l("North East"); break;
case 8:
.@path$=l("East"); break;
default:
.@path$=l("ERROR, REPORT ME: Invalid: %d", $KAMELOT_KEYMASK[.@g]); break;
}
mesq l("The key is on the sewer %s path. Be careful. May the light be with you.", b(.@path$));
if ($KAMELOT_QUEST[.@g] & 2)
close;
next;
guinevereSpawn(5);
mesn;
mesq l("And one more thing...");
next;
guinevereSpawn(2);
mesn;
mesq l("Take this with you. And please bring Arthur back, the world needs him!");
$KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|2;
// Player Reward for completing this stage
getitem SacredImmortalityPotion, 1;
getitem GuildCoin, 5;
// Guild Reward for completing this stage
.@ggp=100+$KAMELOT_MX[.@g]*4;
.@gxp=$KAMELOT_MX[.@g]*2;
$GUILD_BANK[.@g]+=.@ggp;
guildgetexp(.@gxp); // 2xp per player average level (max 200/300)
// Guild Master Notification
.@gm$=getguildmaster(.@g);
if (!getcharid(3, .@gm$)) end;
.@gma=getcharid(3, .@gm$);
.@gmb=getcharid(0, .@gm$);
if (!isloggedin(.@gma, .@gmb)) end;
message .@gm$, strcharinfo(0)+" cleared Guinevere: Guild GP +"+.@ggp+" Guild XP +"+.@gxp;
close;
OnKillMob:
if (!playerattached()) end;
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
getexp $KAMELOT_MX[.@g]*2, $KAMELOT_MX[.@g];
end;
function guinevereSpawn {
.@label$=instance_npcname(.name$)+"::OnKillMob";
.@gcount=getarg(0);
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
.@avg=$KAMELOT_MX[.@g];
.@m$=getmap();
for (.@i=0; .@i < .@gcount; .@i++) {
.@mobId=CursedSoldier;
.@mob=areamonster(.@m$, 82, 26, 90, 34, strmobinfo(1, .@mobId), .@mobId, 1, .@label$);
// Reconfigure the monster
setunitdata(.@mob, UDT_LEVEL, .@avg);
setunitdata(.@mob, UDT_STR, 1+.@avg/6);
setunitdata(.@mob, UDT_AGI, 1+.@avg/7);
setunitdata(.@mob, UDT_VIT, 1+.@avg/6);
setunitdata(.@mob, UDT_INT, 1+.@avg/6);
setunitdata(.@mob, UDT_DEX, 1+.@avg/7);
setunitdata(.@mob, UDT_LUK, 1+.@avg/6);
setunitdata(.@mob, UDT_ADELAY, 2072);
setunitdata(.@mob, UDT_ATKRANGE, 1);
// Battle Status
setunitdata(.@mob, UDT_MAXHP, .@avg*20);
setunitdata(.@mob, UDT_HP, .@avg*20);
setunitdata(.@mob, UDT_ATKMIN, .@avg*3);
setunitdata(.@mob, UDT_ATKMAX, .@avg*5);
setunitdata(.@mob, UDT_DEF, 1+.@avg*6/10);
setunitdata(.@mob, UDT_MDEF, 1+.@avg*3/10);
setunitdata(.@mob, UDT_HIT, .@avg*3); // Advised: x3
setunitdata(.@mob, UDT_FLEE, .@avg*25/10); // Advised: x4
// Critical calculation
.@min=1;
.@max=max(.@min, min(15, .@avg/6));
setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max));
// Loop through
}
freeloop(false);
return;
}
OnInit:
OnInstanceInit:
.distance=4;
.sex=G_FEMALE;
end;
}
|