mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-08 03:37:45 +00:00
Added functions for queueing packets for entire an entire ls or fc.
This commit is contained in:
parent
75a66ac532
commit
8d46426599
6 changed files with 79 additions and 11 deletions
|
@ -193,6 +193,16 @@ uint64_t Sapphire::FreeCompany::getChatChannel() const
|
|||
return m_chatChannelId;
|
||||
}
|
||||
|
||||
const std::set< uint64_t >& Sapphire::FreeCompany::getMemberIdList() const
|
||||
{
|
||||
return m_memberIds;
|
||||
}
|
||||
|
||||
std::set< uint64_t >& Sapphire::FreeCompany::getMemberIdList()
|
||||
{
|
||||
return m_memberIds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -108,5 +108,13 @@ void Sapphire::Linkshell::setName( std::string name )
|
|||
m_name = std::move( name );
|
||||
}
|
||||
|
||||
std::vector< uint64_t > Sapphire::Linkshell::getAllMemberIds()
|
||||
{
|
||||
std::vector< uint64_t > allMembers( m_leaderIds.size() + m_memberIds.size() );
|
||||
allMembers.insert( allMembers.end(), m_leaderIds.begin(), m_leaderIds.end() );
|
||||
allMembers.insert( allMembers.end(), m_memberIds.begin(), m_memberIds.end() );
|
||||
return allMembers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ namespace Sapphire
|
|||
|
||||
std::set< uint64_t >& getInviteIdList();
|
||||
|
||||
/*! return a combined list of members and leaders */
|
||||
std::vector< uint64_t > getAllMemberIds();
|
||||
|
||||
uint64_t getChatChannel() const;
|
||||
|
||||
void addMember( uint64_t memberId );
|
||||
|
|
|
@ -262,7 +262,7 @@ void LinkshellMgr::invitePlayer( Entity::Player& sourcePlayer, Entity::Player& i
|
|||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), sourcePlayer.getName() );
|
||||
|
||||
server.queueForPlayer( invitedPlayer.getCharacterId(), linkshellInviteResult );
|
||||
server.queueForLinkshell( linkshellId, linkshellInviteResult, { sourcePlayer.getCharacterId() } );
|
||||
|
||||
auto linkshellInviteResult1 = makeLinkshellResult( sourcePlayer, lsPtr->getId(), 0,
|
||||
WorldPackets::Client::LinkshellJoin, 0,
|
||||
|
@ -289,16 +289,16 @@ void LinkshellMgr::kickPlayer( Entity::Player& sourcePlayer, Entity::Player& kic
|
|||
sendLinkshellList( kickedPlayer );
|
||||
|
||||
auto linkshellKickResult = makeLinkshellResult( kickedPlayer, lsPtr->getId(), 0,
|
||||
WorldPackets::Client::LinkshellKick, 0,
|
||||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), sourcePlayer.getName() );
|
||||
WorldPackets::Client::LinkshellKick, 0,
|
||||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), sourcePlayer.getName() );
|
||||
|
||||
server.queueForPlayer( kickedPlayer.getCharacterId(), linkshellKickResult );
|
||||
server.queueForLinkshell( linkshellId, linkshellKickResult, { sourcePlayer.getCharacterId() } );
|
||||
|
||||
auto linkshellKickResult1 = makeLinkshellResult( sourcePlayer, lsPtr->getId(), 0,
|
||||
WorldPackets::Client::LinkshellKick, 0,
|
||||
LinkshellResultPacket::UpdateStatus::Execute,
|
||||
lsPtr->getName(), kickedPlayer.getName() );
|
||||
WorldPackets::Client::LinkshellKick, 0,
|
||||
LinkshellResultPacket::UpdateStatus::Execute,
|
||||
lsPtr->getName(), kickedPlayer.getName() );
|
||||
|
||||
server.queueForPlayer( sourcePlayer.getCharacterId(), linkshellKickResult1 );
|
||||
chatChannelMgr.removeFromChannel( lsPtr->getChatChannel(), kickedPlayer );
|
||||
|
@ -391,7 +391,7 @@ void LinkshellMgr::addLeader( Entity::Player &sourcePlayer, Entity::Player &newL
|
|||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), sourcePlayer.getName() );
|
||||
|
||||
server.queueForPlayer( newLeaderPlayer.getCharacterId(), linkshellResult );
|
||||
server.queueForLinkshell( linkshellId, linkshellResult, { sourcePlayer.getCharacterId() } );
|
||||
|
||||
auto linkshellResult1 = makeLinkshellResult( sourcePlayer, lsPtr->getId(), 0,
|
||||
WorldPackets::Client::LinkshellAddLeader, 0,
|
||||
|
@ -441,7 +441,7 @@ void LinkshellMgr::removeLeader( Entity::Player &sourcePlayer, Entity::Player &l
|
|||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), sourcePlayer.getName() );
|
||||
|
||||
server.queueForPlayer( leaderPlayer.getCharacterId(), linkshellResult );
|
||||
server.queueForLinkshell( linkshellId, linkshellResult, { sourcePlayer.getCharacterId() } );
|
||||
|
||||
auto linkshellResult1 = makeLinkshellResult( sourcePlayer, lsPtr->getId(), 0,
|
||||
WorldPackets::Client::LinkshellRemoveLeader, 0,
|
||||
|
@ -470,7 +470,7 @@ void LinkshellMgr::changeMaster( Entity::Player &sourcePlayer, Entity::Player &n
|
|||
LinkshellResultPacket::UpdateStatus::Target,
|
||||
lsPtr->getName(), nextMasterPlayer.getName() );
|
||||
|
||||
server.queueForPlayer( nextMasterPlayer.getCharacterId(), linkshellResult );
|
||||
server.queueForLinkshell( linkshellId, linkshellResult, { sourcePlayer.getCharacterId() } );
|
||||
|
||||
auto linkshellResult1 = makeLinkshellResult( sourcePlayer, lsPtr->getId(), nextMasterPlayer.getCharacterId(),
|
||||
WorldPackets::Client::LinkshellChangeMaster, 0,
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Linkshell/Linkshell.h"
|
||||
#include "FreeCompany/FreeCompany.h"
|
||||
|
||||
#include <Database/ZoneDbConnection.h>
|
||||
#include <Database/DbWorkerPool.h>
|
||||
#include <Service.h>
|
||||
|
@ -689,4 +692,44 @@ void WorldServer::queueForPlayer( uint64_t characterId, std::vector< Sapphire::N
|
|||
{
|
||||
pZoneCon->queueOutPacket( packet );
|
||||
}
|
||||
}
|
||||
|
||||
void WorldServer::queueForLinkshell( uint64_t lsId, Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket, std::set< uint64_t > exceptionCharIdList )
|
||||
{
|
||||
auto lsMgr = Common::Service< Manager::LinkshellMgr >::ref();
|
||||
|
||||
auto ls = lsMgr.getLinkshellById( lsId );
|
||||
if( !ls )
|
||||
return;
|
||||
|
||||
auto members = ls->getAllMemberIds();
|
||||
|
||||
for( const auto& memberId : members )
|
||||
{
|
||||
if( exceptionCharIdList.count( memberId ) )
|
||||
continue;
|
||||
|
||||
queueForPlayer( memberId, pPacket );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void WorldServer::queueForFreeCompany( uint64_t fcId, Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket, std::set< uint64_t > exceptionCharIdList )
|
||||
{
|
||||
auto fcMgr = Common::Service< Manager::FreeCompanyMgr >::ref();
|
||||
|
||||
auto fc = fcMgr.getFreeCompanyById( fcId );
|
||||
if( !fc )
|
||||
return;
|
||||
|
||||
auto members = fc->getMemberIdList();
|
||||
|
||||
for( const auto& memberId : members )
|
||||
{
|
||||
if( exceptionCharIdList.count( memberId ) )
|
||||
continue;
|
||||
|
||||
queueForPlayer( memberId, pPacket );
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include "ForwardsZone.h"
|
||||
#include <Config/ConfigDef.h>
|
||||
|
||||
|
@ -53,6 +54,9 @@ namespace Sapphire::World
|
|||
void queueForPlayer( uint64_t characterId, Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket );
|
||||
void queueForPlayer( uint64_t characterId, std::vector< Sapphire::Network::Packets::FFXIVPacketBasePtr > packets );
|
||||
|
||||
void queueForLinkshell( uint64_t lsId, Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket, std::set< uint64_t > exceptionCharIdList = {} );
|
||||
void queueForFreeCompany( uint64_t fcId, Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket, std::set< uint64_t > exceptionCharIdList = {} );
|
||||
|
||||
Entity::PlayerPtr addPlayer( uint64_t characterId );
|
||||
|
||||
Entity::PlayerPtr loadPlayer( uint32_t entityId );
|
||||
|
|
Loading…
Add table
Reference in a new issue