mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
a60865cd19
* simplify leaderboard code, fully abstract database * update exception catching * update exception catching and sql references, remove ugc from gamemessages fix deleting model remove unrelated changes Update GameMessages.cpp * remove ugc from gamemessages * Update GameMessages.cpp * Update Leaderboard.cpp * bug fixes * fix racing leaderboard * remove extra stuff * update * add sqlite * use a default for optimizations * update sqlite * Fix limits on update and delete * fix bugs * use definition to switch between databases * add switch for different backends * fix include guard and includes * always build both * add mysql if block * Update Database.cpp * add new options and add check to prevent overriding mysql * correct config names * Update README.md * Update README.md * merge to 1 sql file for sqlite database * move to sqlite folder * add back mysql migrations * Update README.md * add migration to correct the folder name or mysql * yes aron * updates * Update CMakeLists.txt * dont use paths at all, add where check to only update if folder name still exist check also doesnt check for slashes and assumes one will be there since it will be. * default dont auto create account for releases we can change this flag * default 0 * add times played query * fix leaderboard not incrementing on a not better score * add env vars with defaults for docker * use an "enum" * default to mariadb * Update .env.example
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#ifndef __IACCOUNTS__H__
|
|
#define __IACCOUNTS__H__
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
enum class eGameMasterLevel : uint8_t;
|
|
|
|
class IAccounts {
|
|
public:
|
|
struct Info {
|
|
std::string bcryptPassword;
|
|
uint32_t id{};
|
|
uint32_t playKeyId{};
|
|
bool banned{};
|
|
bool locked{};
|
|
eGameMasterLevel maxGmLevel{};
|
|
};
|
|
|
|
// Get the account info for the given username.
|
|
virtual std::optional<IAccounts::Info> GetAccountInfo(const std::string_view username) = 0;
|
|
|
|
// Update the account's unmute time.
|
|
virtual void UpdateAccountUnmuteTime(const uint32_t accountId, const uint64_t timeToUnmute) = 0;
|
|
|
|
// Update the account's ban status.
|
|
virtual void UpdateAccountBan(const uint32_t accountId, const bool banned) = 0;
|
|
|
|
// Update the account's password.
|
|
virtual void UpdateAccountPassword(const uint32_t accountId, const std::string_view bcryptpassword) = 0;
|
|
|
|
// Add a new account to the database.
|
|
virtual void InsertNewAccount(const std::string_view username, const std::string_view bcryptpassword) = 0;
|
|
|
|
// Update the GameMaster level of an account.
|
|
virtual void UpdateAccountGmLevel(const uint32_t accountId, const eGameMasterLevel gmLevel) = 0;
|
|
|
|
virtual uint32_t GetAccountCount() = 0;
|
|
};
|
|
|
|
#endif //!__IACCOUNTS__H__
|