1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 00:47:45 +00:00

Fixed linkshell chat channels

This commit is contained in:
Mordred 2021-12-05 17:21:37 +01:00
parent e84c034509
commit c5ed71325b
2 changed files with 16 additions and 0 deletions

View file

@ -297,6 +297,7 @@ void LinkshellMgr::sendLinkshellList( Entity::Player& player )
void LinkshellMgr::leaveLinkshell( uint64_t lsId, uint64_t characterId )
{
auto& server = Common::Service< World::WorldServer >::ref();
auto& chatChannelMgr = Common::Service< Manager::ChatChannelMgr >::ref();
auto leavingPlayer = server.getPlayer( characterId );
auto lsPtr = getLinkshellById( lsId );
if( !leavingPlayer || !lsPtr )
@ -305,12 +306,14 @@ void LinkshellMgr::leaveLinkshell( uint64_t lsId, uint64_t characterId )
lsPtr->removeMember( characterId );
writeLinkshell( lsId );
chatChannelMgr.removePlayerFromChannel( lsPtr->getChatChannel(), *leavingPlayer );
sendLinkshellList( *leavingPlayer );
}
void LinkshellMgr::joinLinkshell( uint64_t lsId, uint64_t characterId )
{
auto &server = Common::Service< World::WorldServer >::ref();
auto& chatChannelMgr = Common::Service< Manager::ChatChannelMgr >::ref();
auto joiningPlayer = server.getPlayer( characterId );
auto lsPtr = getLinkshellById( lsId );
if( !joiningPlayer || !lsPtr )
@ -320,5 +323,7 @@ void LinkshellMgr::joinLinkshell( uint64_t lsId, uint64_t characterId )
lsPtr->removeInvite( characterId );
writeLinkshell( lsId );
chatChannelMgr.addPlayerToChannel( lsPtr->getChatChannel(), *joiningPlayer );
sendLinkshellList( *joiningPlayer );
}

View file

@ -16,12 +16,17 @@
#include "Territory/QuestBattle.h"
#include "TerritoryMgr.h"
#include "HousingMgr.h"
#include "ChatChannelMgr.h"
#include "LinkshellMgr.h"
#include "Linkshell/Linkshell.h"
#include "Territory/Land.h"
#include "Territory/House.h"
#include "Territory/Housing/HousingInteriorTerritory.h"
#include "NaviMgr.h"
Sapphire::World::Manager::TerritoryMgr::TerritoryMgr() :
m_lastInstanceId( 10000 )
{
@ -799,6 +804,12 @@ bool Sapphire::World::Manager::TerritoryMgr::joinWorld( Sapphire::Entity::Player
player.setRot( 0.0f );
}
auto& chatChannelMgr = Common::Service< Manager::ChatChannelMgr >::ref();
auto& linkshellMgr = Common::Service< Manager::LinkshellMgr >::ref();
auto lsList = linkshellMgr.getPlayerLinkshells( player );
for( auto& ls : lsList )
chatChannelMgr.addPlayerToChannel( ls->getChatChannel(), player );
if( !movePlayer( pCurrZone, player ) )
return false;