mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 14:07:46 +00:00
misc api cleanup
This commit is contained in:
parent
83b7a659a8
commit
9574819dec
3 changed files with 4 additions and 86 deletions
|
@ -14,17 +14,11 @@ namespace Sapphire::Api {
|
|||
using namespace Common;
|
||||
|
||||
// player constructor
|
||||
PlayerMinimal::PlayerMinimal( void ) :
|
||||
PlayerMinimal::PlayerMinimal() :
|
||||
m_id( 0 )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// deconstructor
|
||||
PlayerMinimal::~PlayerMinimal( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// load player from the db
|
||||
|
@ -85,58 +79,6 @@ void PlayerMinimal::load( uint32_t charId )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
std::string PlayerMinimal::getLookString()
|
||||
{
|
||||
|
||||
auto it = m_lookMap.begin();
|
||||
|
||||
std::string lookString;
|
||||
|
||||
for( ; it != m_lookMap.end(); ++it )
|
||||
{
|
||||
|
||||
std::string s = std::to_string( it->second );
|
||||
|
||||
lookString += "\"" + s + "\"";
|
||||
if( it != m_lookMap.end() )
|
||||
{
|
||||
lookString += ",";
|
||||
}
|
||||
}
|
||||
|
||||
return lookString.substr( 0, lookString.size() - 1 );
|
||||
}
|
||||
|
||||
std::string PlayerMinimal::getModelString()
|
||||
{
|
||||
std::string modelString = "\""
|
||||
+ std::to_string( m_modelEquip[ 0 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 1 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 2 ] ) + "\",\""
|
||||
+ std::to_string( m_modelEquip[ 3 ] ) + "\",\""
|
||||
+ 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;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
auto payload = nlohmann::json();
|
||||
|
@ -221,30 +163,6 @@ uint8_t PlayerMinimal::getClassLevel()
|
|||
return static_cast< uint8_t >( m_classMap[ classJobIndex ] );
|
||||
}
|
||||
|
||||
std::string PlayerMinimal::getClassString()
|
||||
{
|
||||
|
||||
std::map< uint8_t, uint16_t >::iterator it;
|
||||
|
||||
it = m_classMap.begin();
|
||||
|
||||
std::string classString;
|
||||
|
||||
for( ; it != m_classMap.end(); ++it )
|
||||
{
|
||||
|
||||
std::string s = std::to_string( it->second );
|
||||
|
||||
classString += "\"" + s + "\"";
|
||||
if( it != m_classMap.end() )
|
||||
{
|
||||
classString += ",";
|
||||
}
|
||||
}
|
||||
|
||||
return classString.substr( 0, classString.size() - 1 );
|
||||
}
|
||||
|
||||
void PlayerMinimal::saveAsNew()
|
||||
{
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace Sapphire::Api
|
|||
class PlayerMinimal
|
||||
{
|
||||
public:
|
||||
PlayerMinimal( void );
|
||||
PlayerMinimal();
|
||||
|
||||
~PlayerMinimal( void );
|
||||
~PlayerMinimal() = default;
|
||||
|
||||
// write player to the database
|
||||
void write();
|
||||
|
|
|
@ -699,7 +699,7 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe
|
|||
catch( const exception& )
|
||||
{
|
||||
string content = "Path not found: " + request->path;
|
||||
*response << buildHttpResponse( 400, content );
|
||||
*response << buildHttpResponse( 404, content );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue