diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index b95a3da1..c7f5fff1 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -1,11 +1,12 @@ #include "PlayerMinimal.h" -#include #include #include #include +#include + extern Sapphire::Data::ExdDataGenerated g_exdDataGen; namespace Sapphire::Api { @@ -123,11 +124,23 @@ std::string PlayerMinimal::getModelString() return modelString; } +std::string PlayerMinimal::getLevelsString() +{ + auto levelsArray = nlohmann::json(); + + for( int i = 0; i < Common::CLASSJOB_SLOTS; ++i ) + { + // these must be strings + levelsArray.push_back( std::to_string( m_classMap[ i ] ) ); + } + + return levelsArray.dump(); +} + std::string PlayerMinimal::getInfoJson() { std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," + - "[\"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\"]," + getLevelsString() + "," "\"0\",\"0\",\"0\",\"" + std::to_string( getBirthMonth() ) + "\",\"" + std::to_string( getBirthDay() ) + diff --git a/src/api/PlayerMinimal.h b/src/api/PlayerMinimal.h index b137af20..17318358 100644 --- a/src/api/PlayerMinimal.h +++ b/src/api/PlayerMinimal.h @@ -31,6 +31,8 @@ namespace Sapphire::Api std::string getClassString(); + std::string getLevelsString(); + uint8_t getClassLevel(); // return the id of the actor diff --git a/src/common/Common.h b/src/common/Common.h index 283d3c49..96e41193 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -24,6 +24,8 @@ namespace Sapphire::Common const uint16_t MAX_PLAYER_LEVEL = 80; const uint8_t CURRENT_EXPANSION_ID = 3; + const uint8_t CLASSJOB_SLOTS = 28; + /*! * @brief The maximum length (in ms) of a combo before it is canceled/voided. * diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index ef6b0e17..a9ba2da9 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -860,13 +860,13 @@ namespace Sapphire::Network::Packets::Server unsigned char unknown95[9]; unsigned char unknown9F[2]; unsigned char unknownA1[3]; - unsigned int exp[28]; + unsigned int exp[Common::CLASSJOB_SLOTS]; unsigned int unknown108; unsigned int pvpTotalExp; unsigned int unknownPvp110; unsigned int pvpExp; unsigned int pvpFrontlineOverallRanks[3]; - unsigned short levels[28]; + unsigned short levels[Common::CLASSJOB_SLOTS]; unsigned short unknown15C[9]; unsigned short u1; unsigned short u2; diff --git a/src/lobby/GameConnection.cpp b/src/lobby/GameConnection.cpp index 53548626..16c4d4da 100644 --- a/src/lobby/GameConnection.cpp +++ b/src/lobby/GameConnection.cpp @@ -180,7 +180,7 @@ void Lobby::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, uint32_t t // TODO: Eventually move to account info storage if( i == 3 ) { - charListPacket->data().entitledExpansion = 3; + charListPacket->data().entitledExpansion = Common::CURRENT_EXPANSION_ID; charListPacket->data().maxCharOnWorld = 25; charListPacket->data().unknown8 = 8; charListPacket->data().veteranRank = 12;