summaryrefslogtreecommitdiff
path: root/npc/functions/clientversion.txt
blob: c975772011192c76094277a41f92c2f25f63528e (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
// 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	checkclientversion	{
    // 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 @@", getitemlink(SupremeGift));
            mes "";
            mesc l("Please contact @@ to clear this misunderstanding.", b("Jesusalva")), 1;
            getitem SupremeGift, 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;
        }
        // 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;
        }
    }




    // #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 (ClientVersion < 24) next;
        /*
        next;
        mesn "Failsafe Mechanism";
        mesc l("Ah... You must update your client first."), 1;
        next;
        */
    }





    if (ClientVersion >= 24) {
        if (.@dg)
            close;
        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 >= 20) mesc l("Compatibility Support mode enabled. Client may crash AT RANDOM, beware.");
    if (ClientVersion >= 20) mesc l("Crazy stuff can happen in overall. YOU HAVE BEEN WARNED TO UPDATE YOUR CLIENT.");
    if (ClientVersion >= 20) close;
    if (ClientVersion >= 20) 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;
}