summaryrefslogtreecommitdiff
path: root/npc/functions/clientversion.txt
blob: bd33a48eecd31f2ec89a79d25395244aaa86e238 (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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
// TMW2 Scripts
// Evol functions.
// Author:
//    4144
//    Jesusalva
// Description:
//    Function checking the client version and reports if it is too old.
//    This also handles all updates, and usually have priority.

function	script	clientupdater	{
    // Skip any update for newcomers
    if (getmap() ~= "000-0*") {
        UPDATE=gettimetick(2);
    }

    .@dg=0;
    // Update handler (use `date +%s` for this)
    // Current UPDATE value: Qui Jun  7 08:10:55 -03 2018
    if (Lang > 5 && UPDATE < 1528369855) {
        UPDATE=1528369855;
        Lang=0;
        mesn "Jesus Saves";
        mesc l("Oh, noes! Due lack of translators, some languages were removed from this project.");
        mesc l("You might have been affected. Please, select your desired language.");
        asklanguage(LANG_IN_SHIP);
    }
    // Report client version for debugging purposes
    if (is_admin() && UPDATE < 1528369855) {
        UPDATE=1528369855;
        dispbottom l("Client Version: @@", ClientVersion); // This is to debug UPDATE system.
    }
    // New skills introduced
    if (UPDATE < 1531786864) {
        UPDATE=1531786864;
        skill TMW2_FAKESKILL, 1, 0;
        skill TMW2_FAKESKILL2, 1, 0;
    }
    // Update new quest exp, and make sure you have the extended basic skills with you
    if (UPDATE < 1545228412) {
        UPDATE=1545228412;
        adddefaultskills;
        if (getq(TulimsharQuests_Fishman) >= 2)
            getexp 12, 0;
        if (getq(MineQuest_Tycoon) >= 3)
            getexp 250, 0;
        if (getq(MineQuest_Tycoon) >= 6)
            getexp 642, 0;
        if (getq(MineQuest_Tycoon) >= 9)
            getexp 100, 0;
        if (getq(MineQuest_Tycoon) >= 12)
            getexp 2435, 0;
        if (getq(MineQuest_Tycoon) >= 15)
            Zeny=Zeny+1000;
        if (getq(TulimsharQuests_Sailors) >= 2)
            getexp 200, 0;
        if (getq(TulimsharQuests_Devoir) >= 1)
            getexp 500, 0;
        if (getq(TulimsharQuests_AnwarField) >= 11)
            getexp 650, 0;
        if (getq(TulimsharQuests_WoodenSword) >= 2)
            getexp 1100, 0; // Off value on purpose
        if (getq(MineQuest_Caelum) >= 2)
            getexp 2000, 40;
        if (getq(HalinarzoQuest_Foxhound) >= 6)
            getexp 1500, 0;
        if (getq(HalinarzoQuest_TraderKing) >= 2)
            getexp 5000, 0;
        if (getq(HurnscaldQuest_Bandits) >= 8)
            getexp 1000, 0; //getexp 5000, 0;

        dispbottom l("Your experience level has been updated.");
    }
    // Gallery Contest and 2019-12-29 no-drop incident
    // ter jan  8 03:52:20 -02 2019
    if (UPDATE < 1546926740) {
        UPDATE=1546926740;
        .@u$=strtolower(strcharinfo(0));
        setarray .@apology$, "jesusalva", "mrhedx", "ziah", "soren xd", "warblade", "yuxin", "xtreem", "monking", "demure gm", "se francisc";
        setarray .@gallery$, "jesusalva", "mishana", "bobr", "demure", "lawncable";

        // Users connected during nodrop incident (2018-12-29)
        // Jesusalva Mrhedx Ziah "Soren xd" WarBlade
        // yuxin Xtreem monking "demure GM" "Se Francisc"
        if (array_exists(.@apology$, .@u$)) {
                getitembound GoldenGift, 1, 1;
                Zeny=Zeny+570;
                .@dg=1;
                showavatar NPC_LOF_RICH;
                mesn ("TMW2 Staff");
                mesc l("Hello, @@! We just looked up and found out you were active during 2018-12-29!", strcharinfo(0)), 3;
                mesc l("And during that time, item dropped was bugged! We wanted to deliver you a token of apology!"), 3;
                mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
                mesc l("Token Of Apology: 1x @@, 570 GP", getitemlink(GoldenGift));
                next;
        }

        // 1st Gallery Contest Participants
        // Mishana LawnCable bObr Jesusalva demure
        if (array_exists(.@gallery$, .@u$)) {
                getitem StrangeCoin, 30;
                .@dg=1;
                showavatar NPC_LOF_RICH;
                mesn ("TMW2 Staff");
                mesc l("Hello, @@! We are proud to announce the @@ RESULTS!", strcharinfo(0) , b(l("1° Screenshooting Contest"))), 3;
                mesc l("Participants: Jesusalva * mishana * bObr * demure * LawnCable"), 3;
                next;
                mesc ("Mishana Entries: Happy"), 3;
                mesc ("LawnCable Entries: Login Screen, TMW2 Field"), 3;
                mesc ("Demure Entries: Buggy Map"), 3;
                mesc ("Jesusalva Entries: LoF Secret Island, GM Plotting Evil Scheme For Next Event, Crazyfefe Cave"), 3;
                mesc ("bObr Entries: My Very Own Tiny Orchard"), 3;
                next;
                mesc l("1st Place - Mishana, LawnCable, Jesusalva, bObr");
                mesc l("5th Place - Demure");
                mes "";
                mesc l("Hey, look, a tie happened!");
                mesc l("How's that even possible? Well, 30 @@ for all contestants!", getitemlink(StrangeCoin));
                next;
        }
    }
    // Valentine Day Event Bug
    // sex fev 15 18:04:00 -02 2019
    if (UPDATE < 1550261040) {
        UPDATE=1550261040;
        if (#VALENTINE_POINTS) {
            .@dg=1;
            showavatar NPC_LOF_RICH;
            mesn ("TMW2 Staff");
            mesc l("Hello, @@! We just looked up and found out you that you were affected on a Valentine Event bug!", strcharinfo(0)), 3;
            mesc l("Due this bug, you didn't got a proper amount of points per sent. We wanted to deliver you a token of apology!"), 3;
            mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
            mesc l("Token Of Apology: 1x @@, 1x @@", getitemlink(SilverGift), getitemlink(MercBoxB));
            getitem SilverGift, 1;
            getitem MercBoxB, 1;
            #VALENTINE_POINTS=0;
            next;
        }
    }
    // Limited bots
    // sex fev 15 23:22:21 -02 2019
    if (UPDATE < 1550280141) {
        UPDATE=1550280141;

        .@dg=1;
        mesc l("Game Rules were updated!"), 1;
        mesc l("Use @@ to read the new version.", "@rules"), 1;
        mes "";
        //GameRules S_NO_NPC_NAME | S_LAST_NEXT;
    }
    // Msawis bug
    // ter fev 19 12:15:00 -03 2019
    if (UPDATE < 1550589300) {
        UPDATE=1550589300;
        if (strcharinfo(0) == "msawis") {
            .@dg=1;
            showavatar NPC_LOF_RICH;
            mesn ("TMW2 Staff");
            mesc l("Hello, @@! We just looked up and found out that you were affected by BotCheck Logout rules!", strcharinfo(0)), 3;
            mesc l("First of, you didn't logged in. Without you online, WE CANNOT UNJAIL YOU! We tried with SQL but it didn't budge."), 3;
            mesc l("Due this bug, when you logged off on the BotCheck Area, @@. We wanted to deliver you a token of apology!", b(l("the server jailed you"))), 3;
            mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
            mesc l("Token Of Apology: 1x @@, 1x @@", getitemlink(SupremeGift), getitemlink(MercBoxC));
            mes "";
            mesc l("Please contact @@ to clear this misunderstanding.", b("Jesusalva")), 1;
            getitem SupremeGift, 1;
            getitem MercBoxC, 1;

            // Better safe than sorry
            atcommand "@unjail msawis";
            // I dunno if my SQL query broke something so...........
            sc_end SC_JAILED;
            if (getmap() ~= "sec_pri")
                warp "Save", 0, 0;
            next;
        }
        if (strcharinfo(0) == "vilbou") {
            atcommand "@unjail vilbou";
            sc_end SC_JAILED;
            if (getmap() ~= "sec_pri")
                warp "Save", 0, 0;
            getitem MercBoxC, 1;
        }
        // Unclaimed Rewards
        // 2000283 Msawis 10 points
        // 2000552 Mrhedx 4 points
        // 2000299 vilbou 1 point
        setarray .@apology, 2000552, 2000283, 2000299;
        if (array_exists(.@apology, getcharid(3)) && (#VALENTINE_SENT+#VALENTINE_OPENED) > 0) {
            if (getcharid(3) == 2000552) {
                getitem BronzeGift, 1;
            } else if (getcharid(3) == 2000283) {
                getitem GoldenGift, 1;
            } else if (getcharid(3) == 2000299) {
                getitem StrangeCoin, 1;
            }
            dispbottom l("Valentine Day Event Reward automatically claimed");
            #VALENTINE_SENT=0;
            #VALENTINE_OPENED=0;
            #VALENTINE_RECEIVED=0;
        }
    }
    // Update Tycoon quest exp
    // dom mar  3 12:22:04 -03 2019
    if (UPDATE < 1551626524) {
        UPDATE=1551626524;
        if (getq(MineQuest_Tycoon) >= 15)
            getexp 43000, 0;
    }
    // Update Karma for the flexibility I need
    // sex mar 15 18:10:00 -03 2019
    if (UPDATE < 1552684200) {
        UPDATE=1552684200;
        if (Karma >= 250)
            Karma=98;
        else
            Karma=100+Karma;
    }
    // Update Tycoon quest Miner Knife + Hinnak & Oscar Scythe + @ucp
    // ter mar 26 10:00:22 -03 2019
    if (UPDATE < 1553605222) {
        if (UPDATE <= 1551626524) {
            if (getq(MineQuest_Tycoon) >= 6) {
                getitem MinerKnife, 1;
            }
        }
        if (getq(HurnscaldQuest_Farmers) >= 2 && getq(HurnscaldQuest_Farmers) < 5) {
            getitem Scythe, 1;
        } else if (getq(HurnscaldQuest_Farmers) >= 5) {
            getitem CottonBoots, 1;
        }
        .@dg=1;
        mesc l("WARNING: Use @ucp to change @@.", b(l("GAME SETTINGS"))), 1;
        mesc l("New default game settings:");
        mesc l(" - Soul Menhir auto-saving");
        mesc l(" - Daily Login Screen");
        mes "";
        mesc b(l("These can be reverted to previous behavior on User Control Panel!")), 3;
        mes "";
        if (countitem(LEGACY_MiereCleaver))
            mesc l("Your @@ Knockback effect expired.", getitemlink(LEGACY_MiereCleaver)), 1;
        if (countitem(LEGACY_Broadsword))
            mesc l("Your @@ Knockback effect expired.", getitemlink(LEGACY_Broadsword)), 1;
        UPDATE=1553605222;
    }
    // Shovel Auto-dig option
    // seg mai 27 21:22:55 -03 2019
    if (UPDATE < 1559002975) {
        UPDATE=1559002975;
        if (countitem(IronShovel) + countitem(SteelShovel))
            dispbottom l("Shovel have been changed, right-click it to bury items.");
    }
    // General Updates
    // sex jun 21 13:20:21 -03 2019
    if (UPDATE < 1561134021) {
        UPDATE=1561134021;
        if (Karma >= 200)
            Karma=98;
        else if (Karma < 80)
            Karma=100+Karma;
        if (getq(General_Narrator) >= 3)
            getitem MercBoxAA, 1;
        // Well, you don't need this crap I hope...
        if (BaseLevel < 40)
            getitem TulimMap, 1;
        if (getq(TulimsharQuest_Sailors) == 4)
            getexp 1508, 15;
        .@cr=countitem(CroconutBox);
        if (.@cr) {
            getitem CroconutBox, .@cr;
            dispbottom l("Croconut Box magically became two in inventory. Storage unaffected."); // Too much hassle affecting storage/cart/etc.
        }
    }
    // General Updates
    // seg jul 15 16:41:35 -03 2019
    if (UPDATE < 1563219695) {
        UPDATE=1563219695;
        .@dg=true;
        mesc l(".:: This is Release 9.5 Academy ::."), 0;
        //mesc l(".:: This is Release 10.0 Infinity ::."), 0;
        // Fix mounts
        unequip(EQI_SHADOW_SHOES);
		setmount 0;
        // You got recipe book by BSS Quest - mark as complete and get Blueprint
        if (getq(NivalisQuest_BlueSageSlimes) == 2) {
            getitem any(AncientBlueprint, AlchemyBlueprintA, EquipmentBlueprintA), 1;
            CRAFTQUEST=1;
            mesc l("You got a blueprint as reward for Blue Sage Slimes Quest completion."), 3;
        }
        // If you have TMW2_CRAFT skill, you need the bonus recipe
        if (getskilllv(TMW2_CRAFT)) {
            RECIPES_EQUIPMENT[CraftDagger]=true;
            mesc l("Dagger Crafting recipe learnt."), 2;
        }
        // Bounty Hunter Helmet
        if (MERCENARY_DAILYQUEST > 100) {
            getitem BountyHunterHelmet, 1;
            mesc l("You got a @@ for completing 100+ daily bountyhunter quests!", getitemlink(BountyHunterHelmet)), 2;
        }
        // Cindy quest new rewards
        if (getq(NivalisQuest_Cindy) >= 3) {
            getexp 120000, 0;
            mesc l("You got 120,000 XP for completing Mercury's quest."), 2;
        }
        // Mercenary Rank removed
        if (MERC_RANK) {
            THIEF_RANK=MERC_RANK;
            THIEF_EXP=MERC_EXP;
            MERC_RANK=0;
            MERC_EXP=0;
            mesc l("Your class has been changed from %s to %s.", b(l("Merchant Police")), b(l("Thief"))), 1;
        }
        if (getskilllv(ALL_INCCARRY)) {
            skill TF_STEAL, getskilllv(ALL_INCCARRY);
            skill ALL_INCCARRY, 0, 0;
            mesc l("Increase Weight skill replaced with Stealing.");
        }
        // NEW MAGIC SYSTEM
        if (getskilllv(SN_SHARPSHOOTING)) {
            skill AC_CHARGEARROW, getskilllv(SN_SHARPSHOOTING);
            skill AC_CHARGEARROW, 0, 0;
            getexp 2000, 150;
            mesc l("Sharpshooting skill replaced with Charged Arrow."), 1;
            mesc l("You've got 2000 xp and 150 job xp in apology tokens.");
        }
        getskilllist();
        for (.@i=0; .@i < @skilllist_count; .@i++) {
            // skip temporary skills
            if (@skilllist_flag[.@i] != 0)
                continue;
            // Only “paid” skills will result in a Scholarship Badge
            .@id=@skilllist_id[.@i];
            .@am=0;
            switch (.@id) {
                case SM_BASH:
                case TMW2_DEMURE:
                case MG_FIREBALL:
                case MG_SRECOVERY:
                case AL_DP:
                    .@am=1;
                case SM_ENDURE:
                case KN_AUTOCOUNTER:
                case KN_TWOHANDQUICKEN:
                case AL_ANGELUS:
                case CR_TRUST:
                case CR_DEFENDER:
                case AL_HOLYLIGHT:
                case TF_DETOXIFY:
                case ALL_RESURRECTION:
                case SM_RECOVERY:
                case PR_ASPERSIO:
                case AB_HIGHNESSHEAL:
                case SA_FREECAST:
                case SA_DRAGONOLOGY:
                case TMW2_SAGE:
                case SA_FLAMELAUNCHER:
                case SA_FROSTWEAPON:
                case SA_LIGHTNINGLOADER:
                case SA_SEISMICWEAPON:
                case MG_ENERGYCOAT:
                case MG_NAPALMBEAT:
                case MG_FIREBOLT:
                case MG_COLDBOLT:
                case MG_LIGHTNINGBOLT:
                case WZ_EARTHSPIKE:
                    mesc l("A skill has been replaced with an @@.", getitemlink(ScholarshipBadge));
                    if (!.@am)
                        .@am=min(5, @skilllist_lv[.@i]);

                    getitem ScholarshipBadge, .@am;
                    skill @skilllist_id[.@i], 0, 0;
                    getexp 5, (@skilllist_lv[.@i]-1)*1000;
                    break;
                // Free skills (AL_HEAL and mass provoke) will result in XP
                // Only Jakod's skills with level 3+ will result in a badge
                case AL_HEAL:
                case EVOL_MASS_PROVOKE:
                    if (@skilllist_lv[.@i] >= 3)
                        getitem ScholarshipBadge, 1;
                case SM_PROVOKE:
                case NV_TRICKDEAD:
                    .@delval=@skilllist_lv[.@i];
                    mesc l("A skill has been removed, you got @@ job exp and @@ Strange Coin as an apology token.", .@delval*100, .@delval);
                    skill @skilllist_id[.@i], 0, 0;
                    getexp .@delval, .@delval*100;
                    getitem StrangeCoin, .@delval;
                    break;
            }
        }
        // Grant you AL_DP based on magic level
        if (MAGIC_LVL) {
            skill AL_DP, MAGIC_LVL, 0;
            mesc l("You have learnt \"Divine Protection\" level @@.", MAGIC_LVL), 3;
        }
        // Grant you Thief Skill Tier 3
        if (THIEF_RANK >= 3) {
            skill(ALL_INCCARRY,1,0);
            mesc l("You have learnt \"Increase Weight\" in Thief Skills."), 2;
        }
        // If you got a Scholarship Badge, you need to travel to Tulimshar.
        // Give you a Warp Crystal to do so.
        if (countitem(ScholarshipBadge)) {
            getitem TulimWarpCrystal, 1;
            mesc l("You've obtained a @@ to visit Magic Academy.", getitemlink(TulimWarpCrystal)), 1;
        }
        // Cleanup
        deletearray RNGTREASURE_DATE;
    }


    // #ADD_LVL means the user have to right to get some levels. This is a sketch. The code might be deleted.
    if (#ADD_LVL) {
        .@dg=1;
        mesn "Jesus Saves";
        mesc l("Oh - Welcome to TMW2: Moubootaur Legends!"), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Please, fell at home. You can use ##B#world##b channel to speak to everyone on Discord, IRC and ingame."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Our mission statement is to bring fun to all players. You'll get some levels automatically. We advise you to join a guild."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("If you have any trouble or doubt, don't hesit to call us. There are some cooperative quests, and more of them are being added."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Anyway, ##Bwelcome##b, and have fun! If you need anything, we are a keypress from distance!"), 3;
        //atcommand "@blvl "+#ADD_LVL;
        //getitem TimeFlask, 1;
        #ADD_LVL=(#ADD_LVL*9)/10;
        if ((readparam(BaseExp)+#ADD_LVL > readparam(NextBaseExp))) {
            do {
                .@v=readparam(NextBaseExp)-readparam(BaseExp);
                getexp .@v, 0;
                #ADD_LVL-=.@v;
            } while (readparam(BaseExp)+#ADD_LVL > readparam(NextBaseExp));
        }
        getexp #ADD_LVL, 0;
        #ADD_LVL=0;
        // TODO: Use @super debug functions and force player to join a guild. We will need the guild ID, though.
        rodex_sendmail(getcharid(0), "TMW2 Team", "Welcome to Moubootaur Legends", "Hey, thanks for believing on us! We hope to have a great time togheter. Any problem, ask for help in #world - the Discord bridge! Enjoy our game!", 20);
    }


    if (.@dg)
        closeclientdialog;
    return;

}

// Just be sure your client version is OK
function	script	checkclientversion	{
    if (ClientVersion >= 25)
        return;

    mesn "Narrator";
    mesc l("Warning."), 1;
    mesc l("Warning."), 1;
    mesc l("Warning: You are using an old client."), 1;
    next;
    mesc l("Please install the new client from [@@https://manaplus.org/|https://manaplus.org/@@]");
    mesc l("Or use our awesome [@@https://tmw2.org/manalauncher/InstallManaLauncher.exe|Mana Launcher@@] if you're on Windows.");
    next;
    if (ClientVersion >= 22) mesc l("Compatibility Support mode enabled. Client may crash AT RANDOM, beware.");
    if (ClientVersion >= 22) mesc l("Crazy stuff can happen in overall. YOU HAVE BEEN WARNED TO UPDATE YOUR CLIENT.");
    if (ClientVersion >= 22) closeclientdialog;
    if (ClientVersion >= 22) return;
    mesc l("You won't be allowed to play this game until you have an updated client.");
    next;
    // Force user to disconnect
    atcommand "@kick "+strcharinfo(0);
    return;
}