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

Create account manager

Status
Not open for further replies.

abdala ragab

Veteran OT User
Joined
Aug 18, 2018
Messages
447
Solutions
11
Reaction score
331
Location
gamelaot.sytes.net
Is it difficult to set up an account manager in source tfs 1.2?
I've been asking for a lot of help with this and no one can help me
Is there anyone who can do this for money?
Sorry for the long post. Have a great day
 
Offtopic
Your post is not long at all, no need to apologize 🤣

You mean account manager build into the game client or account manager website?
 
Offtopic
Your post is not long at all, no need to apologize 🤣

You mean account manager build into the game client or account manager website?
Built in game client
Post automatically merged:

Offtopic
Your post is not long at all, no need to apologize 🤣

You mean account manager build into the game client or account manager website?
accmanger.png
Like in the picture, can you do that?
 
you could check for older distributions with acc manager built ingame, i can't remmeber which one had that function altough
 
you could check for older distributions with acc manager built ingame, i can't remmeber which one had that function altough
tfs 0.3.7 tfs 0.4
But I don't understand the language
Lua <>C++
I want someone to help me for money
If you are able to help me contact me discord
abdalaragab
#5197
 
Don't know yet i have to do many changes from tfs 1.3 to 1.5 in order to add the code im compiling right now.
don't know if it works properly since haven't tested yet.
 
im having many errors after adding the code so now im adapting it in order to fit with 1.5
example i have remove errors in player.h and cpp now having in configmanager
1>container.cpp
1>creature.cpp
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,87): error C2664: 'std::string `anonymous-namespace'::getGlobalString(lua_State *,const char *,const char *)': el argumento 3 no puede convertirse de 'bool' a 'const char *'
1>C:\Users\slinDesktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,83): message : La conversión de un tipo entero a un tipo de puntero requiere reinterpret_cast, conversión de estilo de C o conversión de estilo de función entre paréntesis
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(43,13): message : vea la declaración de '`anonymous-namespace'::getGlobalString'
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,88): error C2143: error de sintaxis: falta ')' delante de ';'
1>creatureevent.cpp
1>depotchest.cpp
 
im having many errors after adding the code so now im adapting it in order to fit with 1.5
example i have remove errors in player.h and cpp now having in configmanager
1>container.cpp
1>creature.cpp
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,87): error C2664: 'std::string `anonymous-namespace'::getGlobalString(lua_State *,const char *,const char *)': el argumento 3 no puede convertirse de 'bool' a 'const char *'
1>C:\Users\slinDesktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,83): message : La conversión de un tipo entero a un tipo de puntero requiere reinterpret_cast, conversión de estilo de C o conversión de estilo de función entre paréntesis
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(43,13): message : vea la declaración de '`anonymous-namespace'::getGlobalString'
1>C:\Users\slin\Desktop\TFS-1.5-7.X\src con acc manager\src\configmanager.cpp(246,88): error C2143: error de sintaxis: falta ')' delante de ';'
1>creatureevent.cpp
1>depotchest.cpp
@Evil Puncker @Evil Hero @slaw Can someone help us
 
can somebody tell me how to convert this code from tfs 1.3
Lua:
DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
to tfs 1.5?



bool IOLoginData::accountNameExists(const std::string& name)
{
Database& db = Database::getInstance();
std::eek:stringstream query;
query << "SELECT 1 FROM accounts WHERE name = " << db->escapeString(name) << " LIMIT 1"; example need to change this

DBResult_ptr result = db->storeQuery(query.str()); and this too
if (!result)
return false;

return true;
}

or help with this
Code:
bool IOLoginData::playerExists(uint32_t guid)
{
    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "SELECT `name` FROM `players` WHERE `id` = " << guid << " AND `deletion` = 0";

    query << " LIMIT 1";
    DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}

bool IOLoginData::playerExists(std::string& name)
{

    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "SELECT `id`, `name` FROM `players` WHERE `name` = " << db->escapeString(name) << " AND `deletion` = 0";

    query << " LIMIT 1";
    DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}

bool IOLoginData::changeName(uint32_t guid, std::string newName, std::string oldName) //not in use yet
{
    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "DELETE FROM `player_namelocks` WHERE `player_id` = " << guid << ";";
    db->storeQuery(query.str());

    query.str("");
    query << "UPDATE `players` SET `name` = " << db->escapeString(newName) << " WHERE `id` = " << guid << ";";
    if (!db->storeQuery(query.str()))
        return false;

    return true;
}

bool IOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex)
{
    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT `id` FROM `players` WHERE `name` = " << db->escapeString(characterName) << ";";
    DBResult_ptr result = db->storeQuery(query.str());
    if (result)
    {
        return false;
    }
    Vocation* vocation = g_vocations.getVocation(vocationId);
    Vocation* rookVoc = g_vocations.getVocation(0);
    uint16_t healthMax = 150, manaMax = 0, capMax = 400, lookType = 136;
    if (sex % 2)
        lookType = 128;

    uint32_t level = g_config.getNumber(ConfigManager::START_LEVEL), tmpLevel = std::min((uint32_t) 7, (level - 1));
    uint32_t magLevel = g_config.getNumber(ConfigManager::START_MAGLEVEL);
    uint32_t manaSpent = vocation->getReqMana(magLevel);
    if (magLevel < 1)
    {
        magLevel = 0;
        manaSpent = 0;
    }
    uint32_t posx = g_config.getNumber(ConfigManager::SPAWN_X);
    uint32_t posy = g_config.getNumber(ConfigManager::SPAWN_Y);
    uint32_t posz = g_config.getNumber(ConfigManager::SPAWN_Z);
    uint32_t town = g_config.getNumber(ConfigManager::START_TOWNID);
    uint64_t exp = 0;
    if (level > 1)
        exp = Player::getExpForLevel(level);

    if (tmpLevel > 0)
    {
        healthMax += rookVoc->getHPGain() * tmpLevel;
        manaMax += rookVoc->getManaGain() * tmpLevel;
        capMax += rookVoc->getCapGain() * tmpLevel;
        if (level > 8)
        {
            tmpLevel = level - 8;
            healthMax += vocation->getHPGain() * tmpLevel;
            manaMax += vocation->getManaGain() * tmpLevel;
            capMax += vocation->getCapGain() * tmpLevel;
        }
    }

    query.str("");
    //query << "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `onlinetime`) VALUES (NULL, " << db->escapeString(characterName) << ", 1, " << accountId << ", " << level << ", " << vocationId << ", " << healthMax << ", " << healthMax << ", " << exp << ", 68, 76, 78, 39, " << lookType << ", 0, 0, " << manaMax << ", " << manaMax << ", 0, 100, 1, 100, 100, 7, 0, " << capMax << ", " << sex << ", 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)";


    query << "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `onlinetime`, `deletion`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`) VALUES (NULL, " << db->escapeString(characterName) << ", 1, " << accountId << ", " << level << ", 0, " << healthMax << ", " << healthMax << ", 0, 68, 76, 68, 79, " << lookType << ", 0, " << magLevel << ", 0, 0, " << manaSpent << ", 100, " << town << ", " << posx << ", " << posy << ", " << posz << ", '', " << capMax << ", " << sex << ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)";

    return db->executeQuery(query.str());
}

bool IOLoginData::setPassword(uint32_t accountId, std::string newPassword)
{

    Database* db = Database::getInstance();
    std::ostringstream query;

    transformToSHA1(newPassword);
    query << "UPDATE `accounts` SET `password` = " << db->escapeString(newPassword) << " WHERE `id` = " << accountId << ";";
    return db->executeQuery(query.str());
}

uint64_t IOLoginData::createAccount(std::string name, std::string password)
{

    password = transformToSHA1(password);

    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "INSERT INTO `accounts` (`id`, `name`, `password`) VALUES (NULL, " << db->escapeString(name) << ", " << db->escapeString(password) << ")";
    if (!db->executeQuery(query.str()))
        return 0;

    return db->getLastInsertId();
}

bool IOLoginData::getAccountId(const std::string& name, uint32_t& number)
{
    if (!name.length())
        return false;

    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT `id` FROM `accounts` WHERE `name` = " << db->escapeString(name) << " LIMIT 1";

    DBResult_ptr result = db->storeQuery(query.str());
    if (!result)
        return false;

    number = result->getDataInt("id");
    return true;
}

bool IOLoginData::accountNameExists(const std::string& name)
{
    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT 1 FROM `accounts` WHERE `name` = " << db->escapeString(name) << " LIMIT 1";

    DBResult_ptr result = db->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}
 
Last edited:
can somebody tell me how to convert this code from tfs 1.3
Lua:
DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
to tfs 1.5?



bool IOLoginData::accountNameExists(const std::string& name)
{
Database& db = Database::getInstance();
std::eek:stringstream query;
query << "SELECT 1 FROM accounts WHERE name = " << db->escapeString(name) << " LIMIT 1"; example need to change this

DBResult_ptr result = db->storeQuery(query.str()); and this too
if (!result)
return false;

return true;
}

or help with this
Code:
bool IOLoginData::playerExists(uint32_t guid)
{
    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "SELECT `name` FROM `players` WHERE `id` = " << guid << " AND `deletion` = 0";

    query << " LIMIT 1";
    DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}

bool IOLoginData::playerExists(std::string& name)
{

    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "SELECT `id`, `name` FROM `players` WHERE `name` = " << db->escapeString(name) << " AND `deletion` = 0";

    query << " LIMIT 1";
    DBResult_ptr result = Database::getInstance()->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}

bool IOLoginData::changeName(uint32_t guid, std::string newName, std::string oldName) //not in use yet
{
    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "DELETE FROM `player_namelocks` WHERE `player_id` = " << guid << ";";
    db->storeQuery(query.str());

    query.str("");
    query << "UPDATE `players` SET `name` = " << db->escapeString(newName) << " WHERE `id` = " << guid << ";";
    if (!db->storeQuery(query.str()))
        return false;

    return true;
}

bool IOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex)
{
    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT `id` FROM `players` WHERE `name` = " << db->escapeString(characterName) << ";";
    DBResult_ptr result = db->storeQuery(query.str());
    if (result)
    {
        return false;
    }
    Vocation* vocation = g_vocations.getVocation(vocationId);
    Vocation* rookVoc = g_vocations.getVocation(0);
    uint16_t healthMax = 150, manaMax = 0, capMax = 400, lookType = 136;
    if (sex % 2)
        lookType = 128;

    uint32_t level = g_config.getNumber(ConfigManager::START_LEVEL), tmpLevel = std::min((uint32_t) 7, (level - 1));
    uint32_t magLevel = g_config.getNumber(ConfigManager::START_MAGLEVEL);
    uint32_t manaSpent = vocation->getReqMana(magLevel);
    if (magLevel < 1)
    {
        magLevel = 0;
        manaSpent = 0;
    }
    uint32_t posx = g_config.getNumber(ConfigManager::SPAWN_X);
    uint32_t posy = g_config.getNumber(ConfigManager::SPAWN_Y);
    uint32_t posz = g_config.getNumber(ConfigManager::SPAWN_Z);
    uint32_t town = g_config.getNumber(ConfigManager::START_TOWNID);
    uint64_t exp = 0;
    if (level > 1)
        exp = Player::getExpForLevel(level);

    if (tmpLevel > 0)
    {
        healthMax += rookVoc->getHPGain() * tmpLevel;
        manaMax += rookVoc->getManaGain() * tmpLevel;
        capMax += rookVoc->getCapGain() * tmpLevel;
        if (level > 8)
        {
            tmpLevel = level - 8;
            healthMax += vocation->getHPGain() * tmpLevel;
            manaMax += vocation->getManaGain() * tmpLevel;
            capMax += vocation->getCapGain() * tmpLevel;
        }
    }

    query.str("");
    //query << "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `onlinetime`) VALUES (NULL, " << db->escapeString(characterName) << ", 1, " << accountId << ", " << level << ", " << vocationId << ", " << healthMax << ", " << healthMax << ", " << exp << ", 68, 76, 78, 39, " << lookType << ", 0, 0, " << manaMax << ", " << manaMax << ", 0, 100, 1, 100, 100, 7, 0, " << capMax << ", " << sex << ", 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)";


    query << "INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `onlinetime`, `deletion`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries`) VALUES (NULL, " << db->escapeString(characterName) << ", 1, " << accountId << ", " << level << ", 0, " << healthMax << ", " << healthMax << ", 0, 68, 76, 68, 79, " << lookType << ", 0, " << magLevel << ", 0, 0, " << manaSpent << ", 100, " << town << ", " << posx << ", " << posy << ", " << posz << ", '', " << capMax << ", " << sex << ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)";

    return db->executeQuery(query.str());
}

bool IOLoginData::setPassword(uint32_t accountId, std::string newPassword)
{

    Database* db = Database::getInstance();
    std::ostringstream query;

    transformToSHA1(newPassword);
    query << "UPDATE `accounts` SET `password` = " << db->escapeString(newPassword) << " WHERE `id` = " << accountId << ";";
    return db->executeQuery(query.str());
}

uint64_t IOLoginData::createAccount(std::string name, std::string password)
{

    password = transformToSHA1(password);

    Database* db = Database::getInstance();
    std::ostringstream query;

    query << "INSERT INTO `accounts` (`id`, `name`, `password`) VALUES (NULL, " << db->escapeString(name) << ", " << db->escapeString(password) << ")";
    if (!db->executeQuery(query.str()))
        return 0;

    return db->getLastInsertId();
}

bool IOLoginData::getAccountId(const std::string& name, uint32_t& number)
{
    if (!name.length())
        return false;

    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT `id` FROM `accounts` WHERE `name` = " << db->escapeString(name) << " LIMIT 1";

    DBResult_ptr result = db->storeQuery(query.str());
    if (!result)
        return false;

    number = result->getDataInt("id");
    return true;
}

bool IOLoginData::accountNameExists(const std::string& name)
{
    Database* db = Database::getInstance();
    std::ostringstream query;
    query << "SELECT 1 FROM `accounts` WHERE `name` = " << db->escapeString(name) << " LIMIT 1";

    DBResult_ptr result = db->storeQuery(query.str());
    if (!result)
        return false;

    return true;
}
You may not need any changes if that tfs 1.2
Try it on tfs 1.2 better
 
im using tfs 1.5, tfs is not better since it's outdated
I mean the version is all the less, the conversion process becomes easy and you may not need any modification
Post automatically merged:

There are children playing this game and they cannot create an account from the site So I want to create an account manager My server is already open and I have a website but 0 online because I don't have acc manger About 8.1 I'm talking
I hope someone can help me
 
Last edited:
Please try to stick with one Jobs thread if possible.
Locking this thread and referring users to your other Jobs thread.
 
Status
Not open for further replies.
Back
Top