summaryrefslogtreecommitdiff
path: root/npc/functions/clientversion.txt
blob: 92ac34f4577b68d49e68027ce70023bc8a574b71 (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
// 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	{
	// Bugfix
	if (!TUT_VAR && UPDATE)
		TUT_VAR=UPDATE;
    // Skip any update for newcomers
    if (compare(getmap(), "000-0") || $@NOUPDATES) {
        UPDATE=gettimetick(2);
    }
    // If you're in Jail, show a minor message
    if (getmap() == "sec_pri") {
        dispbottom l("You seem to be jailed. We cannot unjail offline players, so please don't logout.");
        dispbottom l("You have the right to defend yourself if you believe we were wrong. If we find out it's true, you'll receive an apology gift.");
        dispbottom l("Note: Unless you were doing something REALLY bad which is harmful to player community (eg. scamming, hacking, DDoS'ing, etc.)");
        dispbottom l("Please contact a GM as soon as possible so we can make out a compromise. You should be liberated even if found guilty.");
    }

    .@dg=0;
    /*
    // Magic v3 regression
    // ter jul  7 18:42:22 BRT 2020
    if (UPDATE < 1594158142) {
        UPDATE=1594158142;

        for (.@i=0; .@i < getarraysize($@MSK_MAGIC) ; .@i++) {
            /*
            debugmes "Debug skill %s - Lv %d",
                    getskillname($@MSK_MAGIC[.@i]), getskilllv($@MSK_MAGIC[.@i]);
            * /
            if (getskilllv($@MSK_MAGIC[.@i]) > 1) {
                .@msp=(getskilllv($@MSK_MAGIC[.@i])-1);
                MAGIC_PTS-=.@msp;
                skill $@MSK_MAGIC[.@i], 1, 0;
                dispbottom l("%s refunded to level 1 for %d MSP",
                           getskillname($@MSK_MAGIC[.@i]), .@msp);
            }
        }

    }
    // AFKing bugfix
    // qua jul 29 06:52:00 BRT 2020
    if (UPDATE < 1596016320) {
        UPDATE=1596016320;
        .@x=(AFKING >= 2592000 ? 4 : (
            AFKING >= 864000 ? 3 : (
            AFKING >= 201600 ? 2 : (
            AFKING >= 28800 ? 1 : 0
            ))));
        skill(TMW2_SPEECH, .@x, 0);
        dispbottom l("AFK skill levels fixed.");
    }
    // Magic RP bugfix
    // sáb ago  1 05:45:00 BRT 2020
    if (UPDATE < 1596271500) {
        UPDATE=1596271500;
        .@x=(AFKING >= 2592000 ? 4 : (
            AFKING >= 864000 ? 3 : (
            AFKING >= 201600 ? 2 : (
            AFKING >= 28800 ? 1 : 0
            ))));
        skill(TMW2_SPEECH, .@x, 0);
        dispbottom l("AFK skill levels fixed.");
        for (.@i=0; .@i < getarraysize($@MSK_MAGIC) ; .@i++) {
            if (getskilllv($@MSK_MAGIC[.@i]) > 1) {
                .@msp=max(0, getskilllv(@menuret)-5);
                MAGIC_PTS-=.@msp;
                skill $@MSK_MAGIC[.@i], 1, 0;
                dispbottom l("%s removed - YOU NOOB STOP CHEATING %%e%%Q",
                           getskillname($@MSK_MAGIC[.@i]), .@msp);
            }
        }
    }
    // Christmas Warp bug
    // seg dez 28 20:45:55 BRT 2020
    if (UPDATE < 1609199155) {
        UPDATE=1609199155;
        if (BaseLevel < 20) {
            if (getsavepoint(0) != "000-1" &&
                getsavepoint(0) != "003-1" &&
                getsavepoint(0) != "005-1" &&
                getsavepoint(0) != "009-1") {
                // Resave at Candor
                EnterTown("Candor");
                ReturnTown();
            }
        }
        // Gallery Contest
        .@dg=1;
        showavatar NPC_LOF_RICH;
        mesn ("TMW2 Staff");
        mesc l("Hello, @@! We are proud to announce the @@ RESULTS!", strcharinfo(0) , b(l("2° Screenshooting Contest"))), 3;
        mesc l("Participants: Povo * Manatauro * Woody"), 3;
        next;
        mesc ("Povo Entries: What to do with Presents?"), 3;
        mesc ("Woody Entries: Lava Dungeon"), 3;
        mesc ("Manatauro Entries: Yuck Noob =) ; Povo :) ; Lurking GM and Me"), 3;
        next;
        mesc l("1st Place - Povo (6 likes)");
        mesc l("2nd Place - Manatauro (5 likes)");
        mesc l("3rd Place - Woody (4 likes)");
        mes "";
        next;
        if (strcharinfo(0) == "Povo")
            getitem StrangeCoin, 80;
        else if (strcharinfo(0) == "Manatauro")
            getitem StrangeCoin, 40;
        else if (strcharinfo(0) == "Woody")
            getitem StrangeCoin, 20;
    }
    // Easter Eggs
    // qua jul 29 06:52:00 BRT 2020
    if (UPDATE < 1610083840) {
        UPDATE=1610083840;
        .@q=getq(General_EasterEggs);
        if (.@q) {
            setq General_EasterEggs, 1, .@q, bitmask_count(.@q);
            dispbottom l("Easter Egg quest updated. Total found: %02d/06",
                          bitmask_count(.@q));
        }
    }
    // Change variable scope
    // sáb jan 16 19:21:15 BRT 2021
    if (UPDATE < 1610835675) {
        UPDATE=1610835675;
        #GUILDSHOP=GUILDSHOP;
        GUILDSHOP=0;
    }
    // Change some quest inner workings
    // qua set 22 12:30:40 BRT 2021
    if (UPDATE < 1632324640) {
        UPDATE=1632324640;
        setq1 HalinarzoQuest_Alvasus, getq(HalinarzoQuest_Alvasus)+1;
    }
    // Realm of Drops
    // sab set 24 15:37:15 BRT 2022
    if (UPDATE < 1664044635) {
        UPDATE=1664044635;
        skill TMW2_DROPS, REBIRTH+1, 0;
        if (getskilllv(TMW2_SKILLPERMIT) >= 1)
            getitem ScholarshipBadge, 1;
        if (getskilllv(TMW2_SKILLPERMIT) >= 2)
            getexp 20000, 1000;
        if (getskilllv(TMW2_SKILLPERMIT) >= 3)
            getexp 80000, 0;
        // Actual value has changed, you'll be refunded in EXP
        if (getskilllv(TMW2_SKILLPERMIT) >= 1)
            #ADD_LVL+=80000;
    }
    // Dausen update
    // dom out 22 13:15:32 BRT 2022
    if (UPDATE < 1666541732) {
        UPDATE=1666541732;
        if (getq(TulimsharQuest_MobTutorial) >= 2)
            Zeny+=246;
        if (getq(TulimsharQuest_MobTutorial) >= 4)
            Zeny+=616;
        if (getq(TulimsharQuest_MobTutorial) >= 6)
            Zeny+=1068;
        if (getq(TulimsharQuest_MobTutorial) >= 8)
            Zeny+=2200;
    }
    */

    // :// End of Regular Update System
    ////////////////////////////////////
    // Permanent Gold Boost
    // #ADD_GP means the user have to right to get some gp
    if (#ADD_GP) {
        Zeny+=#ADD_GP;
        #ADD_GP=0;
    }

    // Permanent Level Boost
    // This is the Cross Worlds. Level is overriden.
    if (#ADD_LVL) {
        resetlvl(2);
        //logmes "[Merger] EXP +"+#ADD_LVL, LOGMES_ATCOMMAND;
        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));
        }
        // Left overs
        getexp #ADD_LVL, 0;
        #ADD_LVL=0;
    }

    if (.@dg) {
        next;
        closeclientdialog;
    }
    return;

}

// Just be sure your client version is OK
// NOTE: Current master client version is 26, but M+ 1.9.3.23 is still at 25
function	script	checkclientversion	{
    // Destroy Karma, regardless of version and perpetually
    Karma=0;

    // Minimum version
    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("This should not happen on the default Mirror Lake Installation. Perhaps you changed something in an incompatible way?");
    next;
    if (ClientVersion >= 24) mesc l("Compatibility Support mode enabled. Client may crash AT RANDOM, beware.");
    if (ClientVersion >= 24) mesc l("Crazy stuff can happen in overall. YOU HAVE BEEN WARNED TO UPDATE YOUR CLIENT.");
    if (ClientVersion >= 24) closeclientdialog;
    if (ClientVersion >= 24) 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;
}