• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

how to remove or change login words

Camorahaze

New Member
Joined
Sep 1, 2019
Messages
23
Solutions
1
Reaction score
2
How to remove the sentence that is on the right side of the character name?
tfs 0.4 version 8.6



Screenshot_2.png
 
Solution
In your iologindata.h you'll have to remove this line.
C++:
std::string getCheckPlayerLevel(const std::string& name) const;
and then in your iologindata.cpp you'll have to remove
C++:
std::string IOLoginData::getCheckPlayerLevel(const std::string& name) const
{
    Database* db = Database::getInstance();
    DBQuery query;
    query << "SELECT level, vocation, promotion  FROM players WHERE name " << db->getStringComparer() << db->escapeString(name) << ";";
    DBResult* result;
    if (!(result = db->storeQuery(query.str())))
        return false;

    const uint32_t pLevel = result->getDataInt("level");
    const uint32_t pVoc = result->getDataInt("vocation");
    const uint32_t prom = result->getDataInt("promotion")...
That's added through sources can you check iologindata.h for this line
C++:
std::string getCheckPlayerLevel(const std::string& name) const;
 
In your iologindata.h you'll have to remove this line.
C++:
std::string getCheckPlayerLevel(const std::string& name) const;
and then in your iologindata.cpp you'll have to remove
C++:
std::string IOLoginData::getCheckPlayerLevel(const std::string& name) const
{
    Database* db = Database::getInstance();
    DBQuery query;
    query << "SELECT level, vocation, promotion  FROM players WHERE name " << db->getStringComparer() << db->escapeString(name) << ";";
    DBResult* result;
    if (!(result = db->storeQuery(query.str())))
        return false;

    const uint32_t pLevel = result->getDataInt("level");
    const uint32_t pVoc = result->getDataInt("vocation");
    const uint32_t prom = result->getDataInt("promotion");
    std::string voc;

    if (prom == 0) {
        switch (pVoc) {
            case 0:
                voc = "Rookie";
                break;
            case 1:
                voc = "S";
                break;
            case 2:
                voc = "D";
                break;
            case 3:
                voc = "P";
                break;
            case 4:
                voc = "K";
                break;
            default:
                voc = "Uknown";
        }
    } else if (prom == 1) {
         switch (pVoc) {
             case 0:
                 voc = "Rookie";
                  break;
             case 1:
                 voc = "MS";
                  break;
             case 2:
                 voc = "ED";
                  break;
             case 3:
                 voc = "RP";
                  break;
             case 4:
                 voc = "EK";
                  break;
             default:
                 voc = "Uknown";
         }
    }  

    std::stringstream ret;
    ret << "Level: "<< pLevel << " Voc: " << voc;
    result->free();
    return ret.str();
}
and then in your protocollogin.cpp you'll have to remove this
C++:
output->putString(IOLoginData::getInstance()->getCheckPlayerLevel((*it)));
then recompile and it won't show levels or vocation
also search for this line in protocollogin.cpp
C++:
//output->AddString(g_config.getString(ConfigManager::SERVER_NAME));
and remove those //
 
Solution
I didn't notice you edited your reply.
Did it compile properly without any warns or errors? open your config.lua and check if you have serverName =
What is written next to the character in the list after the edits you have done?
Try changing this to true and see if it still debugs you.
Lua:
displayOnOrOffAtCharlist = false
 
Last edited:
Post your iologindata.h , iologindata.cpp and protocollogin.cpp or link me to your source and I will check/do it.
 
iologindata.h

Lua:
////////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
////////////////////////////////////////////////////////////////////////
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////

#ifndef [B]IOLOGINDATA[/B]
#define [B]IOLOGINDATA[/B]
#include "otsystem.h"
#include "database.h"

#include "creature.h"
#include "player.h"
#include "account.h"
#include "group.h"

enum DeleteCharacter_t
{
    DELETE_INTERNAL,
    DELETE_LEADER,
    DELETE_HOUSE,
    DELETE_ONLINE,
    DELETE_SUCCESS
};

typedef std::pair<int32_t, Item*> itemBlock;
typedef std::list<itemBlock> ItemBlockList;

class IOLoginData
{
    public:
        virtual ~IOLoginData() {}
        static IOLoginData* getInstance()
        {
            static IOLoginData instance;
            return &instance;
        }

        Account loadAccount(uint32_t accountId, bool preLoad = false);
        bool saveAccount(Account account);

        bool getAccountId(const std::string& name, uint32_t& number);
        bool getAccountName(uint32_t number, std::string& name);

        bool hasFlag(uint32_t accountId, PlayerFlags value);
        bool hasCustomFlag(uint32_t accountId, PlayerCustomFlags value);
        bool hasFlag(PlayerFlags value, const std::string& accName);
        bool hasCustomFlag(PlayerCustomFlags value, const std::string& accName);

        bool accountIdExists(uint32_t accountId);
        bool accountNameExists(const std::string& name);

        bool getPassword(uint32_t accountId, std::string& password, std::string& salt, std::string name = "");
        bool setPassword(uint32_t accountId, std::string newPassword);
        bool validRecoveryKey(uint32_t accountId, std::string recoveryKey);
        bool setRecoveryKey(uint32_t accountId, std::string newRecoveryKey);

        uint64_t createAccount(std::string name, std::string password);
        void removePremium(Account account);

        const Group* getPlayerGroupByAccount(uint32_t accountId);

        bool loadPlayer(Player* player, const std::string& name, bool preLoad = false);
        bool savePlayer(Player* player, bool preSave = true, bool shallow = false);

        bool playerDeath(Player* player, const DeathList& dl);
        bool playerMail(Creature* actor, std::string name, uint32_t townId, Item* item);

        bool hasFlag(const std::string& name, PlayerFlags value);
        bool hasCustomFlag(const std::string& name, PlayerCustomFlags value);
        bool hasFlag(PlayerFlags value, uint32_t guid);
        bool hasCustomFlag(PlayerCustomFlags value, uint32_t guid);

        bool isPremium(uint32_t guid);

        bool playerExists(uint32_t guid, bool multiworld = false, bool checkCache = true);
        bool playerExists(std::string& name, bool multiworld = false, bool checkCache = true);
        bool getNameByGuid(uint32_t guid, std::string& name, bool multiworld = false);
        bool getGuidByName(uint32_t& guid, std::string& name, bool multiworld = false);
        bool getGuidByNameEx(uint32_t& guid, bool& specialVip, std::string& name);

        bool changeName(uint32_t guid, std::string newName, std::string oldName);
        bool createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex);
        DeleteCharacter_t deleteCharacter(uint32_t accountId, const std::string& characterName);

        uint32_t getLevel(uint32_t guid) const;
        uint32_t getLastIP(uint32_t guid) const;

        uint32_t getLastIPByName(const std::string& name) const;
        uint32_t getAccountIdByName(const std::string& name) const;
        std::string getCheckPlayerLevel(const std::string& name) const;

        bool getUnjustifiedDates(uint32_t guid, std::vector<time_t>& dateList, time_t _time);
        bool getDefaultTownByName(const std::string& name, uint32_t& townId);

        bool updatePremiumDays();
        bool updateOnlineStatus(uint32_t guid, bool login);
        bool resetGuildInformation(uint32_t guid);

    protected:
        IOLoginData() {}
        struct StringCompareCase
        {
            bool operator()(const std::string& l, const std::string& r) const
            {
                return asLowerCaseString(l).compare(asLowerCaseString(r)) < 0;
            }
        };

        typedef std::map<std::string, uint32_t, StringCompareCase> GuidCacheMap;
        GuidCacheMap guidCacheMap;

        typedef std::map<uint32_t, std::string> NameCacheMap;
        NameCacheMap nameCacheMap;

        typedef std::map<int32_t, std::pair<Item*, int32_t> > ItemMap;

        bool saveItems(const Player* player, const ItemBlockList& itemList, DBInsert& query_insert);
        void loadItems(ItemMap& itemMap, DBResult* result);

        bool storeNameByGuid(uint32_t guid);
};
#endif




Lua:
////////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
////////////////////////////////////////////////////////////////////////
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
#include "otpch.h"
#include <iomanip>

#include "protocollogin.h"
#include "tools.h"
#include "const.h"
#include "resources.h"

#include "iologindata.h"
#include "ioban.h"

#include "outputmessage.h"
#include "connection.h"

#include "configmanager.h"
#include "game.h"

#if defined(WINDOWS) && !defined([B]CONSOLE[/B])
#include "gui.h"
#endif

extern ConfigManager g_config;
extern Game g_game;

extern std::list<std::pair<uint32_t, uint32_t> > serverIps;

#ifdef [B]ENABLE_SERVER_DIAGNOSTIC[/B]
uint32_t ProtocolLogin::protocolLoginCount = 0;
#endif

void ProtocolLogin::deleteProtocolTask()
{
#ifdef [B]DEBUG_NET_DETAIL[/B]
    std::clog << "Deleting ProtocolLogin" << std::endl;
#endif
    Protocol::deleteProtocolTask();
}

void ProtocolLogin::disconnectClient(uint8_t error, const char* message)
{
    OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false);
    if(output)
    {
        TRACK_MESSAGE(output);
        output->put<char>(error);
        output->putString(message);
        OutputMessagePool::getInstance()->send(output);
    }

    getConnection()->close();
}

bool ProtocolLogin::parseFirstPacket(NetworkMessage& msg)
{
    if(
#if defined(WINDOWS) && !defined([B]CONSOLE[/B])
        !GUI::getInstance()->m_connections ||
#endif
        g_game.getGameState() == GAMESTATE_SHUTDOWN)
    {
        getConnection()->close();
        return false;
    }

    uint32_t clientIp = getConnection()->getIP();
    /[I]uint16_t operatingSystem = msg.get<uint16_t>();[/I]/msg.skip(2);
    uint16_t version = msg.get<uint16_t>();

    msg.skip(12);
    if(!RSA_decrypt(msg))
    {
        getConnection()->close();
        return false;
    }

    uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
    enableXTEAEncryption();
    setXTEAKey(key);

    std::string name = msg.getString(), password = msg.getString();
    if(name.empty())
    {
        if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER))
        {
            disconnectClient(0x0A, "Invalid account name.");
            return false;
        }

        name = "1";
        password = "1";
    }

    if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX)
    {
        disconnectClient(0x0A, CLIENT_VERSION_STRING);
        return false;
    }

    if(g_game.getGameState() < GAMESTATE_NORMAL)
    {
        disconnectClient(0x0A, "Server is just starting up, please wait.");
        return false;
    }

    if(g_game.getGameState() == GAMESTATE_MAINTAIN)
    {
        disconnectClient(0x0A, "Server is under maintenance, please re-connect in a while.");
        return false;
    }

    if(ConnectionManager::getInstance()->isDisabled(clientIp, protocolId))
    {
        disconnectClient(0x0A, "Too many connections attempts from your IP address, please try again later.");
        return false;
    }

    if(IOBan::getInstance()->isIpBanished(clientIp))
    {
        disconnectClient(0x0A, "Your IP is banished!");
        return false;
    }

    uint32_t id = 1;
    if(!IOLoginData::getInstance()->getAccountId(name, id))
    {
        ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false);
        disconnectClient(0x0A, "Invalid account name.");
        return false;
    }

    Account account = IOLoginData::getInstance()->loadAccount(id);
    if(!encryptTest(account.salt + password, account.password))
    {
        ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, false);
        disconnectClient(0x0A, "Invalid password.");
        return false;
    }

    Ban ban;
    ban.value = account.number;

    ban.type = BAN_ACCOUNT;
    if(IOBan::getInstance()->getData(ban) && !IOLoginData::getInstance()->hasFlag(account.number, PlayerFlag_CannotBeBanned))
    {
        bool deletion = ban.expires < 0;
        std::string name_ = "Automatic ";
        if(!ban.adminId)
            name_ += (deletion ? "deletion" : "banishment");
        else
            IOLoginData::getInstance()->getNameByGuid(ban.adminId, name_, true);

        char buffer[500 + ban.comment.length()];
        sprintf(buffer, "Your account has been %s at:\n%s by: %s,\nfor the following reason:\n%s.\nThe action taken was:\n%s.\nThe comment given was:\n%s.\nYour %s%s.",
            (deletion ? "deleted" : "banished"), formatDateEx(ban.added, "%d %b %Y").c_str(), name_.c_str(),
            getReason(ban.reason).c_str(), getAction(ban.action, false).c_str(), ban.comment.c_str(),
            (deletion ? "account won't be undeleted" : "banishment will be lifted at:\n"),
            (deletion ? "" : formatDateEx(ban.expires).c_str()));

        disconnectClient(0x0A, buffer);
        return false;
    }

    // remove premium days
    IOLoginData::getInstance()->removePremium(account);
    if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER) && !account.charList.size())
    {
        disconnectClient(0x0A, std::string("This account does not contain any character yet.\nCreate a new character on the "
            + g_config.getString(ConfigManager::SERVER_NAME) + " website at " + g_config.getString(ConfigManager::URL) + ".").c_str());
        return false;
    }

    ConnectionManager::getInstance()->addAttempt(clientIp, protocolId, true);
    if(OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false))
    {
        TRACK_MESSAGE(output);
        output->put<char>(0x14);

        char motd[1300];
        sprintf(motd, "%d\n%s", g_game.getMotdId(), g_config.getString(ConfigManager::MOTD).c_str());
        output->putString(motd);

        uint32_t serverIp = serverIps.front().first;
        for(std::list<std::pair<uint32_t, uint32_t> >::iterator it = serverIps.begin(); it != serverIps.end(); ++it)
        {
            if((it->first & it->second) != (clientIp & it->second))
                continue;

            serverIp = it->first;
            break;
        }

        //Add char list
        output->put<char>(0x64);
        if(g_config.getBool(ConfigManager::ACCOUNT_MANAGER) && id != 1)
        {
            output->put<char>(account.charList.size() + 1);
            output->putString("Account Manager");
            output->putString(g_config.getString(ConfigManager::SERVER_NAME));
            output->put<uint32_t>(serverIp);
            output->put<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
        }
        else
            output->put<char>((uint8_t)account.charList.size());

        for(Characters::iterator it = account.charList.begin(); it != account.charList.end(); it++)
        {
            #ifndef [B]LOGIN_SERVER[/B]
            output->putString((*it));
            if(g_config.getBool(ConfigManager::ON_OR_OFF_CHARLIST))
            {
                if(g_game.getPlayerByName((*it)))
                    output->putString("Online");
                else
                    output->putString("Offline");
            }
            else
                output->putString(IOLoginData::getInstance()->getCheckPlayerLevel((*it)));

            output->put<uint32_t>(serverIp);
            output->put<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
            #else
            if(version < it->second->getVersionMin() || version > it->second->getVersionMax())
                continue;

            output->putString(it->first);
            output->putString(it->second->getName());
            output->put<uint32_t>(it->second->getAddress());
            output->put<uint16_t>(it->second->getPort());
            #endif
        }

        //Add premium days
        if(g_config.getBool(ConfigManager::FREE_PREMIUM))
            output->put<uint16_t>(GRATIS_PREMIUM); //client displays free premium
        else
            output->put<uint16_t>(account.premiumDays);

        OutputMessagePool::getInstance()->send(output);
    }

    getConnection()->close();
    return true;
}

protocollogin.cpp
 
Looks like you didn't remove what I said in iologindata.h
C++:
std::string getCheckPlayerLevel(const std::string& name) const;
Edit :
Attach the 3 original files without any edits here please because it looks like you missed few changes, I will do them and reattach it for you then you just compile.
 
Last edited:
Post your config.lua
Edit :
Great you solved it, I think you didn't read all my sentences or else you would have solved it since hours.
 
Last edited:
Back
Top