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/tmwa/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 TmwAthena  | 
    
    
    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 this " | 
    
    
    62  | 
     | 
     | 
                             "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 8:  | 
    
    
    75  | 
     | 
     | 
                // TRANSLATORS: error message  | 
    
    
    76  | 
     | 
     | 
                errorMessage = _("Duplicated login."); | 
    
    
    77  | 
     | 
     | 
                break;  | 
    
    
    78  | 
     | 
     | 
            default:  | 
    
    
    79  | 
     | 
     | 
                // TRANSLATORS: error message  | 
    
    
    80  | 
     | 
     | 
                errorMessage = _("Unknown connection error."); | 
    
    
    81  | 
     | 
     | 
                break;  | 
    
    
    82  | 
     | 
     | 
        }  | 
    
    
    83  | 
     | 
     | 
        client->setState(State::ERROR);  | 
    
    
    84  | 
     | 
     | 
    }  | 
    
    
    85  | 
     | 
     | 
     | 
    
    
    86  | 
    ✓✗✓✗
  | 
    3  | 
    }  // namespace TmwAthena  |