diff --git a/src/servers/Server_Zone/Actor/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index 74df7bd1..0b289e31 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -30,8 +30,8 @@ #include "Script/ScriptManager.h" -#include "src/servers/Server_Zone/Actor/Social/FriendList.h" -#include "src/servers/Server_Zone/Actor/Social/Manager/FriendListMgr.h" +#include "src/servers/Server_Zone/Social/FriendList.h" +#include "src/servers/Server_Zone/Actor/Manager/FriendListMgr.h" #include "src/servers/Server_Zone/Script/ScriptManager.h" #include "Inventory/Item.h" diff --git a/src/servers/Server_Zone/Network/Handlers/PacketHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/PacketHandlers.cpp index 7b5907e9..2d7c6bee 100644 --- a/src/servers/Server_Zone/Network/Handlers/PacketHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/PacketHandlers.cpp @@ -44,7 +44,7 @@ extern Core::ServerZone g_serverZone; extern Core::ZoneMgr g_zoneMgr; extern Core::Data::ExdData g_exdData; extern Core::DebugCommandHandler g_gameCommandMgr; -extern Core::Social::SocialMgr g_socialMgr; +extern Core::Social::SocialMgr g_socialMgr; using namespace Core::Common; using namespace Core::Network::Packets; diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index 4c0b1dc6..a6bd54d3 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -41,7 +41,7 @@ Core::Data::ExdData g_exdData; Core::ZoneMgr g_zoneMgr; Core::LinkshellMgr g_linkshellMgr; Core::Db::DbWorkerPool< Core::Db::CharaDbConnection > g_charaDb; -Core::Entity::Social::FriendListMgr g_friendListMgr; +Core::Social::SocialMgr< Core::Social:: > g_friendListMgr; Core::ServerZone::ServerZone( const std::string& configPath ) : m_configPath( configPath ), @@ -220,7 +220,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] ) return; } - g_friendListMgr = Core::Social::SocialMgr(); + g_friendListMgr = Core::Social::SocialMgr(); Network::HivePtr hive( new Network::Hive() ); Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive ); diff --git a/src/servers/Server_Zone/Social/FriendList.cpp b/src/servers/Server_Zone/Social/FriendList.cpp index 6f8e4463..35ae351b 100644 --- a/src/servers/Server_Zone/Social/FriendList.cpp +++ b/src/servers/Server_Zone/Social/FriendList.cpp @@ -15,11 +15,10 @@ extern Core::ServerZone g_serverZone; extern Core::Logger g_log; -using namespace Core::Entity; using namespace Core::Network::Packets; using namespace Core::Network::Packets::Server; -std::vector< PlayerEntry > Core::Entity::Social::FriendList::getFriendListEntries( uint16_t entryAmount ) +std::vector< PlayerEntry > Core::Social::FriendList::getFriendListEntries( uint16_t entryAmount ) { std::vector< PlayerEntry > entryList = {}; uint16_t limit = 0; diff --git a/src/servers/Server_Zone/Social/FriendList.h b/src/servers/Server_Zone/Social/FriendList.h index 9b7f1bd4..16acdc87 100644 --- a/src/servers/Server_Zone/Social/FriendList.h +++ b/src/servers/Server_Zone/Social/FriendList.h @@ -16,7 +16,6 @@ using namespace Core::Network::Packets; using namespace Core::Network::Packets::Server; namespace Core { -namespace Entity { namespace Social { class FriendList; @@ -56,7 +55,6 @@ protected: }; -} } }; #endif // ! _FRIENDLIST_H \ No newline at end of file diff --git a/src/servers/Server_Zone/Social/Group.cpp b/src/servers/Server_Zone/Social/Group.cpp index 8ca4a402..cc7f4df4 100644 --- a/src/servers/Server_Zone/Social/Group.cpp +++ b/src/servers/Server_Zone/Social/Group.cpp @@ -15,7 +15,7 @@ extern Core::ServerZone g_serverZone; extern Core::Logger g_log; -using namespace Core::Entity::Social; +using namespace Core::Social; // todo: i fuckin have no fuckin clue how to use group manager classes, why not just have a map of ? // todo: invite map in g_serverZone.getGroupMgr(GroupType) and look up diff --git a/src/servers/Server_Zone/Social/Group.h b/src/servers/Server_Zone/Social/Group.h index d970b520..b610ca9b 100644 --- a/src/servers/Server_Zone/Social/Group.h +++ b/src/servers/Server_Zone/Social/Group.h @@ -11,7 +11,6 @@ #include namespace Core { -namespace Entity { namespace Social { class Group; @@ -51,10 +50,10 @@ public: bool isBlacklist() const; bool isContentGroup() const; - virtual Core::Network::Packets::GamePacketPtr addMember( PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); + virtual Core::Network::Packets::GamePacketPtr addMember( Entity::PlayerPtr pSender, Entity::PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); - virtual Core::Network::Packets::GamePacketPtr inviteMember( PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); - virtual Core::Network::Packets::GamePacketPtr removeMember( PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); + virtual Core::Network::Packets::GamePacketPtr inviteMember( Entity::PlayerPtr pSender, Entity::PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); + virtual Core::Network::Packets::GamePacketPtr removeMember( Entity::PlayerPtr pSender, Entity::PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); //virtual Core::Network::Packets::GamePacketPtr kickMember( PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0 ); virtual void sendPacketToMembers( Core::Network::Packets::GamePacketPtr pPacket, bool invitesToo = false ); @@ -87,7 +86,6 @@ private: }; -} } }; #endif // ! _GROUP_H \ No newline at end of file diff --git a/src/servers/Server_Zone/Social/Manager/FriendListMgr.cpp b/src/servers/Server_Zone/Social/Manager/FriendListMgr.cpp index 7db0ffbf..c33a59bc 100644 --- a/src/servers/Server_Zone/Social/Manager/FriendListMgr.cpp +++ b/src/servers/Server_Zone/Social/Manager/FriendListMgr.cpp @@ -9,19 +9,18 @@ extern Core::Logger g_log; -using namespace Core::Entity; -Core::Entity::Social::FriendListMgr::FriendListMgr() +Core::Social::FriendListMgr::FriendListMgr() { } -bool Social::FriendListMgr::init() +bool Core::Social::FriendListMgr::init() { return true; } -uint64_t Social::FriendListMgr::fetchPlayerFriendsList( uint32_t playerId ) +uint64_t Core::Social::FriendListMgr::fetchPlayerFriendsList( uint32_t playerId ) { uint64_t newGroupId = generateGroupId(); diff --git a/src/servers/Server_Zone/Social/Manager/FriendListMgr.h b/src/servers/Server_Zone/Social/Manager/FriendListMgr.h index df059097..161e39b4 100644 --- a/src/servers/Server_Zone/Social/Manager/FriendListMgr.h +++ b/src/servers/Server_Zone/Social/Manager/FriendListMgr.h @@ -27,7 +27,7 @@ public: FriendListPtr findGroupByInviteIdForPlayer( uint64_t playerId ) const; FriendListPtr findGroupById( uint64_t groupId ) const; */ - std::map< uint64_t, FriendListPtr > m_groups; + //std::map< uint64_t, FriendListPtr > m_groups; private: // todo: can we handle this m_groups grouptype better..? @@ -35,7 +35,7 @@ private: }; -} -} }; +} + #endif /* ! _FRIENDLISTMGR_H */ \ No newline at end of file diff --git a/src/servers/Server_Zone/Social/Manager/SocialMgr.cpp b/src/servers/Server_Zone/Social/Manager/SocialMgr.cpp index 627d4daa..c308c4b3 100644 --- a/src/servers/Server_Zone/Social/Manager/SocialMgr.cpp +++ b/src/servers/Server_Zone/Social/Manager/SocialMgr.cpp @@ -3,17 +3,18 @@ template< class T > -Core::Social::SocialMgr::GroupMgr() +Core::Social::SocialMgr::SocialMgr() +{ + +} +template< class T > +Core::Social::SocialMgr::~SocialMgr() { } -Core::Social::SocialMgr::~GroupMgr() -{ - -} - -T Core::Social::SocialMgr::findGroupByInviteIdForPlayer( uint64_t playerId ) const +template< class T > +T Core::Social::SocialMgr< T >::findGroupByInviteIdForPlayer( uint64_t playerId ) const { auto it = m_invites.find( playerId ); if( it != m_invites.end() ) @@ -22,8 +23,8 @@ T Core::Social::SocialMgr::findGroupByInviteIdForPlayer( uint64_t playerId ) con } return nullptr; } - -T Core::Social::SocialMgr::findGroupById( uint64_t groupId ) const +template< class T > +T Core::Social::SocialMgr< T >::findGroupById( uint64_t groupId ) const { auto it = m_groups.find( groupId ); if( it != m_groups.end() ) @@ -33,13 +34,15 @@ T Core::Social::SocialMgr::findGroupById( uint64_t groupId ) const return nullptr; } -uint64_t Core::Social::SocialMgr::GroupMgr::generateGroupId() +template< class T > +uint64_t Core::Social::SocialMgr< T >::generateGroupId() const { m_lastGroupId++; return m_lastGroupId; } -bool Core::Social::SocialMgr::hasInvite( uint64_t playerId ) const +template< class T > +bool Core::Social::SocialMgr< T >::hasInvite( uint64_t playerId ) const { auto it = m_invites.find( playerId ); if ( it != m_invites.end() ) diff --git a/src/servers/Server_Zone/Social/Manager/SocialMgr.h b/src/servers/Server_Zone/Social/Manager/SocialMgr.h index 079efb44..e70c877d 100644 --- a/src/servers/Server_Zone/Social/Manager/SocialMgr.h +++ b/src/servers/Server_Zone/Social/Manager/SocialMgr.h @@ -59,7 +59,7 @@ protected: friend virtual void disband(); */ - virtual uint64_t generateGroupId(); + virtual uint64_t generateGroupId() const; private: std::map< uint64_t, T > m_groups;