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

Lobby now shows correct info for everything

This commit is contained in:
Biscuit Boy 2018-09-21 01:59:45 +10:00
parent 658046c132
commit f3a635f952
3 changed files with 48 additions and 9 deletions

View file

@ -50,8 +50,8 @@ void Core::Db::ZoneDbConnection::doPrepareStatements()
"CFPenaltyUntil = ?, Pose = ? WHERE CharacterId = ?;", CONNECTION_ASYNC ); "CFPenaltyUntil = ?, Pose = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelEquip, TerritoryId, GuardianDeity, " prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelMainWeapon, ModelSubWeapon, ModelEquip, TerritoryId, GuardianDeity, "
"Class, ContentId, BirthDay, BirthMonth " "Class, ContentId, BirthDay, BirthMonth, EquipDisplayFlags "
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC ); "FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, " prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, "

View file

@ -55,12 +55,16 @@ void PlayerMinimal::load( uint32_t charId )
auto modelEquip = res->getBlobVector( "ModelEquip" ); auto modelEquip = res->getBlobVector( "ModelEquip" );
memcpy( ( char* ) m_modelEquip, modelEquip.data(), modelEquip.size() ); memcpy( ( char* ) m_modelEquip, modelEquip.data(), modelEquip.size() );
m_modelMainWeapon = res->getUInt64( "ModelMainWeapon" );
m_modelSubWeapon = res->getUInt64( "ModelSubWeapon" );
m_equipDisplayFlags = res->getUInt8( "EquipDisplayFlags" );
setBirthDay( res->getUInt8( "BirthDay" ), res->getUInt8( "BirthMonth" ) ); setBirthDay( res->getUInt8( "BirthDay" ), res->getUInt8( "BirthMonth" ) );
m_guardianDeity = res->getUInt8( "GuardianDeity" ); m_guardianDeity = res->getUInt8( "GuardianDeity" );
m_class = res->getUInt8( "Class" ); m_class = res->getUInt8( "Class" );
m_contentId = res->getUInt64( "ContentId" ); m_contentId = res->getUInt64( "ContentId" );
m_zoneId = res->getUInt8( "TerritoryId" ); m_zoneId = res->getUInt16( "TerritoryId" );
// 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_SEL_MINIMAL );
@ -104,15 +108,20 @@ std::string PlayerMinimal::getModelString()
+ std::to_string( m_modelEquip[ 1 ] ) + "\",\"" + std::to_string( m_modelEquip[ 1 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 2 ] ) + "\",\"" + std::to_string( m_modelEquip[ 2 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 3 ] ) + "\",\"" + std::to_string( m_modelEquip[ 3 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 4 ] ) + "\",\"5\",\"6\",\"7\",\"8\",\"9\""; + std::to_string( m_modelEquip[ 4 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 5 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 6 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 7 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 8 ] ) + "\",\""
+ std::to_string( m_modelEquip[ 9 ] ) + "\"";
return modelString; return modelString;
} }
std::string PlayerMinimal::getInfoJson() std::string PlayerMinimal::getInfoJson()
{ {
std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," + std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," +
//"[" + getClassString() + "]," + "[\"0\",\"0\",\"0\",\"0\",\"" + std::to_string( getClassLevel( m_class ) ) +
"[\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"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() ) +
"\",\"" + std::to_string( getBirthDay() ) + "\",\"" + std::to_string( getBirthDay() ) +
@ -120,15 +129,37 @@ std::string PlayerMinimal::getInfoJson()
"\",\"" + std::to_string( m_class ) + "\",\"" + std::to_string( m_class ) +
"\",\"0\",\"" + std::to_string( getZoneId() ) + "\",\"0\",\"" + std::to_string( getZoneId() ) +
"\",\"0\"," + "\",\"0\"," +
"[" + getLookString() + "]," + "[" + getLookString() + "]," +
"\"0\",\"0\"," + "\"" + std::to_string( m_modelMainWeapon ) + "\",\"" + std::to_string( m_modelSubWeapon ) + "\"," +
"[" + getModelString() + "]," + "[" + getModelString() + "]," +
"\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"\",\"0\",\"0\"]," + "\"1\",\"0\",\"0\",\"0\",\"" + std::to_string( m_equipDisplayFlags ) +
"\",\"0\",\"\",\"0\",\"0\"]," +
"\"classname\":\"ClientSelectData\",\"classid\":116}"; "\"classname\":\"ClientSelectData\",\"classid\":116}";
return charDetails; return charDetails;
} }
uint16_t PlayerMinimal::getClassLevel(uint8_t classId)
{
auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
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,6 +31,8 @@ public:
std::string getClassString(); std::string getClassString();
uint16_t getClassLevel( uint8_t classId );
// return the id of the actor // return the id of the actor
uint32_t getId() const uint32_t getId() const
{ {
@ -177,6 +179,7 @@ private:
uint8_t m_birthMonth; uint8_t m_birthMonth;
uint8_t m_birthDay; uint8_t m_birthDay;
uint8_t m_class; uint8_t m_class;
uint8_t m_classLevel;
uint8_t m_voice; uint8_t m_voice;
@ -184,10 +187,15 @@ private:
uint16_t m_zoneId; uint16_t m_zoneId;
uint64_t m_modelMainWeapon;
uint64_t m_modelSubWeapon;
uint8_t m_equipDisplayFlags;
std::map< uint8_t, uint8_t > m_lookMap; std::map< uint8_t, uint8_t > m_lookMap;
std::map< uint8_t, uint16_t > m_classMap; std::map< uint8_t, uint16_t > m_classMap;
uint8_t m_look[26]; uint8_t m_look[26];
uint8_t m_gmRank; uint8_t m_gmRank;
bool m_gmInvis; bool m_gmInvis;