• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature Account Manager with city option

djtuca

Technical Support
Joined
Jun 25, 2011
Messages
198
Reaction score
3
Location
Brazil
Credits : Myself and Oneshot
Tested on : TFs 0.4 3884 (8.6) and 5247(9.8) - And for OTX Server 9.8x
Descripción: Well, I saw the script created by OneShot is given the option to choose the city of Account Manager and then modified to work well in version 9.8x
Many servers without creating the site and some players complain that he was born in that city (which player), this script, as it gives you the option to choose what city wants to be born.
Recalling that cities vary with the configuration of your map..

Open config.lua and look for:
Code:
newPlayerSpawnPosX = 95
newPlayerSpawnPosY = 117
newPlayerSpawnPosZ = 7
newPlayerTownId = 1
And replace:
Code:
newPlayerChooseTown =true
newPlayerDefaultTownId =1

Now you need to configure your server sources:
Open configmanager.h and look for:
Code:
SPAWNPOS_X,
SPAWNPOS_Y,
SPAWNPOS_Z,
SPAWNTOWN_ID,
And replace:
Code:
DEFAULT_TOWN_ID,
Search for:
Code:
START_CHOOSEVOC,
Add below:
Code:
START_CHOOSETOWN,

Open configmanager.cpp and look for:
Code:
m_confNumber[SPAWNPOS_X]= getGlobalNumber("newPlayerSpawnPosX",100);
m_confNumber[SPAWNPOS_Y] = getGlobalNumber("newPlayerSpawnPosY", 100);
m_confNumber[SPAWNPOS_Z] = getGlobalNumber("newPlayerSpawnPosZ", 7);
m_confNumber[SPAWNTOWN_ID]= getGlobalNumber("newPlayerTownId",1);
And replace with:
Code:
m_confNumber[DEFAULT_TOWN_ID]= getGlobalNumber("newPlayerDefaultTownId",1);
Search for:
Code:
m_confBool[START_CHOOSEVOC]= getGlobalBool("newPlayerChooseVoc",false);
Add below:
Code:
m_confBool[START_CHOOSETOWN]= getGlobalBool("newPlayerChooseTown",true);

Open iologindata.h and look for:
Code:
bool createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex);
And replace with:
Code:
bool createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex, uint32_t townId);

Open iologindata.cpp and look for:
TFS 3884
Code:
boolIOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex)

{
if(playerExists(characterName))
return false;

Vocation* vocation = Vocations::getInstance()->getVocation(vocationId);
Vocation* rookVoc = Vocations::getInstance()->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));
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, " << g_config.getNumber(ConfigManager::SPAWNTOWN_ID) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_X) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_Y) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_Z) << ", 0, " << capMax << ", " << sex << ", 0, 0, 0, 0, 1, 0, '', 0, 0, 0)";
return db->query(query.str());
}
And replace with:
Code:
boolIOLoginData::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());
}
TFS 5247
Search for:
Code:
bool IOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex){
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `id` FROM `players` WHERE `name` " << db->getStringComparer() << db->escapeString(characterName) << ";";
DBResult* result = db->storeQuery(query.str());
if(result)
{
result->free();
return false;
}


Vocation* vocation = Vocations::getInstance()->getVocation(vocationId);
Vocation* rookVoc = Vocations::getInstance()->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));
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;
}
}


query.str("");
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, " << g_config.getNumber(ConfigManager::SPAWNTOWN_ID) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_X) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_Y) << ", " << g_config.getNumber(ConfigManager::SPAWNPOS_Z) << ", 0, " << capMax << ", " << sex << ", 0, 0, 0, 0, 1, 0, '', 0, 0, 0)";
return db->query(query.str());

}
And replace with:
Code:
bool IOLoginData::createCharacter(uint32_t accountId, std::string characterName, int32_t vocationId, uint16_t sex, uint32_t townId){
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `id` FROM `players` WHERE `name` " << db->getStringComparer() << db->escapeString(characterName) << ";";
DBResult* result = db->storeQuery(query.str());
if(result)
{
result->free();
return false;
}


Vocation* vocation = Vocations::getInstance()->getVocation(vocationId);
Vocation* rookVoc = Vocations::getInstance()->getVocation(0);
Town* town = Towns::getInstance()->getTown(townId);


uint16_t healthMax = 185, manaMax = 35, capMax = 500, 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;
}
}


query.str("");
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());

}

Open player.h and look for:
Code:
int32_t managerNumber, managerNumber2;
And replace:
Code:
int32_t managerNumber, managerNumber2, managerNumber3;

Open player.cpp and look for:
TFS 3884
Code:
editListId = maxWriteLen = windowTextId = rankId =0;
TFS 5247
Code:
windowTextId = nextExAction = offlineTrainingTime = lastStatsTrainingTime = 0;
Add below:
Code:
managerNumber3 = g_config.getNumber(ConfigManager::DEFAULT_TOWN_ID);

CAUTION WITH THIS PART

TFS 3884 - Search for:
[C++] Player - Pastebin.com
And replace:
[C++] player2 - Pastebin.com
TFS 5247
Search for :
[C++] player5247 - Pastebin.com
And replace with:
[C++] player5247x - Pastebin.com

Well, the result will look like:
RTwM6.jpg

The cities that are appearing here are the cities that exist in the original map of TFS, this will change according to your map.
By default, the config.lua is configured to town 1 - change to your liking.

* An error that does not solve however, was that the city is on the VIP list if your map, so be careful - Any help?

Hope that helps, any suggestions or criticism is welcome!
 
HOW EDDIT ACCOUNT MAGANER FOR ONLY SELECCTION CHARACTER NAME ? CREATE CHARACTERS ONLY WITH CHARACTER NAME
 
Back
Top