mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43: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>
69 lines
3.4 KiB
C++
69 lines
3.4 KiB
C++
// Darkflame Universe
|
|
// Copyright 2025
|
|
|
|
#ifndef TEAMCONTAINER_H
|
|
#define TEAMCONTAINER_H
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "dCommonVars.h"
|
|
#include "ChatPackets.h"
|
|
#include "master/LiveUpdate.h"
|
|
|
|
struct SystemAddress;
|
|
struct PlayerData;
|
|
struct TeamData;
|
|
|
|
namespace TeamContainer {
|
|
struct Data {
|
|
std::vector<TeamData*> mTeams;
|
|
};
|
|
|
|
void Shutdown();
|
|
|
|
void HandleTeamInvite(const ChatPackets::TeamInvite& invite, const SystemAddress& sysAddr);
|
|
void HandleTeamInviteResponse(const ChatPackets::TeamInviteResponse& response, const SystemAddress& sysAddr);
|
|
void HandleTeamLeave(const ChatPackets::TeamLeave& request, const SystemAddress& sysAddr);
|
|
void HandleTeamKick(const ChatPackets::TeamKick& request, const SystemAddress& sysAddr);
|
|
void HandleTeamPromote(const ChatPackets::TeamSetLeader& request, const SystemAddress& sysAddr);
|
|
void HandleTeamLootOption(const ChatPackets::TeamSetLoot& request, const SystemAddress& sysAddr);
|
|
void HandleTeamStatusRequest(const ChatPackets::TeamGetStatus& request, const SystemAddress& sysAddr);
|
|
|
|
void SendTeamInvite(const PlayerData& receiver, const PlayerData& sender);
|
|
void SendTeamInviteConfirm(const PlayerData& receiver, bool bLeaderIsFreeTrial, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, uint8_t ucResponseCode, std::u16string wsLeaderName);
|
|
void SendTeamStatus(const PlayerData& receiver, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, std::u16string wsLeaderName);
|
|
void SendTeamSetLeader(const PlayerData& receiver, LWOOBJID i64PlayerID);
|
|
void SendTeamAddPlayer(const PlayerData& receiver, bool bIsFreeTrial, bool bLocal, bool bNoLootOnDeath, LWOOBJID i64PlayerID, std::u16string wsPlayerName, LWOZONEID zoneID);
|
|
|
|
/* Sends a message to the provided `receiver` with information about the updated team. If `i64LeaderID` is not LWOOBJID_EMPTY, the client will update the leader to that new playerID. */
|
|
void SendTeamRemovePlayer(const PlayerData& receiver, bool bDisband, bool bIsKicked, bool bIsLeaving, bool bLocal, LWOOBJID i64LeaderID, LWOOBJID i64PlayerID, std::u16string wsPlayerName);
|
|
void SendTeamSetOffWorldFlag(const PlayerData& receiver, LWOOBJID i64PlayerID, LWOZONEID zoneID);
|
|
|
|
void CreateTeamServer(const ChatPackets::CreateTeam& request, const SystemAddress& sysAddr);
|
|
|
|
TeamData* CreateLocalTeam(std::vector<LWOOBJID> members);
|
|
TeamData* CreateTeam(LWOOBJID leader, bool local = false);
|
|
TeamData* GetTeam(LWOOBJID playerID);
|
|
void AddMember(TeamData* team, LWOOBJID playerID);
|
|
void RemoveMember(TeamData* team, LWOOBJID playerID, bool disband, bool kicked, bool leaving, bool silent = false);
|
|
void PromoteMember(TeamData* team, LWOOBJID newLeader);
|
|
void DisbandTeam(TeamData* team, const LWOOBJID causingPlayerID, const std::u16string& causingPlayerName);
|
|
void TeamStatusUpdate(TeamData* team);
|
|
void UpdateTeamsOnWorld(TeamData* team, bool deleteTeam);
|
|
|
|
const TeamContainer::Data& GetTeamContainer();
|
|
|
|
// Live updates: the teams, for the next chat server (CHAT_HANDOFF)
|
|
ChatHandoff MakeHandoff();
|
|
|
|
// Live updates: the teams the last chat server had. Nothing is sent to anyone: the clients and worlds still know
|
|
// their teams; the players themselves come back as the worlds send them again.
|
|
void Restore(const ChatHandoff& handoff);
|
|
std::vector<TeamData*>& GetTeamsMut();
|
|
const std::vector<TeamData*>& GetTeams();
|
|
};
|
|
|
|
#endif //!TEAMCONTAINER_H
|