1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-03 17:27:47 +00:00
sapphire/src/world/Manager/LinkshellMgr.h

63 lines
1.9 KiB
C
Raw Normal View History

#pragma once
2018-10-25 12:44:51 +11:00
#include <memory>
#include <map>
#include <vector>
2018-12-02 02:01:41 +01:00
#include "ForwardsZone.h"
2018-12-02 02:01:41 +01:00
namespace Sapphire::World::Manager
2018-10-28 21:53:21 +01:00
{
2021-12-07 00:13:18 +01:00
enum Hierarchy : uint32_t
{
NONE_1 = 0x0,
MASTER = 0x1,
LEADER = 0x2,
MEMBER = 0x3,
INVITE = 0x4,
MAX_0 = 0x7,
};
2020-03-01 01:00:57 +11:00
class LinkshellMgr
2018-10-28 21:53:21 +01:00
{
private:
std::map< uint64_t, LinkshellPtr > m_linkshellIdMap;
std::map< std::string, LinkshellPtr > m_linkshellNameMap;
2018-10-28 21:53:21 +01:00
LinkshellPtr getLinkshellByName( const std::string& name );
2018-10-28 21:53:21 +01:00
public:
2020-03-01 01:00:57 +11:00
LinkshellMgr() = default;
// initialize all linkshells from db to memory
2018-10-28 21:53:21 +01:00
bool loadLinkshells();
2021-12-04 12:29:54 +01:00
void writeLinkshell( uint64_t lsId );
// create new linkshell entry and insert into db
LinkshellPtr createLinkshell( const std::string& name, Entity::Player& player );
void finishLinkshellCreation( const std::string& name, uint32_t result, Entity::Player& player );
void invitePlayer( Entity::Player& sourcePlayer, Entity::Player& invitedPlayer, uint64_t linkshellId );
2021-12-09 23:38:23 +01:00
void kickPlayer( Entity::Player& sourcePlayer, Entity::Player& kickedPlayer, uint64_t linkshellId );
void addLeader( Entity::Player& sourcePlayer, Entity::Player& newLeaderPlayer, uint64_t linkshellId );
void removeLeader( Entity::Player& sourcePlayer, Entity::Player& leaderPlayer, uint64_t linkshellId );
void declineLeader( Entity::Player& sourcePlayer, uint64_t linkshellId );
void changeMaster( Entity::Player& sourcePlayer, Entity::Player& nextMasterPlayer, uint64_t linkshellId );
void sendLinkshellList( Entity::Player& player );
// get all linkshells associated with player
const std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const;
LinkshellPtr getLinkshellById( uint64_t lsId );
2021-12-04 12:29:54 +01:00
2021-12-05 00:37:52 +01:00
void leaveLinkshell( uint64_t lsId, uint64_t characterId );
void joinLinkshell( uint64_t lsId, uint64_t characterId );
2021-12-04 12:29:54 +01:00
2018-10-28 21:53:21 +01:00
};
}