summaryrefslogtreecommitdiff
path: root/npc/functions/clientversion.txt
blob: 058796e6ea9d3ca80d5925bd6595b95ceb756f90 (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
// 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 (isin("000-0", 0, 0, 40, 40)) {
        UPDATE=gettimetick(2);
        // if $EVENT$ is REFFER:
        if (#REFERRAL_PROG == "") {
            mesn l("TMW2 Staff");
            mesc l("Hello, and welcome to TMW2: Moubootaur Legends!"), 3;
            mesc l("(Click next button to advance dialogs)"),9;
            next;
            mesn l("TMW2 Staff");
            mesc l("Did you came here by someone advise? If yes, write their name here!"), 3;
            mesc l("If this is not the case, just click on \"Send\"."), 3;
            .@ref$="nah";
            do
            {
                input .@ref$;
                mes "";
                if (.@ref$) {
                    .@ref=getcharid(0, strip(.@ref$));
                    if (.@ref > 0) {
                        #REFERRAL_PROG=.@ref;
                        getitembound FriendGift, 1, 1;
                        mesn l("TMW2 Staff");
                        mesc l("Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3;
                        mesc l("Your friend also sent you a gift - open it when you get level 5!"), 3;
                        next;
                    } else {
                        mesn l("TMW2 Staff");
                        mesc l("Oops, there is nobody known as @@ on this game.", .@ref$), 3;
                        mesc l("Could you try again? There could be a typo!"), 3;
                        next;
                        .@ref$="";
                    }
                } else {
                    .@ref$="nah";
                    mesn l("TMW2 Staff");
                    mesc l("I see. Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3;
                    next;
                }
                if (ClientVersion >= 24) return;
            } while (.@ref$ != "");
        }
    }

    // Update handler (use `date +%s` for this)
    // Current UPDATE value: Qui Jun  7 08:10:55 -03 2018
    if (Lang > 5 && UPDATE < 1528369855) {
        UPDATE=gettimetick(2);
        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);
        if (!#ADD_LVL)
            close;
    }
    // #ADD_LVL means the user have to right to get some levels. This is a sketch. The code might be deleted.
    if (#ADD_LVL) {
        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;
        #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! And take this change!", 20);
        if (ClientVersion >= 24) close;
        next;
        mesn "Failsafe Mechanism";
        mesc l("Ah... You must update your client first."), 1;
        next;
    }
    if (is_admin() && UPDATE < 1528369855) {
        UPDATE=gettimetick(2); // Perhaps we should use above number, and leave all UPDATE fields here?
        dispbottom l("Client Version: @@", ClientVersion); // This is to debug UPDATE system.
    }

    if (ClientVersion >= 24) 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/@@]");
    next;
    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;
}