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:
parent
f3ff018ade
commit
5f34cb0a06
5 changed files with 14 additions and 18 deletions
|
@ -332,7 +332,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
|
||||||
std::string name = json["name"];
|
std::string name = json["name"];
|
||||||
std::string infoJson = json["infoJson"];
|
std::string infoJson = json["infoJson"];
|
||||||
|
|
||||||
std::string finalJson = Sapphire::Util::base64_decode( infoJson );
|
std::string finalJson = Sapphire::Util::base64Decode( infoJson );
|
||||||
|
|
||||||
// reloadConfig();
|
// reloadConfig();
|
||||||
|
|
||||||
|
|
|
@ -374,8 +374,7 @@ namespace Sapphire::Common
|
||||||
uint32_t sourceActorId;
|
uint32_t sourceActorId;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CharaLook :
|
enum CharaLook : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Race = 0x00,
|
Race = 0x00,
|
||||||
Gender = 0x01,
|
Gender = 0x01,
|
||||||
|
@ -406,8 +405,7 @@ namespace Sapphire::Common
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MoveType :
|
enum MoveType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Running = 0x00,
|
Running = 0x00,
|
||||||
Walking = 0x02,
|
Walking = 0x02,
|
||||||
|
@ -415,8 +413,7 @@ namespace Sapphire::Common
|
||||||
Jumping = 0x10,
|
Jumping = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MoveState :
|
enum MoveState : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
No = 0x00,
|
No = 0x00,
|
||||||
LeaveCollision = 0x01,
|
LeaveCollision = 0x01,
|
||||||
|
@ -424,8 +421,7 @@ namespace Sapphire::Common
|
||||||
StartFalling = 0x04,
|
StartFalling = 0x04,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MoveSpeed :
|
enum MoveSpeed : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Walk = 24,
|
Walk = 24,
|
||||||
Run = 60,
|
Run = 60,
|
||||||
|
@ -797,8 +793,7 @@ namespace Sapphire::Common
|
||||||
Unused100
|
Unused100
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EquipDisplayFlags :
|
enum EquipDisplayFlags : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
HideNothing = 0x0,
|
HideNothing = 0x0,
|
||||||
HideHead = 0x1,
|
HideHead = 0x1,
|
||||||
|
@ -811,8 +806,7 @@ namespace Sapphire::Common
|
||||||
Visor = 0x40,
|
Visor = 0x40,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SkillType :
|
enum SkillType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Normal = 0x1,
|
Normal = 0x1,
|
||||||
ItemAction = 0x2,
|
ItemAction = 0x2,
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
Ren<EFBFBD> Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
Ren<EFBFBD> Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
||||||
|
|
||||||
|
Sapphire Modifications
|
||||||
|
* Naming changed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
|
@ -39,7 +41,7 @@ static inline bool is_base64( uint8_t c )
|
||||||
return ( isalnum( c ) || ( c == '+' ) || ( 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;
|
std::string ret;
|
||||||
int32_t i = 0;
|
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 in_len = encoded_string.size();
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace Sapphire::Util
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ int Sapphire::Network::RestConnector::createCharacter( char* sId, std::string na
|
||||||
{
|
{
|
||||||
std::string json_string =
|
std::string json_string =
|
||||||
"{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name +
|
"{\"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 );
|
HttpResponse r = requestApi( "createCharacter", json_string );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue