• 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 0.X block vocations on account manager

Lurk

Active Member
Joined
Dec 4, 2017
Messages
336
Reaction score
48
Hello, I have some custom vocations and they're available on my account manager. I know that's why I have my fromvoc with the same id of the vocation, but I want set on my iologindata.cpp which vocations id are available for everyone. I didn't found a good way to do this but on the sources and I know this is where I have to make the changes

C++:
bool IOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex, uint32_t townId)
{
    if(playerExists(characterName))
        return false;

    Vocation* vocation = Vocations::getInstance()->getVocation(vocationId);
    Vocation* rookVoc = Vocations::getInstance()->getVocation(0);

    Town* town = Towns::getInstance()->getTown(townId);

    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));
    uint64_t exp = 0;
    if(level > 1)
        exp = Player::getExpForLevel(level);

    if(tmpLevel > 0)
    {
        healthMax += rookVoc->getGain(GAIN_HEALTH) * tmpLevel;
        manaMax += rookVoc->getGain(GAIN_MANA) * tmpLevel;
        capMax += rookVoc->getGainCap() * tmpLevel;
        if(level > 8)
        {
            tmpLevel = level - 8;
            healthMax += vocation->getGain(GAIN_HEALTH) * tmpLevel;
            manaMax += vocation->getGain(GAIN_MANA) * tmpLevel;
            capMax += vocation->getGainCap() * tmpLevel;
        }
    }

    Database* db = Database::getInstance();
    DBQuery query;

    query << "INSERT INTO `players` (`id`, `name`, `world_id`, `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`, `skull`, `skulltime`, `save`, `rank_id`, `guildnick`, `lastlogout`, `blessings`, `online`) VALUES (NULL, " << db->escapeString(characterName) << ", " << g_config.getNumber(ConfigManager::WORLD_ID) << ", 1, " << accountId << ", " << level << ", " << vocationId << ", " << healthMax << ", " << healthMax << ", " << exp << ", 68, 76, 78, 39, " << lookType << ", 0, " << g_config.getNumber(ConfigManager::START_MAGICLEVEL) << ", " << manaMax << ", " << manaMax << ", 0, 100, " << townId << ", " << town->getPosition().x << ", " << town->getPosition().y << ", " << town->getPosition().z << ", 0, " << capMax << ", " << sex << ", 0, 0, 0, 0, 1, 0, '', 0, 0, 0)";
    return db->query(query.str());
}

can anyone help me?

nvm just found a solution, since I don't know if I can post a link to a different forum here, I'll leave the solution here Possible Spam Detected (https://pastebin.com/Em91NkhQ) ALL CREDITOS TO ONESHOT from that other forum..
 
Last edited:
Solution
thank you for your answer, I didn't really test it because I've found another one that wouldn't require source edites if I wanted to add new vocations to the acc manager but thank you regardless <3
 
Back
Top