• 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!

[TFS 1.3 / C++] How i can send Player informations to CharacterList ?

Orbis

Orbis - A new Adventure A New World
Joined
Dec 26, 2013
Messages
16
Reaction score
3
Hi Guys!
I know in TFS 0.4 we find in protocollogin.cpp "bool" to send data to character list but in TFS 1.3 i don't know how i can send player information to characterlist.

Example:

C++:
    // outfit
    Database& db = Database::getInstance();

    std::ostringstream query;
    query << "SELECT `id`, `account_id`, `group_id`, `deletion`, `level`, `vocation`,  `balance`, (SELECT `type` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `account_type`";
    DBResult_ptr result = db.storeQuery(query.str());
    if (!result) {
        return false;
    }
    result->getNumber<uint32_t>("level");
    result->getNumber<uint32_t>("balance");
    result->getNumber<uint32_t>("vocation");
    return true;

How i can put this into protocollogin? Or which other any file?

Thanks in Advance!
 
There is only so much you can send to the client through the character list well that is if you are using the regular client. Mainly due to space.
The information is loaded in IOLoginData::loginserverAuthentication

But it isn't just there, its kind of spread out.
 
Last edited by a moderator:
There is only so much you can send to the client through the character list well that is if you are using the regular client. Mainly due to space.
The information is loaded in IOLoginData::loginserverAuthentication


I'm trying input new informations in IOLoginData::preloadPlayer(Player* player, const std::string& name)

Result with my edit:

C++:
bool IOLoginData::preloadPlayer(Player* player, const std::string& name)
{
    Database& db = Database::getInstance();

    std::ostringstream query;
    query << "SELECT `id`, `account_id`, `group_id`, `deletion`, `level`, `vocation`, `looktype`, `lookfeet`, `lookhead`, `looklegs`, `lookaddons`, `skull`, `balance`, (SELECT `type` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `account_type`";
    if (!g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        query << ", (SELECT `premdays` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `premium_days`";
    }
    query << " FROM `players` WHERE `name` = " << db.escapeString(name);
    DBResult_ptr result = db.storeQuery(query.str());
    if (!result) {
        return false;
    }

    if (result->getNumber<uint64_t>("deletion") != 0) {
        return false;
    }

    player->setGUID(result->getNumber<uint32_t>("id"));
    Group* group = g_game.groups.getGroup(result->getNumber<uint16_t>("group_id"));
    if (!group) {
        std::cout << "[Error - IOLoginData::preloadPlayer] " << player->name << " has Group ID " << result->getNumber<uint16_t>("group_id") << " which doesn't exist." << std::endl;
        return false;
    }
    player->setGroup(group);
    player->accountNumber = result->getNumber<uint32_t>("account_id");
    player->accountType = static_cast<AccountType_t>(result->getNumber<uint16_t>("account_type"));
    if (!g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
        player->premiumDays = result->getNumber<uint16_t>("premium_days");
    } else {
        player->premiumDays = std::numeric_limits<uint16_t>::max();
    }
    // start outfit
    result->getNumber<uint32_t>("level");
    result->getNumber<uint32_t>("looktype");
    result->getNumber<uint32_t>("lookfeet");
    result->getNumber<uint32_t>("lookhead");
    result->getNumber<uint32_t>("looklegs");
    result->getNumber<uint32_t>("looktype");
    result->getNumber<uint32_t>("lookaddons");
    result->getNumber<uint32_t>("skull");
    result->getNumber<uint32_t>("balance");
    result->getNumber<uint32_t>("vocation");
    return true;
}


Compiled done. BUT... How can i receive this informations using OTClient ?
I try this:

modules/gamelib/protocollogin.lua

function ProtocolLogin:parseCharacterList(msg)

Lua:
      character.outfit = {
      type = msg:getU32();
      body = msg:getU32();
      feet = msg:getU32();
      head = msg:getU32();
      legs = msg:getU32();
      addons = msg:getU32();
      }
      character.level = msg:getU32()
      character.vocation = msg:getU32()

I think maybe it's something in msg:getU32()

@bayview thank u for ur attention <3
 
This is where you are going to retrieve the info when the characterlist gets sent from the server: edubart/otclient

This is where you are going to send the characterlist info to the client: otland/forgottenserver

Now that you have sent and received the info you need, I'd imagine you would have to manage the characterlist UI on the OTClient side, so that the info you sent are actually printed on the screen.

I have never used OTClient so idk how to do that, but I think what you need is in one of theese files: edubart/otclient
 
Back
Top