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

More refactoring for code consistency

This commit is contained in:
mordred 2019-03-08 11:05:32 +01:00
parent f3ff018ade
commit 5f34cb0a06
5 changed files with 14 additions and 18 deletions

View file

@ -332,7 +332,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
std::string name = json["name"];
std::string infoJson = json["infoJson"];
std::string finalJson = Sapphire::Util::base64_decode( infoJson );
std::string finalJson = Sapphire::Util::base64Decode( infoJson );
// reloadConfig();

View file

@ -374,8 +374,7 @@ namespace Sapphire::Common
uint32_t sourceActorId;
};
enum CharaLook :
uint8_t
enum CharaLook : uint8_t
{
Race = 0x00,
Gender = 0x01,
@ -406,8 +405,7 @@ namespace Sapphire::Common
};
enum MoveType :
uint8_t
enum MoveType : uint8_t
{
Running = 0x00,
Walking = 0x02,
@ -415,8 +413,7 @@ namespace Sapphire::Common
Jumping = 0x10,
};
enum MoveState :
uint8_t
enum MoveState : uint8_t
{
No = 0x00,
LeaveCollision = 0x01,
@ -424,8 +421,7 @@ namespace Sapphire::Common
StartFalling = 0x04,
};
enum MoveSpeed :
uint8_t
enum MoveSpeed : uint8_t
{
Walk = 24,
Run = 60,
@ -797,8 +793,7 @@ namespace Sapphire::Common
Unused100
};
enum EquipDisplayFlags :
uint8_t
enum EquipDisplayFlags : uint8_t
{
HideNothing = 0x0,
HideHead = 0x1,
@ -811,8 +806,7 @@ namespace Sapphire::Common
Visor = 0x40,
};
enum SkillType :
uint8_t
enum SkillType : uint8_t
{
Normal = 0x1,
ItemAction = 0x2,

View file

@ -23,6 +23,8 @@
Ren<EFBFBD> Nyffenegger rene.nyffenegger@adp-gmbh.ch
Sapphire Modifications
* Naming changed
*/
#include "base64.h"
@ -39,7 +41,7 @@ static inline bool is_base64( uint8_t c )
return ( isalnum( c ) || ( c == '+' ) || ( c == '/' ) );
}
std::string Sapphire::Util::base64_encode( uint8_t const* bytes_to_encode, uint32_t in_len )
std::string Sapphire::Util::base64Encode( uint8_t const* bytes_to_encode, uint32_t in_len )
{
std::string ret;
int32_t i = 0;
@ -85,7 +87,7 @@ std::string Sapphire::Util::base64_encode( uint8_t const* bytes_to_encode, uint3
}
std::string Sapphire::Util::base64_decode( std::string const& encoded_string )
std::string Sapphire::Util::base64Decode( std::string const& encoded_string )
{
int32_t in_len = encoded_string.size();
int32_t i = 0;

View file

@ -2,9 +2,9 @@
namespace Sapphire::Util
{
std::string base64_encode( uint8_t const*, uint32_t len );
std::string base64Encode( uint8_t const*, uint32_t len );
std::string base64_decode( const std::string& s );
std::string base64Decode( const std::string& s );
}

View file

@ -287,7 +287,7 @@ int Sapphire::Network::RestConnector::createCharacter( char* sId, std::string na
{
std::string json_string =
"{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name +
"\",\"infoJson\": \"" + Sapphire::Util::base64_encode( ( uint8_t* ) infoJson.c_str(), infoJson.length() ) + "\"}";
"\",\"infoJson\": \"" + Sapphire::Util::base64Encode( ( uint8_t* ) infoJson.c_str(), infoJson.length() ) + "\"}";
HttpResponse r = requestApi( "createCharacter", json_string );