2021-11-27 00:53:57 +01:00
|
|
|
#pragma once
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2018-10-26 11:01:41 +02:00
|
|
|
#include <memory>
|
2017-08-08 13:53:47 +02:00
|
|
|
#include "PlayerMinimal.h"
|
|
|
|
|
2019-06-07 18:12:35 +10:00
|
|
|
namespace Sapphire::Api
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
|
|
|
class Session;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-06-07 18:12:35 +10:00
|
|
|
class SapphireApi
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
|
|
|
public:
|
2019-06-07 18:12:35 +10:00
|
|
|
SapphireApi() = default;
|
|
|
|
~SapphireApi() = default;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
using SessionMap = std::map< std::string, std::shared_ptr< Session > >;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool login( const std::string& username, const std::string& pass, std::string& sId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool createAccount( const std::string& username, const std::string& pass, std::string& sId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-03-17 21:07:00 +11:00
|
|
|
int32_t createCharacter( uint32_t accountId, const std::string& name,
|
|
|
|
const std::string& infoJson, uint32_t gmRank );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
void deleteCharacter( std::string name, uint32_t accountId );
|
2017-08-08 22:55:02 +02:00
|
|
|
|
2019-03-17 21:07:00 +11:00
|
|
|
bool insertSession( uint32_t accountId, std::string& sId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2019-06-07 18:12:35 +10:00
|
|
|
std::vector< Api::PlayerMinimal > getCharList( uint32_t accountId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool checkNameTaken( std::string name );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
uint32_t getNextEntityId();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
uint64_t getNextCharaId();
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
int32_t checkSession( const std::string& sId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool removeSession( const std::string& sId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
SessionMap m_sessionMap;
|
|
|
|
|
|
|
|
};
|
2017-08-08 13:53:47 +02:00
|
|
|
}
|