2023-02-03 22:52:52 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
#include "ForwardsZone.h"
|
|
|
|
|
|
|
|
namespace Sapphire::World::Manager
|
|
|
|
{
|
|
|
|
|
2023-02-06 15:49:47 +01:00
|
|
|
|
|
|
|
|
2023-02-03 22:52:52 +01:00
|
|
|
class FreeCompanyMgr
|
|
|
|
{
|
|
|
|
private:
|
2023-02-08 15:22:26 +01:00
|
|
|
std::unordered_map< uint64_t, FreeCompanyPtr > m_fcIdMap;
|
|
|
|
std::unordered_map< std::string, FreeCompanyPtr > m_fcNameMap;
|
2023-02-03 22:52:52 +01:00
|
|
|
|
2023-02-08 15:22:26 +01:00
|
|
|
/*! map used for easy lookup of char id to fc id */
|
|
|
|
std::unordered_map< uint64_t, uint64_t > m_charaIdToFcIdMap;
|
2023-02-03 22:52:52 +01:00
|
|
|
|
|
|
|
public:
|
2023-02-07 14:13:47 +01:00
|
|
|
|
2023-02-03 22:52:52 +01:00
|
|
|
FreeCompanyMgr() = default;
|
|
|
|
|
|
|
|
// initialize all fcs from db to memory
|
|
|
|
bool loadFreeCompanies();
|
|
|
|
void writeFreeCompany( uint64_t fcId );
|
|
|
|
|
|
|
|
// create new fc entry and insert into db
|
|
|
|
FreeCompanyPtr createFreeCompany( const std::string& name, const std::string& tag, Entity::Player& player );
|
|
|
|
|
|
|
|
bool renameFreeCompany( uint64_t fcId, const std::string& name, const std::string& tag, Entity::Player& player );
|
|
|
|
|
2023-02-08 23:27:12 +01:00
|
|
|
void addMember( uint64_t fcId, uint64_t memberId );
|
|
|
|
|
2023-02-07 14:13:47 +01:00
|
|
|
//void sendFreeCompanyResult( Entity::Player& player, uint64_t fcId, ResultType resultType, uint64_t target,
|
|
|
|
// uint32_t result, UpdateStatus updateStatus, std::string targetName );
|
2023-02-06 15:49:47 +01:00
|
|
|
|
|
|
|
void sendFcInviteList( Entity::Player& player );
|
|
|
|
void sendFcStatus( Entity::Player& player );
|
2023-02-03 22:52:52 +01:00
|
|
|
|
|
|
|
/* void invitePlayer( Entity::Player& sourcePlayer, Entity::Player& invitedPlayer, uint64_t linkshellId );
|
|
|
|
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 sendFreeCompanyStatus( Entity::Player& player );
|
|
|
|
|
2023-02-08 23:27:12 +01:00
|
|
|
void dbInsertMember( uint64_t fcId, uint64_t characterId, uint8_t hierarchyId );
|
|
|
|
|
2023-02-03 22:52:52 +01:00
|
|
|
// get fc associated with player
|
2023-02-08 23:27:12 +01:00
|
|
|
FreeCompanyPtr getPlayerFreeCompany( uint64_t characterId );
|
2023-02-03 22:52:52 +01:00
|
|
|
FreeCompanyPtr getFreeCompanyById( uint64_t fcId );
|
2023-02-08 15:22:26 +01:00
|
|
|
FreeCompanyPtr getFreeCompanyByName( const std::string& name );
|
2023-02-03 22:52:52 +01:00
|
|
|
|
|
|
|
// void leaveLinkshell( uint64_t lsId, uint64_t characterId );
|
|
|
|
// void joinLinkshell( uint64_t lsId, uint64_t characterId );
|
|
|
|
|
2023-02-07 14:13:47 +01:00
|
|
|
void onFcLogin( uint64_t characterId );
|
2023-02-08 15:22:26 +01:00
|
|
|
void onSignPetition( Entity::Player& source, Entity::Player& target );
|
2023-02-03 22:52:52 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|