GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/generalrecv.cpp Lines: 3 44 6.8 %
Date: 2021-03-17 Branches: 2 35 5.7 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2019  The ManaPlus Developers
6
 *  Copyright (C) 2019-2021  Andrei Karas
7
 *
8
 *  This file is part of The ManaPlus Client.
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  any later version.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU General Public License
21
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 */
23
24
#include "net/eathena/generalrecv.h"
25
26
#include "client.h"
27
#include "logger.h"
28
29
#include "net/messagein.h"
30
31
#include "utils/cast.h"
32
#include "utils/gettext.h"
33
34
#include "debug.h"
35
36
namespace EAthena
37
{
38
39
1
ServerInfo charServer;
40
1
ServerInfo mapServer;
41
42
void GeneralRecv::processConnectionProblem(Net::MessageIn &msg)
43
{
44
    const uint8_t code = msg.readUInt8("flag");
45
    logger->log("Connection problem: %u", CAST_U32(code));
46
47
    switch (code)
48
    {
49
        case 0:
50
            // TRANSLATORS: error message
51
            errorMessage = _("Authentication failed.");
52
            break;
53
        case 1:
54
            // TRANSLATORS: error message
55
            errorMessage = _("No servers available.");
56
            break;
57
        case 2:
58
            if (client->getState() == State::GAME)
59
            {
60
                // TRANSLATORS: error message
61
                errorMessage = _("Someone else is trying to use "
62
                    "this account.");
63
            }
64
            else
65
            {
66
                // TRANSLATORS: error message
67
                errorMessage = _("This account is already logged in.");
68
            }
69
            break;
70
        case 3:
71
            // TRANSLATORS: error message
72
            errorMessage = _("Speed hack detected.");
73
            break;
74
        case 4:
75
            // TRANSLATORS: error message
76
            errorMessage = _("Server full.");
77
            break;
78
        case 5:
79
            // TRANSLATORS: error message
80
            errorMessage = _("Sorry, you are underaged.");
81
            break;
82
        case 8:
83
            // TRANSLATORS: error message
84
            errorMessage = _("Duplicated login.");
85
            break;
86
        case 9:
87
            // TRANSLATORS: error message
88
            errorMessage = _("To many connections from same ip.");
89
            break;
90
        case 10:
91
            // TRANSLATORS: error message
92
            errorMessage = _("Not paid for this time.");
93
            break;
94
        case 11:
95
            // TRANSLATORS: error message
96
            errorMessage = _("Pay suspended.");
97
            break;
98
        case 12:
99
            // TRANSLATORS: error message
100
            errorMessage = _("Pay changed.");
101
            break;
102
        case 13:
103
            // TRANSLATORS: error message
104
            errorMessage = _("Pay wrong ip.");
105
            break;
106
        case 14:
107
            // TRANSLATORS: error message
108
            errorMessage = _("Pay game room.");
109
            break;
110
        case 15:
111
            // TRANSLATORS: error message
112
            errorMessage = _("Disconnect forced by GM.");
113
            break;
114
        case 16:
115
        case 17:
116
            // TRANSLATORS: error message
117
            errorMessage = _("Ban japan refuse.");
118
            break;
119
        case 18:
120
            // TRANSLATORS: error message
121
            errorMessage = _("Remained other account.");
122
            break;
123
        case 100:
124
            // TRANSLATORS: error message
125
            errorMessage = _("Ip unfair.");
126
            break;
127
        case 101:
128
            // TRANSLATORS: error message
129
            errorMessage = _("Ip count all.");
130
            break;
131
        case 102:
132
            // TRANSLATORS: error message
133
            errorMessage = _("Ip count.");
134
            break;
135
        case 103:
136
        case 104:
137
            // TRANSLATORS: error message
138
            errorMessage = _("Memory.");
139
            break;
140
        case 105:
141
            // TRANSLATORS: error message
142
            errorMessage = _("Han valid.");
143
            break;
144
        case 106:
145
            // TRANSLATORS: error message
146
            errorMessage = _("Ip limited access.");
147
            break;
148
        case 107:
149
            // TRANSLATORS: error message
150
            errorMessage = _("Over characters list.");
151
            break;
152
        case 108:
153
            // TRANSLATORS: error message
154
            errorMessage = _("Ip blocked.");
155
            break;
156
        case 109:
157
            // TRANSLATORS: error message
158
            errorMessage = _("Invalid password count.");
159
            break;
160
        case 110:
161
            // TRANSLATORS: error message
162
            errorMessage = _("Not allowed race.");
163
            break;
164
        case 113:
165
            // TRANSLATORS: error message
166
            errorMessage = _("Access restricted in hours 00:00 to 06:00.");
167
            break;
168
        case 115:
169
            // TRANSLATORS: error message
170
            errorMessage = _("You was banned.");
171
            break;
172
        default:
173
            // TRANSLATORS: error message
174
            errorMessage = _("Unknown connection error.");
175
            break;
176
    }
177
    client->setState(State::ERROR);
178
}
179
180
void GeneralRecv::processMapNotFound(Net::MessageIn &msg)
181
{
182
    const int sz = msg.readInt16("len") - 4;
183
    msg.readString(sz, "map name?");
184
    // TRANSLATORS: error message
185
    errorMessage = _("Map not found");
186
    client->setState(State::ERROR);
187
}
188
189

3
}  // namespace EAthena