summaryrefslogtreecommitdiff
path: root/npc/001-8/hub.txt
blob: 51abfc2586e54d503276fac955d67cfbea0289f8 (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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
// TMW2 Script
// Author:
//    Ernando <ernando.quirino@hotmail.com> (Creator)
//    Jesusalva <admin@tmw2.org>
// Description:
//    Hunger Games™ version for The Mana World Brazil v2, created by Ernando Quirino.

001-8,0,0,0	script	#QuirinoHUB	NPC_HIDDEN,{
    end;

    // HUBspawn( mobID, amount )
    function HUBspawn {
        areamonster "001-8", 20, 20, 80, 80, strmobinfo(1, getarg(0)), getarg(0), getarg(1);
        return; }

    // HUBscatter( itemID )
    function HUBscatter {
        makeitem(getarg(0), 1, "001-8", rand(20,80), rand(20,80));
        return; }

    // HUBarrow()
    function HUBarrow {
        makeitem(rand(TrainingArrow,BoneArrow), rand(10,30), "001-8", rand(20,80), rand(20,80));
        return; }

    // HUBrandwpn( full )
    function HUBrandwpn {
        if (getarg(0)) {
            .@x=rand(20,80); .@y=rand(20,80);
        } else {
            .@x=rand(44,55); .@y=rand(46,54);
        }

        .@r=rand(1,8);
        switch(.@r){
        case 1:
        makeitem(rand(Knife, WoodenSword), 1, "001-8", .@x, .@y); break;
        case 2:
        makeitem(rand(SharpKnife, Dagger), 1, "001-8", .@x, .@y); break;
        case 3:
        makeitem(rand(ThunderStaff,Judgment), 1, "001-8", .@x, .@y); break;
        case 4:
        makeitem(rand(BronzeGladius,Scythe), 1, "001-8", .@x, .@y); break;
        case 5:
        makeitem(rand(WoodenBow, DesertBow), 1, "001-8", .@x, .@y); break;
        case 6:
        makeitem(rand(WoodenBow, ShortBow), 1, "001-8", .@x, .@y); break;
        case 7:
        makeitem(rand(ForestBow, BansheeBow), 1, "001-8", .@x, .@y); break;
        default:
        makeitem(WoodenShield, 1, "001-8", .@x, .@y); break;
        }

        return; }

// Only one player standing! CONGRATULATIONS, YOU HAVE WON!!
OnGameOver:
    .@u=getmapusers("001-8")-1;
    debugmes "OnGameOver Check: "+str(.@u);
    if (.@u == 1) {
        $@EQ_STATUS=2;
        maptimer("001-8", 10, "#QuirinoHUB::OnVictory");
        killmonsterall("001-8");
        stopnpctimer;
        cleanmap("001-8");
    }
    end;


// Ordered by GM to start.
OnStart:
    $@EQ_STATUS=1;

    // 2 Necklaces, 1 Charm and 1 Quiver
    makeitem(rand(1000,1003), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(1006,1011), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(1150,1151), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(1172,1174), 1, "001-8", rand(44,55), rand(46,54));

    makeitem(GoldenRing, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(SilverRing, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(SilverRing, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(PolishedDiamond,PolishedEmerald), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(PolishedDiamond,PolishedEmerald), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(PolishedDiamond,PolishedEmerald), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(TrainingArrow,BoneArrow), 50, "001-8", rand(44,55), rand(46,54));

    makeitem(CandorBoots, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(LousyMoccasins, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(CottonBoots, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(CreasedBoots, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(TulimsharGuardBoots, 1, "001-8", rand(44,55), rand(46,54));

    makeitem(rand(CreasedGloves, MinerGloves), 1, "001-8", rand(44,55), rand(46,54));

    makeitem(CottonShorts, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(JeansShorts, 1, "001-8", rand(44,55), rand(46,54));
    makeitem(PirateShorts, 1, "001-8", rand(44,55), rand(46,54));


    maptimer("001-8", 5000, "#QuirinoHUB::OnCount10");
    announce("##1HUNGRY QUIRIN EVENT: ##3##BCountdown: 15 seconds!", bc_all|bc_npc);
    end;

OnCount10:
    // Random arrows + weapon
    makeitem(rand(TrainingArrow,BoneArrow), 50, "001-8", rand(44,55), rand(46,54));

    // Random Weapon
    HUBrandwpn(0);

    // Throw some random, weighty stuff on the whole map.
    HUBscatter(rand(CopperOre, TitaniumOre));

    specialeffect(4, AREA, getcharid(3));
    addtimer(5000, "#QuirinoHUB::OnCount5");
    dispbottom l("10 seconds!");
    end;

OnCount5:
    specialeffect(4, AREA, getcharid(3));

    // Random Helmet
    .@r=rand(1,9);
    switch(.@r){
    case 1:
    makeitem(Bandana, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 2:
    makeitem(Bucket, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 3:
    makeitem(MoubooHat, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 4:
    makeitem(CandleHelmet, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 5:
    makeitem(PinkieHat, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 6:
    makeitem(GraduationCap, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 7:
    makeitem(SerfHat, 1, "001-8", rand(44,55), rand(46,54)); break;
    case 8:
    makeitem(MinerHat, 1, "001-8", rand(44,55), rand(46,54)); break;
    default:
    makeitem(PaperBag, 1, "001-8", rand(44,55), rand(46,54)); break;
    }

    // Throw some random, weighty stuff on the whole map.
    HUBscatter(rand(CopperIngot, TitaniumIngot));

    addtimer(5000, "#QuirinoHUB::OnBegin");
    dispbottom l("5 seconds!");
    end;

OnBegin:
    // Scatter some healing items, specially where the weapons are, to mess drop lists; Send armor too
    makeitem(rand(Acorn, Croconut), 1, "001-8", rand(44,55), rand(46,54));
    makeitem(rand(Manana, Carrot), 1, "001-8", rand(24,75), rand(26,74));
    makeitem(rand(RoastedMaggot, CherryCake), 1, "001-8", rand(24,75), rand(26,74));
    makeitem(rand(CreasedShirt, CandorShirt), 1, "001-8", rand(24,75), rand(26,74));
    HUBscatter(rand(BottleOfDivineWater, BottleOfSewerWater));

    // Scatter around whole map a few arrows, a training bow, a knife, a creased shirt and a creased knife
    HUBarrow();
    HUBscatter(TrainingBow);
    HUBscatter(Knife);
    HUBscatter(CreasedShirt);
    HUBscatter(CreasedShorts);

    // Throw some random stuff on the whole map.
    HUBscatter(rand(AquadaBox, WoodenLog));

    // Free player, let's start!
    delcells "qhubN";
    delcells "qhubS";
    setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE|PCBLOCK_COMMANDS, false);
    specialeffect(60, AREA, getcharid(3));
    specialeffect(11, AREA, getcharid(3));
    dispbottom col(l("Run! Event started!"), 1);
    initnpctimer; // Restart the timer to fix any desync.
    end;

// We only have a schedule for the first 15 minutes. This accelerate stuff.
OnSendWave:
    HUBspawn(AngryRedScorpion, 3);
    HUBspawn(BlackScorpion, 1);
    HUBscatter(rand(PiberriesInfusion,LachesisBrew));
    HUBscatter(CelestiaTea);
    HUBarrow();
    // Throw some ENTIRELY random stuff on the whole map.
    HUBscatter(rand(700, 713));
    HUBscatter(rand(731, 875));
    HUBrandwpn(1);
    HUBspawn(SlimeBlast, 1);
    end;

// 15 seconds after, I'm sure it is synced, so start spawning monsters.
OnTimer15000:
    HUBspawn(WhiteSlime, 3);
    HUBspawn(SlimeBlast, 1);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    end;


// one minute is due.
OnTimer60000:
    HUBspawn(RedSlime, 12);
    HUBspawn(SlimeBlast, 4);
    HUBarrow();
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    end;

// Two minutes are due.
OnTimer120000:
    HUBspawn(LavaSlime, 2);
    HUBspawn(GreenSlime, 2);
    HUBspawn(SeaSlime, 2);
    HUBspawn(CaveMaggot, 2);
    HUBspawn(Bandit, 2);
    HUBarrow();
    HUBarrow();
    HUBscatter(ElixirOfLife);
    HUBscatter(FatesPotion);
    HUBscatter(LachesisBrew);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    end;


// Three minutes are due.
OnTimer180000:
    HUBspawn(GreenSlime, 4);
    HUBspawn(SeaSlime, 4);
    HUBspawn(Squirrel, 4);
    HUBspawn(Snake, 1);
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBscatter(AshUrn);
    HUBscatter(Monocle);
    HUBscatter(GreenEggshellHat);
    HUBscatter(LeatherShirt);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    end;

// Five minutes are due.
OnTimer300000:
    HUBspawn(GreenSlime, 4);
    HUBspawn(AngryRedScorpion, 3);
    HUBspawn(Sarracenus, 1);
    HUBspawn(Snake, 2);
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBscatter(LeatherGloves);
    HUBrandwpn(1);
    HUBrandwpn(1);
    HUBscatter(GoldenPearlRing);
    HUBscatter(ElixirOfLife);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    HUBscatter(rand(731, 875));
    end;

// Nine minutes are due.
OnTimer540000:
    HUBspawn(BlackScorpion, 2);
    HUBspawn(DarkLizard, 3);
    HUBspawn(Tipiou, 2);
    HUBspawn(Snake, 2);
    HUBspawn(MountainSnake, 1);
    HUBspawn(SeaSlime, 2);
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBrandwpn(1);
    HUBrandwpn(1);
    HUBscatter(GoldenBlackPearlRing);
    HUBscatter(ElixirOfLife);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    HUBscatter(rand(731, 875));
    end;

// Fifteen minutes are due. No more random stuff will show.
OnTimer900000:
    HUBspawn(BlackScorpion, 4);
    HUBspawn(DarkLizard, 3);
    HUBspawn(Tipiou, 2);
    HUBspawn(Snake, 1);
    HUBspawn(MountainSnake, 2);
    HUBspawn(SeaSlime, 2);
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBarrow();
    HUBrandwpn(1);
    HUBrandwpn(1);
    HUBrandwpn(1);
    HUBscatter(ElixirOfLife);
    // Throw some random stuff on the whole map.
    HUBscatter(rand(731, 875));
    HUBscatter(rand(731, 875));
    HUBscatter(rand(731, 875));
    end;

OnVictory:
    @qhub_victor=1;
OnPCDieEvent:
    @qhub_died=1;
OnPCLogoutEvent:
    getmapxy(.@mapa$, .@a,.@b, 0);
    if (.@mapa$ == "001-8") {
        // Deal with the environment {
        .@u=getmapusers("001-8")-1;
        mapannounce("001-8", "Total remaining players: "+.@u,0);
        HUBscatter(rand(PiberriesInfusion,AtroposMixture));
        HUBscatter(CelestiaTea);
        HUBarrow();
        HUBspawn(SlimeBlast, 1);
        if (.@u % 2 == 1)
            HUBscatter(Piberries);
        if (.@u == 2) {
            mapannounce("001-8", "The wolves were released!",0);
            HUBscatter(ElixirOfLife);
            HUBscatter(Aquada);
            HUBscatter(Piberries);
            HUBscatter(Beer);
            HUBarrow();
            HUBspawn(Wolvern, 4);
            HUBspawn(NightScorpion, 2);
        }
        if (.@u == 1 && !@qhub_victor) {
            donpcevent "#QuirinoHUB::OnGameOver";
        }

        // } Deal with the player {
        clearitem();
        if (checkpcblock() & PCBLOCK_ATTACK)
            setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE|PCBLOCK_COMMANDS, false);

        // Check if to reduce clearitem() efficiency you've used the cart in an illegal way.
        getcartinventorylist();
    	if (@cartinventorylist_count>=1) {
            // Obviously a cheater, you should not be using the cart on the event. I HATE CHEATERS!
            // Destroy everything you had on the cart
            query_sql("DELETE FROM `cart_inventory` WHERE `char_id`="+getcharid(0));
            // Destroy the cart. Cheaters doesn't deserve it!!
            setcart(0);
            // Delete the storage register. You now need to pay it again, to don't cheat anymore!
            setq General_Banker, 0;
            // You'll also forsake any event reward.
            @qhub_victor=0;
            @qhub_died=0;
        }

        // If you are the victor (and didn't cheat), you can now hold your reward ;-)
        if (@qhub_victor) {
            getitem any(MercBoxA, MercBoxA, SilverGift, GoldenGift), 1;
            Zeny=Zeny+rand(500, 2500);
        }
        if (@qhub_died || @qhub_victor)
            getexp rand(100,300), 0; // Dying on this map is enough to get a reward. Logout = no reward.

        // You'll be revived/fully healed, and then warped.
        // FIXME: It will throw you in Nard's ship if you are on logout...
        recovery(getcharid(3));
        // If recovery() is broken:
        //atcommand "#alive \""+strcharinfo(0)+"\"";
        //percentheal 100, 100;
        warp "000-1", 22, 22;
    }

    // TODO: Checks which doesn't belong here shouldn't be here!
    // Died on Terranite Cave where exp penalty is lower
    if (.@mapa$ == "015-6" && @qhub_died) {
        if (readparam(BaseExp) < readparam(BaseExp)*2/100)
            end;
        recovery(getcharid(3));
        getexp readparam(BaseExp)*2/100, 0;
        warp "Save", 0, 0;
    }
    // Vanished on Cindy Cave
    if (.@mapa$ == "021-4" && strcharinfo(0) == $@CINDY_HERO$) {
        recovery(getcharid(3));
        warp any("010-1", "010-2"), 0, 0;
        percentheal -100, -100;
        sc_start2 SC_POISON, 1, 90, 10000;
    } else if (.@mapa$ == "021-4") {
        .@pl = getmapusers("021-4")-1;
        if (.@pl < 1)
            donpcevent("Cindy#Outside::OnCleanUp");
        recovery(getcharid(3));
        warp "Save", 0, 0;
    }
    // Logout while donating blood
    if (getq(HurnscaldQuest_BloodDonor) == 2) {
        slide 35, 28;
        setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE, false);
        setq HurnscaldQuest_BloodDonor, 0, gettimetick(2)+3600; // one hour penalty
    }
    // Logout/Death on Nard's ship hold
    if (.@mapa$ ~= "002-2") {
        setq2 ShipQuests_Peter, 0;
        setq3 ShipQuests_Peter, -1;
    }
    // Logout on botcheck area
    if (.@mapa$ ~= "botcheck" && !@qhub_died) {
        if (!is_staff())
            atcommand "@jail "+strcharinfo(0);
    }


    // I want to know if it is already safe to read your current exp
    // to implement a no-death-penalty and a halved-penalty system
    if (is_staff() && @qhub_died) {
        addtimer(200, "#QuirinoHUB::OnNoPenaltyCommand");
    }

    @qhub_victor=0;
    @qhub_died=0;
    end;

OnCancel:
    setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_ITEM|PCBLOCK_MOVE|PCBLOCK_COMMANDS, false);
    warp "Save", 0, 0;
    end;

OnNoPenaltyCommand:
    dispbottom l("Exp: @@", readparam(BaseExp));
    dispbottom l("JExp: @@", readparam(JobExp));
    end;
}