Hi all, i just took the code of GSMaster who posted here : http://otland.net/f35/level-instead-world-name-character-login-help-156580/index3.html#post1521747 and i added the vocation...
It shows the character login like this:
of course, if you have another vocation names you have to fix it by yourself xD (don't worry, it's too easy)
ok, here is the code:
iologindata.h
go to:
paste under
iologindata.cpp (paste end file..)
for 0.3.6pl1
for 0.4
protocollogin.cpp
find
replace with:
[code//output->putString(g_config.getString(ConfigManager::SERVE R_NAME));[/code]
paste under:
works on tfs 0.3.6pl1 and 0.4
I hope you like it
Regards
It shows the character login like this:
of course, if you have another vocation names you have to fix it by yourself xD (don't worry, it's too easy)
ok, here is the code:
iologindata.h
go to:
Code:
uint32_t getAccountIdByName(const std::string& name) const;
paste under
Code:
std::string getCheckPlayerLevel(const std::string& name) const;
iologindata.cpp (paste end file..)
for 0.3.6pl1
Code:
std::string IOLoginData::getCheckPlayerLevel(const std::string& name) const
{
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `level`, `vocation`, `promotion` FROM `players` WHERE `name` " << db->getStringComparison() << db->escapeString(name) << ";";
DBResult* result;
if (!(result = db->storeQuery(query.str())))
return false;
const uint32_t pLevel = result->getDataInt("level");
const uint32_t pVoc = result->getDataInt("vocation");
const uint32_t prom = result->getDataInt("promotion");
std::string voc;
if (prom == 0) {
switch (pVoc) {
case 0:
voc = "Rookie";
break;
case 1:
voc = "S";
break;
case 2:
voc = "D";
break;
case 3:
voc = "P";
break;
case 4:
voc = "K";
break;
default:
voc = "Uknown";
}
} else if (prom == 1) {
switch (pVoc) {
case 0:
voc = "Rookie";
break;
case 1:
voc = "MS";
break;
case 2:
voc = "ED";
break;
case 3:
voc = "RP";
break;
case 4:
voc = "EK";
break;
default:
voc = "Uknown";
}
}
std::stringstream ret;
ret << "Level: "<< pLevel << " Voc: " << voc;
result->free();
return ret.str();
}
Code:
std::string IOLoginData::getCheckPlayerLevel(const std::string& name) const
{
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `level`, `vocation`, `promotion` FROM `players` WHERE `name` " << db->getStringComparer() << db->escapeString(name) << ";";
DBResult* result;
if (!(result = db->storeQuery(query.str())))
return false;
const uint32_t pLevel = result->getDataInt("level");
const uint32_t pVoc = result->getDataInt("vocation");
const uint32_t prom = result->getDataInt("promotion");
std::string voc;
if (prom == 0) {
switch (pVoc) {
case 0:
voc = "Rookie";
break;
case 1:
voc = "S";
break;
case 2:
voc = "D";
break;
case 3:
voc = "P";
break;
case 4:
voc = "K";
break;
default:
voc = "Uknown";
}
} else if (prom == 1) {
switch (pVoc) {
case 0:
voc = "Rookie";
break;
case 1:
voc = "MS";
break;
case 2:
voc = "ED";
break;
case 3:
voc = "RP";
break;
case 4:
voc = "EK";
break;
default:
voc = "Uknown";
}
}
std::stringstream ret;
ret << "Level: "<< pLevel << " Voc: " << voc;
result->free();
return ret.str();
}
protocollogin.cpp
find
Code:
output->putString(g_config.getString(ConfigManager::SERVE R_NAME));
[code//output->putString(g_config.getString(ConfigManager::SERVE R_NAME));[/code]
paste under:
Code:
output->putString(IOLoginData::getInstance()->getCheckPlayerLevel((*it)));
works on tfs 0.3.6pl1 and 0.4
I hope you like it
Regards
Last edited by a moderator: