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:
And replace:
Now you need to configure your server sources:
Open configmanager.h and look for:
And replace:
Search for:
Add below:
Open configmanager.cpp and look for:
And replace with:
Search for:
Add below:
Open iologindata.h and look for:
And replace with:
Open iologindata.cpp and look for:
TFS 3884
And replace with:
TFS 5247
Search for:
And replace with:
Open player.h and look for:
And replace:
Open player.cpp and look for:
TFS 3884
TFS 5247
Add below:
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:
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!
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
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,
Code:
DEFAULT_TOWN_ID,
Code:
START_CHOOSEVOC,
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);
Code:
m_confNumber[DEFAULT_TOWN_ID]= getGlobalNumber("newPlayerDefaultTownId",1);
Code:
m_confBool[START_CHOOSEVOC]= getGlobalBool("newPlayerChooseVoc",false);
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);
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());
}
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());
}
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());
}
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;
Code:
int32_t managerNumber, managerNumber2, managerNumber3;
Open player.cpp and look for:
TFS 3884
Code:
editListId = maxWriteLen = windowTextId = rankId =0;
Code:
windowTextId = nextExAction = offlineTrainingTime = lastStatsTrainingTime = 0;
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:
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!