mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
With new binaries in place, master moves everything onto them while the server keeps running (the dashboard's Live update, /liveupdate or SIGUSR2 to master): - database migrations of the new build first; a failure stops there - UGC finishes the jobs it is running (queued rows stay pending), auth restarts, chat hands its teams to master for the next chat server; master starts the new processes and retries ones that don't come back - once the new chat server is up (CHAT_SERVER_READY) every world connects at once and sends its players again (LoginSessionNotify resync, no login logged) - every world instance is replaced with an instance migration: public worlds and private ones (same password) at once, properties after the old instance saved and froze the property (MIGRATE_PREPARE: no building, claiming or saving there any more), activity zones and character select once their players left or after a wait; empty instances just stop, zones in prestart_worlds get a new one first - the dashboard restarts last and picks the status up again Players land where they stood (position carried in CarriedPlayerState, also on properties and Moon Base). Draining instances get no new players (InstanceMigration::AcceptsNewPlayers) and show as "Moving players" in the world list. The order lives in LiveUpdateMachine.h without master state and is unit tested; master's glue is LiveUpdateCoordinator. Master itself is not replaced. Message IDs are appended only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
#ifndef USERMANAGER_H
|
|
#define USERMANAGER_H
|
|
|
|
#define _VARIADIC_MAX 10
|
|
#include <string>
|
|
#include <vector>
|
|
#include "RakNetTypes.h"
|
|
#include <map>
|
|
|
|
class User;
|
|
|
|
namespace WorldPackets {
|
|
struct CharacterCreateRequest;
|
|
struct CharacterDeleteRequest;
|
|
struct CharacterRenameRequest;
|
|
}
|
|
|
|
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, const WorldPackets::CharacterCreateRequest& request);
|
|
void DeleteCharacter(const SystemAddress& sysAddr, const WorldPackets::CharacterDeleteRequest& request);
|
|
void RenameCharacter(const SystemAddress& sysAddr, const WorldPackets::CharacterRenameRequest& request);
|
|
void LoginCharacter(const SystemAddress& sysAddr, LWOOBJID playerID);
|
|
|
|
void SaveAllActiveCharacters();
|
|
|
|
size_t GetUserCount() const { return m_Users.size(); }
|
|
// Everyone connected, by address (character selection moves them one by one in a live update)
|
|
const std::map<SystemAddress, User*>& GetUsers() const { return m_Users; }
|
|
|
|
// 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
|