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

Fix/Patch Level and vocation instead of world name on character login

That wasn't any fix at all? If you followed the tutorial in the first place , you wouldn't have any problem with compiling.
 
done exactly what it says at first post and what Elexonic said and stills giving me error (TFS 0.3.6pl1)

erroruf.png
 
Remember to turn off displayOnOrOffAtCharlist in config.lua
displayOnOrOffAtCharlist = false

Else it didn't work for me (0.4)
 
Error:

protocollogin.cpp: In member function 'virtual void ProtocolLogin::eek:nRecvFirstMessage(NetworkMessage&)':
protocollogin.cpp:243: error: name lookup of 'it' changed for ISO 'for' scoping
protocollogin.cpp:243: note: (if you use '-fpermissive' G++ will accept your code)
protocollogin.cpp:243: error: no matching function for call to 'IOLoginData::getCheckPlayerLevel(std::pair<unsigned int, unsigned int>&)'
 
I HAVE NEW VOCATIONS IN MY SERVER

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();
 
}

HOW CAN EDIT THIS?
 
Maybe like i did?

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;
case 5: voc = "E";
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;
case 5: voc = "ET";
break;
default: voc = "Uknown";
} 
}

std::stringstream ret;
ret << "Level: "<< pLevel << " Voc: " << voc;
result->free();
return ret.str();

}
 
Fito:

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";
}
}

else if (prom == 2)
{
switch (pVoc)
{
case 0: voc = "Rookie";
break;
case 1: voc = "EPIC MS";
break;
case 2: voc = "EPIC ED";
break;
case 3: voc = "EPIC RP";
break;
case 4: voc = "EPIC EK";
break;
default: voc = "Uknown";
}
}

std::stringstream ret;
ret << "Level: "<< pLevel << " Voc: " << voc;
result->free();
return ret.str();

}
 
I don't understand why you let the script first read from the database and then checks for the voc and replace it with the shortcode. Why don't you just print the vocation name from the database? The code is a good idea and thanks for sharing!:)
 
You should create this in one MySQL query instead of 1 + count of characters.
 
I like It:
54533731249575603472.png


Edit this:
Code:
output->putString(IOLoginData::getInstance()->getCheckPlayerLevel((*it)));
for this:
Code:
output->AddString(IOLoginData::getInstance()->getCheckPlayerLevel((*it)));
 
I have no idea how to add a third vocation, tried but failed.. can someone help me?

Dark Wizard (DW)
Holy Priest (HP)
Nobleman (N)
Barbarian (B)

REP+++<33
 
Im getting this error:
Code:
protocollogin.cpp: In member function âbool ProtocolLogin::parseFirstPacket(NetworkMessage&)â:
protocollogin.cpp:214: error: name lookup of âitâ changed for ISO âforâ scoping
protocollogin.cpp:214: note: (if you use â-fpermissiveâ G++ will accept your code)
protocollogin.cpp:214: error: no matching function for call to âIOLoginData::getCheckPlayerLevel(std::pair<unsigned int, unsigned int>&)â
iologindata.h:102: note: candidates are: std::string IOLoginData::getCheckPlayerLevel(const std::string&) const

Using TFS 0.3.6pl1
 
Hey, nice job! But you say works on tfs 0.3.6pl1 and 0.4 ...

in subversion i can only take 0.2.15.r102 max.... where could I find this version?!

thanks in advance!


----

Sorry, I took a better look and found... :rolleyes:
 
Last edited:
Back
Top