mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-24 18:47:45 +00:00
stub some party related stuff
This commit is contained in:
parent
249215b501
commit
439c4cadf6
28 changed files with 218 additions and 11 deletions
|
@ -802,6 +802,30 @@ namespace Common {
|
||||||
MountSkill = 0xD,
|
MountSkill = 0xD,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum SocialCategory : uint8_t
|
||||||
|
{
|
||||||
|
Party = 1,
|
||||||
|
Friends = 2,
|
||||||
|
FreeCompanyPetition = 4,
|
||||||
|
FreeCompany = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
// todo: rename SocialRequestAction and SocialRequestResponse cause they seem ambiguous
|
||||||
|
enum class SocialRequestAction : uint8_t
|
||||||
|
{
|
||||||
|
Invite = 1,
|
||||||
|
Cancel = 2,
|
||||||
|
Accept = 3,
|
||||||
|
Decline = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class SocialRequestResponse : uint8_t
|
||||||
|
{
|
||||||
|
Decline,
|
||||||
|
Accept,
|
||||||
|
Cancel,
|
||||||
|
};
|
||||||
|
|
||||||
struct ServerEntry
|
struct ServerEntry
|
||||||
{
|
{
|
||||||
uint32_t serverId;
|
uint32_t serverId;
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
#define _COMMON_FORWARDS_H
|
#define _COMMON_FORWARDS_H
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
using time_point = std::chrono::steady_clock::time_point;
|
||||||
|
using duration = std::chrono::steady_clock::duration;
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace Packets {
|
||||||
|
|
||||||
CFDutyInfoHandler = 0x0078, // updated 4.1 ??
|
CFDutyInfoHandler = 0x0078, // updated 4.1 ??
|
||||||
|
|
||||||
SocialReqSendHandler = 0x00AE, // updated 4.1
|
SocialReqSendHandler = 0x00AF, // updated 4.1
|
||||||
SocialListHandler = 0x00B3, // updated 4.1
|
SocialListHandler = 0x00B3, // updated 4.1
|
||||||
SetSearchInfoHandler = 0x00B5, // updated 4.1
|
SetSearchInfoHandler = 0x00B5, // updated 4.1
|
||||||
|
|
||||||
|
|
|
@ -83,19 +83,36 @@ struct PlayerEntry {
|
||||||
uint64_t contentId;
|
uint64_t contentId;
|
||||||
uint8_t bytes[12];
|
uint8_t bytes[12];
|
||||||
uint16_t zoneId;
|
uint16_t zoneId;
|
||||||
uint16_t zoneId1;
|
uint8_t grandCompany;
|
||||||
char bytes1[8];
|
uint8_t clientLanguage;
|
||||||
|
uint8_t knownLanguages; // bitmask, J 0x01, E 0x02, D 0x04, F 0x08
|
||||||
|
uint8_t searchComment; // bool
|
||||||
|
char bytes1[6];
|
||||||
uint64_t onlineStatusMask;
|
uint64_t onlineStatusMask;
|
||||||
uint8_t classJob;
|
uint8_t classJob;
|
||||||
uint8_t padding;
|
uint8_t padding;
|
||||||
uint8_t level;
|
uint16_t level;
|
||||||
uint8_t padding1;
|
|
||||||
uint16_t padding2;
|
uint16_t padding2;
|
||||||
uint8_t one;
|
uint8_t one;
|
||||||
char name[0x20];
|
char name[0x20];
|
||||||
char fcTag[9];
|
char fcTag[9];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcSocialRequestError : FFXIVIpcBasePacket<SocialRequestError>
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcSocialRequestResponse : FFXIVIpcBasePacket<SocialRequestResponse>
|
||||||
|
{
|
||||||
|
uint64_t contentId;
|
||||||
|
uint32_t unknown;
|
||||||
|
uint8_t category; // Common::SocialCategory
|
||||||
|
uint8_t response; // Common::SocialRequestResponse
|
||||||
|
char name[0x20];
|
||||||
|
uint16_t padding;
|
||||||
|
};
|
||||||
|
|
||||||
struct FFXIVIpcSocialList : FFXIVIpcBasePacket<SocialList>
|
struct FFXIVIpcSocialList : FFXIVIpcBasePacket<SocialList>
|
||||||
{
|
{
|
||||||
uint32_t padding;
|
uint32_t padding;
|
||||||
|
|
0
src/servers/Server_Zone/Actor/Group/ContentGroup.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/ContentGroup.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/ContentGroup.h
Normal file
0
src/servers/Server_Zone/Actor/Group/ContentGroup.h
Normal file
0
src/servers/Server_Zone/Actor/Group/FreeCompany.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/FreeCompany.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/FreeCompany.h
Normal file
0
src/servers/Server_Zone/Actor/Group/FreeCompany.h
Normal file
83
src/servers/Server_Zone/Actor/Group/Group.cpp
Normal file
83
src/servers/Server_Zone/Actor/Group/Group.cpp
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
#include <cassert>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
#include <Server_Common/Network/PacketDef/Ipcs.h>
|
||||||
|
#include <Server_Common/Network/PacketDef/Zone/ServerZoneDef.h>
|
||||||
|
#include <Server_Zone/Actor/Actor.h>
|
||||||
|
#include <Server_Zone/Actor/Player.h>
|
||||||
|
#include <Server_Zone/ServerZone.h>
|
||||||
|
#include <Server_Common/Network/GamePacketNew.h>
|
||||||
|
#include "Group.h"
|
||||||
|
|
||||||
|
// todo: i fuckin have no fuckin clue how to use group manager classes, why not just have a map of <id, group>?
|
||||||
|
// todo: invite map in g_serverZone.getGroupMgr(GroupType) and look up
|
||||||
|
|
||||||
|
Core::Network::Packets::GamePacketPtr Core::Entity::Group::Group::addMember( PlayerPtr pSender, PlayerPtr pRecipient, uint64_t senderId, uint64_t recipientId )
|
||||||
|
{
|
||||||
|
constexpr uint32_t logMessages[] = {
|
||||||
|
0, //
|
||||||
|
1
|
||||||
|
};
|
||||||
|
assert( pSender != nullptr || senderId != 0 );
|
||||||
|
|
||||||
|
using namespace Core::Network::Packets;
|
||||||
|
|
||||||
|
uint64_t recipientContentId = 0;
|
||||||
|
|
||||||
|
if( pSender )
|
||||||
|
{
|
||||||
|
senderId = pSender->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pRecipient )
|
||||||
|
{
|
||||||
|
recipientId = pRecipient->getId();
|
||||||
|
recipientContentId = pRecipient->getContentId();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto packet = GamePacketNew< Server::FFXIVIpcSocialRequestResponse, ServerZoneIpcType >( recipientId, senderId );
|
||||||
|
packet.data().contentId = recipientContentId;
|
||||||
|
|
||||||
|
if( m_members.size() < m_maxCapacity )
|
||||||
|
{
|
||||||
|
// todo: broadcast join message
|
||||||
|
|
||||||
|
m_invites.erase( m_invites.find( recipientId ), m_invites.end() );
|
||||||
|
GroupMember member;
|
||||||
|
member.inviterId = senderId;
|
||||||
|
member.role = 0;
|
||||||
|
member.pPlayer = pRecipient;
|
||||||
|
m_members.emplace( recipientId, member );
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Group::Group::sendPacketToMembers( Core::Network::Packets::GamePacketPtr pPacket, bool invitesToo )
|
||||||
|
{
|
||||||
|
assert( pPacket );
|
||||||
|
if( pPacket )
|
||||||
|
{
|
||||||
|
for( const auto& member : m_members )
|
||||||
|
{
|
||||||
|
if( member.second.pPlayer )
|
||||||
|
{
|
||||||
|
member.second.pPlayer->queuePacket( pPacket );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Group::Group::reload()
|
||||||
|
{
|
||||||
|
m_reloadGroup = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Core::Entity::Group::Group::canReload() const
|
||||||
|
{
|
||||||
|
return m_reloadGroup;
|
||||||
|
}
|
74
src/servers/Server_Zone/Actor/Group/Group.h
Normal file
74
src/servers/Server_Zone/Actor/Group/Group.h
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#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 {
|
||||||
|
|
||||||
|
struct GroupMember
|
||||||
|
{
|
||||||
|
uint64_t inviterId;
|
||||||
|
PlayerPtr pPlayer;
|
||||||
|
uint32_t role;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class GroupType : uint8_t
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Party,
|
||||||
|
Friends,
|
||||||
|
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>
|
||||||
|
bool m_reloadGroup;
|
||||||
|
|
||||||
|
void addMember( uint64_t senderId = 0, uint64_t recipientId = 0 );
|
||||||
|
void inviteMember( uint64_t senderId, uint64_t recipientId = 0 );
|
||||||
|
void removeMember( uint64_t id = 0 );
|
||||||
|
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(){};
|
||||||
|
|
||||||
|
virtual void load() = 0;
|
||||||
|
virtual void update() = 0;
|
||||||
|
virtual void disband() = 0;
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
bool canReload() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif // ! _GROUP_H
|
0
src/servers/Server_Zone/Actor/Group/Linkshell.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Linkshell.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Linkshell.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Linkshell.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/GroupMgr.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/GroupMgr.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/GroupMgr.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/GroupMgr.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/PartyMgr.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/PartyMgr.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/PartyMgr.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Manager/PartyMgr.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Party.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Party.cpp
Normal file
0
src/servers/Server_Zone/Actor/Group/Party.h
Normal file
0
src/servers/Server_Zone/Actor/Group/Party.h
Normal file
|
@ -7,6 +7,8 @@ project(Sapphire_Zone)
|
||||||
file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
/*.h
|
/*.h
|
||||||
Actor/*.h
|
Actor/*.h
|
||||||
|
Actor/Group/*.h
|
||||||
|
Actor/Group/Manager/*.h
|
||||||
Action/*.h
|
Action/*.h
|
||||||
DebugCommand/*.h
|
DebugCommand/*.h
|
||||||
Event/*.h
|
Event/*.h
|
||||||
|
@ -22,6 +24,8 @@ file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
*.c*
|
*.c*
|
||||||
Actor/*.c*
|
Actor/*.c*
|
||||||
|
Actor/Group/*.c*
|
||||||
|
Actor/Group/Manager/*.c*
|
||||||
Action/*.c*
|
Action/*.c*
|
||||||
DebugCommand/*.c*
|
DebugCommand/*.c*
|
||||||
Event/*.c*
|
Event/*.c*
|
||||||
|
|
|
@ -51,6 +51,7 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
|
||||||
setZoneHandler( ClientZoneIpcType::PlayTimeHandler, "PlayTimeHandler", &GameConnection::playTimeHandler );
|
setZoneHandler( ClientZoneIpcType::PlayTimeHandler, "PlayTimeHandler", &GameConnection::playTimeHandler );
|
||||||
setZoneHandler( ClientZoneIpcType::LogoutHandler, "LogoutHandler", &GameConnection::logoutHandler );
|
setZoneHandler( ClientZoneIpcType::LogoutHandler, "LogoutHandler", &GameConnection::logoutHandler );
|
||||||
|
|
||||||
|
setZoneHandler( ClientZoneIpcType::SocialReqSendHandler, "SocialReqSendHandler", &GameConnection::socialReqSendHandler );
|
||||||
setZoneHandler( ClientZoneIpcType::SocialListHandler, "SocialListHandler", &GameConnection::socialListHandler );
|
setZoneHandler( ClientZoneIpcType::SocialListHandler, "SocialListHandler", &GameConnection::socialListHandler );
|
||||||
setZoneHandler( ClientZoneIpcType::SetSearchInfoHandler, "SetSearchInfoHandler", &GameConnection::setSearchInfoHandler );
|
setZoneHandler( ClientZoneIpcType::SetSearchInfoHandler, "SetSearchInfoHandler", &GameConnection::setSearchInfoHandler );
|
||||||
setZoneHandler( ClientZoneIpcType::ReqSearchInfoHandler, "ReqSearchInfoHandler", &GameConnection::reqSearchInfoHandler );
|
setZoneHandler( ClientZoneIpcType::ReqSearchInfoHandler, "ReqSearchInfoHandler", &GameConnection::reqSearchInfoHandler );
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
DECLARE_HANDLER( initHandler );
|
DECLARE_HANDLER( initHandler );
|
||||||
DECLARE_HANDLER( finishLoadingHandler );
|
DECLARE_HANDLER( finishLoadingHandler );
|
||||||
DECLARE_HANDLER( blackListHandler );
|
DECLARE_HANDLER( blackListHandler );
|
||||||
|
DECLARE_HANDLER( socialReqSendHandler );
|
||||||
DECLARE_HANDLER( socialListHandler );
|
DECLARE_HANDLER( socialListHandler );
|
||||||
DECLARE_HANDLER( linkshellListHandler );
|
DECLARE_HANDLER( linkshellListHandler );
|
||||||
DECLARE_HANDLER( playTimeHandler );
|
DECLARE_HANDLER( playTimeHandler );
|
||||||
|
@ -119,7 +120,6 @@ public:
|
||||||
DECLARE_HANDLER( reqEquipDisplayFlagsHandler );
|
DECLARE_HANDLER( reqEquipDisplayFlagsHandler );
|
||||||
|
|
||||||
DECLARE_HANDLER( tellHandler );
|
DECLARE_HANDLER( tellHandler );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -452,16 +452,15 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
||||||
listPacket.data().entries[0].contentId = pPlayer->getContentId();
|
listPacket.data().entries[0].contentId = pPlayer->getContentId();
|
||||||
listPacket.data().entries[0].level = pPlayer->getLevel();
|
listPacket.data().entries[0].level = pPlayer->getLevel();
|
||||||
listPacket.data().entries[0].zoneId = pPlayer->getCurrentZone()->getId();
|
listPacket.data().entries[0].zoneId = pPlayer->getCurrentZone()->getId();
|
||||||
listPacket.data().entries[0].zoneId1 = 0x0100;
|
listPacket.data().entries[0].grandCompany = pPlayer->getGc();
|
||||||
|
memcpy( &listPacket.data().entries[0].fcTag[0], "Sapphire", sizeof( "Sapphire" ) );
|
||||||
|
listPacket.data().entries[0].clientLanguage = 2;
|
||||||
|
listPacket.data().entries[0].knownLanguages = 0x0F;
|
||||||
// TODO: no idea what this does
|
// TODO: no idea what this does
|
||||||
//listPacket.data().entries[0].one = 1;
|
//listPacket.data().entries[0].one = 1;
|
||||||
|
|
||||||
memcpy( listPacket.data().entries[0].name, pPlayer->getName().c_str(), strlen( pPlayer->getName().c_str() ) );
|
memcpy( listPacket.data().entries[0].name, pPlayer->getName().c_str(), strlen( pPlayer->getName().c_str() ) );
|
||||||
|
|
||||||
// TODO: actually store and read language from somewhere
|
|
||||||
listPacket.data().entries[0].bytes1[0] = 0x01;//flags (lang)
|
|
||||||
// TODO: these flags need to be figured out
|
|
||||||
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags
|
|
||||||
listPacket.data().entries[0].onlineStatusMask = pPlayer->getOnlineStatusMask();
|
listPacket.data().entries[0].onlineStatusMask = pPlayer->getOnlineStatusMask();
|
||||||
|
|
||||||
queueOutPacket( listPacket );
|
queueOutPacket( listPacket );
|
||||||
|
|
Loading…
Add table
Reference in a new issue