1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 22:57:45 +00:00

classLevel cleanup, now check EXD

This commit is contained in:
Biscuit Boy 2018-09-21 03:26:02 +10:00
parent 31333dea49
commit 4da346bedd
2 changed files with 14 additions and 24 deletions

View file

@ -66,15 +66,21 @@ void PlayerMinimal::load( uint32_t charId )
m_contentId = res->getUInt64( "ContentId" ); m_contentId = res->getUInt64( "ContentId" );
m_zoneId = res->getUInt16( "TerritoryId" ); m_zoneId = res->getUInt16( "TerritoryId" );
res.reset();
// SELECT ClassIdx, Exp, Lvl // SELECT ClassIdx, Exp, Lvl
auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_MINIMAL ); auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
stmtClass->setInt( 1, m_id ); stmtClass->setInt( 1, m_id );
auto resClass = g_charaDb.query( stmt ); auto resClass = g_charaDb.query( stmtClass );
while( resClass->next() ) while( resClass->next() )
{ {
m_classMap[ resClass->getUInt( 1 ) ] = resClass->getUInt( 3 ); auto classIdx = resClass->getUInt( 1 );
auto lvl = resClass->getUInt( 3 );
m_classMap[ classIdx ] = lvl;
m_classLevel = getClassLevel();
} }
} }
@ -120,7 +126,7 @@ std::string PlayerMinimal::getModelString()
std::string PlayerMinimal::getInfoJson() std::string PlayerMinimal::getInfoJson()
{ {
std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," + std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," +
"[\"0\",\"0\",\"0\",\"0\",\"" + std::to_string( getClassLevel( m_class ) ) + "[\"0\",\"0\",\"0\",\"0\",\"" + std::to_string( m_classLevel ) +
"\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]," "\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"],"
"\"0\",\"0\",\"0\",\"" + "\"0\",\"0\",\"0\",\"" +
std::to_string( getBirthMonth() ) + std::to_string( getBirthMonth() ) +
@ -138,26 +144,10 @@ std::string PlayerMinimal::getInfoJson()
return charDetails; return charDetails;
} }
uint16_t PlayerMinimal::getClassLevel(uint8_t classId) uint8_t PlayerMinimal::getClassLevel()
{ {
uint8_t classJobIndex = g_exdDataGen.get< Core::Data::ClassJob >( static_cast< uint8_t >( m_class ) )->expArrayIndex;
auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL ); return static_cast< uint8_t >( m_classMap[ classJobIndex ] );
stmtClass->setInt( 1, m_id );
auto resClass = g_charaDb.query( stmtClass );
while( resClass->next() )
{
auto classIdx = resClass->getUInt16( 1 );
auto lvl = resClass->getUInt8( 3 );
if( classIdx == classId ) {
m_classLevel = lvl;
break;
}
}
return m_classLevel;
} }
std::string PlayerMinimal::getClassString() std::string PlayerMinimal::getClassString()

View file

@ -31,7 +31,7 @@ public:
std::string getClassString(); std::string getClassString();
uint16_t getClassLevel( uint8_t classId ); uint8_t getClassLevel();
// return the id of the actor // return the id of the actor
uint32_t getId() const uint32_t getId() const