mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch: accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes they need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
#ifndef USERMANAGER_H
|
|
#define USERMANAGER_H
|
|
|
|
#define _VARIADIC_MAX 10
|
|
#include <string>
|
|
#include <vector>
|
|
#include "RakNetTypes.h"
|
|
#include <map>
|
|
|
|
class User;
|
|
|
|
class UserManager {
|
|
public:
|
|
static UserManager* Instance() {
|
|
if (!m_Address) {
|
|
m_Address = new UserManager();
|
|
}
|
|
|
|
return m_Address;
|
|
}
|
|
|
|
void Initialize();
|
|
~UserManager();
|
|
|
|
User* CreateUser(const SystemAddress& sysAddr, const std::string& username, const std::string& sessionKey);
|
|
User* GetUser(const SystemAddress& sysAddr);
|
|
User* GetUser(const std::string& username);
|
|
std::vector<User*> GetUsersForAccount(uint32_t accountId);
|
|
bool DeleteUser(const SystemAddress& sysAddr); //Returns true on succesful deletion
|
|
void DeletePendingRemovals();
|
|
|
|
std::string GetPredefinedName(uint32_t firstNameIndex, uint32_t middleNameIndex, uint32_t lastNameIndex);
|
|
bool IsNamePreapproved(const std::string& requestedName);
|
|
|
|
void RequestCharacterList(const SystemAddress& sysAddr);
|
|
void CreateCharacter(const SystemAddress& sysAddr, Packet* packet);
|
|
void DeleteCharacter(const SystemAddress& sysAddr, Packet* packet);
|
|
void RenameCharacter(const SystemAddress& sysAddr, Packet* packet);
|
|
void LoginCharacter(const SystemAddress& sysAddr, LWOOBJID playerID);
|
|
|
|
void SaveAllActiveCharacters();
|
|
|
|
size_t GetUserCount() const { return m_Users.size(); }
|
|
|
|
// Access cached config values
|
|
bool GetMuteAutoRejectNames() const { return m_MuteAutoRejectNames; }
|
|
bool GetMuteRestrictTrade() const { return m_MuteRestrictTrade; }
|
|
bool GetMuteRestrictMail() const { return m_MuteRestrictMail; }
|
|
|
|
private:
|
|
static UserManager* m_Address; //Singleton
|
|
std::map<SystemAddress, User*> m_Users;
|
|
std::vector<User*> m_UsersToDelete;
|
|
|
|
std::vector<std::string> m_FirstNames;
|
|
std::vector<std::string> m_MiddleNames;
|
|
std::vector<std::string> m_LastNames;
|
|
std::vector<std::string> m_PreapprovedNames;
|
|
|
|
// Cached config values that can change on config reload
|
|
bool m_MuteAutoRejectNames = false;
|
|
bool m_MuteRestrictTrade = false;
|
|
bool m_MuteRestrictMail = false;
|
|
};
|
|
|
|
#endif // USERMANAGER_H
|