1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-06-01 22:07:45 +00:00
sapphire/src/servers/Server_Zone/Actor/Group/Group.h

81 lines
2.2 KiB
C
Raw Normal View History

2017-11-21 13:20:43 +00:00
#ifndef _GROUP_H
#define _GROUP_H
#include <Server_Common/Common.h>
#include <Server_Common/Forwards.h>
#include <Server_Zone/Forwards.h>
#include <boost/enable_shared_from_this.hpp>
#include <set>
#include <cstdint>
#include <map>
namespace Core {
namespace Entity {
namespace Group {
2017-11-21 17:01:05 +00:00
class Group;
using GroupPtr = boost::shared_ptr< Group >;
2017-11-21 13:20:43 +00:00
struct GroupMember
{
uint64_t inviterId;
uint64_t contentId;
std::string name;
2017-11-21 13:20:43 +00:00
uint32_t role;
};
enum class GroupType : uint8_t
{
None,
Party,
2017-11-21 17:01:05 +00:00
FriendList,
2017-11-21 13:20:43 +00:00
FreeCompany,
Linkshell,
FreeCompanyPetition,
Blacklist,
ContentGroup
};
class Group : public boost::enable_shared_from_this< Group >
{
private:
GroupType m_type{ GroupType::None };
uint64_t m_id{ 0 };
uint64_t m_ownerId{ 0 };
uint32_t m_maxCapacity{ 250 };
uint32_t m_maxRoles{ 50 };
time_point m_createTime{ std::chrono::steady_clock::now() };
std::map< uint64_t, GroupMember > m_members;
std::map< uint64_t, uint64_t > m_invites; // <recipient, sender>
2017-11-21 13:20:43 +00:00
2017-11-21 17:01:05 +00:00
virtual void load();
virtual void update();
virtual void disband();
public:
Group( uint64_t id, uint64_t ownerId, uint32_t maxCapacity, time_point createTime ) :
m_id( id ), m_ownerId( m_ownerId ), m_maxCapacity( maxCapacity ), m_createTime( createTime ){};
~Group(){};
bool isParty() const;
bool isFriendList() const;
bool isFreeCompany() const;
bool isLinkshell() const;
bool isFreeCompanyPetition() const;
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 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 kickMember(PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId = 0, uint64_t recipientId = 0);
virtual void sendPacketToMembers(Core::Network::Packets::GamePacketPtr pPacket, bool invitesToo = false);
2017-11-21 13:20:43 +00:00
};
}
}
};
#endif // ! _GROUP_H