Character List Showing Online/Offline Characters. TFS 1.3

Ennokas

Premium User
Premium User
Joined
Feb 13, 2009
Messages
434
Best answers
0
Reaction score
7
Location
unknown
Is there possible to change
example:
Player (Online) if he is online
Player (Offline) if he is offline.

Right now its showing
Player (Forgotten)

Using TFS 1.3
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065


Configurable via config.lua:
Lua:
showOnlineStatusInCharlist = true
True: will show online/offline status in place of the server name
False: will show server name rather than online/offline status
 
OP
Ennokas

Ennokas

Premium User
Premium User
Joined
Feb 13, 2009
Messages
434
Best answers
0
Reaction score
7
Location
unknown
Got such error with this

C++:
 C++ argument of type "ConfigManager::integer_config_t" is incompatible with parameter of type "ConfigManager::string_config_t"
Those 2 are making this error
C++:
output->addString(g_config.getString(ConfigManager::IP));
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065
Got such error with this

C++:
 C++ argument of type "ConfigManager::integer_config_t" is incompatible with parameter of type "ConfigManager::string_config_t"
Those 2 are making this error
C++:
output->addString(g_config.getString(ConfigManager::IP));
Either you're not actually using TFS 1.3 or you've edited something incorrectly, show us your sources.
 
OP
Ennokas

Ennokas

Premium User
Premium User
Joined
Feb 13, 2009
Messages
434
Best answers
0
Reaction score
7
Location
unknown

using this one, havent edited anything else than that right now
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065
Change:
C++:
output->addString(g_config.getString(ConfigManager::IP));
To:
C++:
output->add<uint32_t>(g_config.getNumber(ConfigManager::IP));
And to note, this is why you're supposed to give your TFS version AND client version, this downgrade is not exactly equal to 1.3.
 
OP
Ennokas

Ennokas

Premium User
Premium User
Joined
Feb 13, 2009
Messages
434
Best answers
0
Reaction score
7
Location
unknown
Now client is crashing before i can even see charlist.

 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,065
Replace your entire ProtocolLogin::getCharacterList function with this:
C++:
void ProtocolLogin::getCharacterList(const std::string& accountName, const std::string& password)
{
    Account account;
    if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
        disconnectClient("Account name or password is not correct.");
        return;
    }

    auto output = OutputMessagePool::getOutputMessage();
    //Update premium days
    Game::updatePremium(account);

    const std::string& motd = g_config.getString(ConfigManager::MOTD);
    if (!motd.empty()) {
        //Add MOTD
        output->addByte(0x14);

        std::ostringstream ss;
        ss << g_game.getMotdNum() << "\n" << motd;
        output->addString(ss.str());
    }

    //Add char list
    output->addByte(0x64);

    uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
    output->addByte(size);
    for (uint8_t i = 0; i < size; i++) {
        const std::string& character = account.characters[i];
        output->addString(character);
        if (g_config.getBoolean(ConfigManager::ONLINE_OFFLINE_CHARLIST)) {
            output->addString(g_game.getPlayerByName(character) ? "Online" : "Offline");
        } else {
            output->addString(g_config.getString(ConfigManager::SERVER_NAME));
        }
        output->add<uint32_t>(g_config.getNumber(ConfigManager::IP));
        output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
    }

    //Add premium days
    if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        output->add<uint16_t>(0xFFFF); //client displays free premium
    } else {
        output->add<uint16_t>(account.premiumDays);
    }

    send(output);

    disconnect();
}
 
OP
Ennokas

Ennokas

Premium User
Premium User
Joined
Feb 13, 2009
Messages
434
Best answers
0
Reaction score
7
Location
unknown
Replace your entire ProtocolLogin::getCharacterList function with this:
C++:
void ProtocolLogin::getCharacterList(const std::string& accountName, const std::string& password)
{
    Account account;
    if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
        disconnectClient("Account name or password is not correct.");
        return;
    }

    auto output = OutputMessagePool::getOutputMessage();
    //Update premium days
    Game::updatePremium(account);

    const std::string& motd = g_config.getString(ConfigManager::MOTD);
    if (!motd.empty()) {
        //Add MOTD
        output->addByte(0x14);

        std::ostringstream ss;
        ss << g_game.getMotdNum() << "\n" << motd;
        output->addString(ss.str());
    }

    //Add char list
    output->addByte(0x64);

    uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
    output->addByte(size);
    for (uint8_t i = 0; i < size; i++) {
        const std::string& character = account.characters[i];
        output->addString(character);
        if (g_config.getBoolean(ConfigManager::ONLINE_OFFLINE_CHARLIST)) {
            output->addString(g_game.getPlayerByName(character) ? "Online" : "Offline");
        } else {
            output->addString(g_config.getString(ConfigManager::SERVER_NAME));
        }
        output->add<uint32_t>(g_config.getNumber(ConfigManager::IP));
        output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
    }

    //Add premium days
    if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        output->add<uint16_t>(0xFFFF); //client displays free premium
    } else {
        output->add<uint16_t>(account.premiumDays);
    }

    send(output);

    disconnect();
}
Works fine now, thanks ;)
 
Top