1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00
sapphire/src/servers/sapphire_zone/Network/Handlers/CFHandlers.cpp

80 lines
2.9 KiB
C++
Raw Normal View History

#include <common/Common.h>
#include <common/Network/CommonNetwork.h>
#include <common/Network/GamePacketNew.h>
#include <common/Logging/Logger.h>
#include <common/Network/PacketContainer.h>
#include "Network/GameConnection.h"
#include "Session.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
#include "Network/PacketWrappers/ActorControlPacket142.h"
#include "Network/PacketWrappers/ActorControlPacket143.h"
#include "Network/PacketWrappers/ActorControlPacket144.h"
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
#include "Actor/Player.h"
#include "Forwards.h"
2017-08-17 00:07:42 +02:00
extern Core::Logger g_log;
using namespace Core::Common;
using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::GamePacket& inPacket,
Entity::Player& player )
2017-08-17 00:07:42 +02:00
{
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( player.getId() );
2017-08-17 00:07:42 +02:00
auto penaltyMinutes = player.getCFPenaltyMinutes();
if (penaltyMinutes > 255)
{
// cap it since it's uint8_t in packets
penaltyMinutes = 255;
}
dutyInfoPacket.data().penaltyTime = penaltyMinutes;
queueOutPacket( dutyInfoPacket );
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( player.getId() );
queueOutPacket( inNeedsPacket );
2017-08-17 00:07:42 +02:00
}
void Core::Network::GameConnection::cfRegisterDuty( const Packets::GamePacket& inPacket,
Entity::Player& player)
2017-08-17 00:07:42 +02:00
{
// TODO use for loop for this
auto contentId1 = inPacket.getValAt< uint16_t >( 46 );
auto contentId2 = inPacket.getValAt< uint16_t >( 48 );
auto contentId3 = inPacket.getValAt< uint16_t >( 50 );
auto contentId4 = inPacket.getValAt< uint16_t >( 52 );
auto contentId5 = inPacket.getValAt< uint16_t >( 54 );
player.sendDebug("Duty register request");
player.sendDebug("ContentId1" + std::to_string(contentId1));
player.sendDebug("ContentId2" + std::to_string(contentId2));
player.sendDebug("ContentId3" + std::to_string(contentId3));
player.sendDebug("ContentId4" + std::to_string(contentId4));
player.sendDebug("ContentId5" + std::to_string(contentId5));
// let's cancel it because otherwise you can't register it again
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
cfCancelPacket.data().state1 = 3;
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
queueOutPacket( cfCancelPacket );
2017-08-17 00:07:42 +02:00
}
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::GamePacket& inPacket,
Entity::Player& player)
2017-08-17 00:07:42 +02:00
{
player.sendDebug("Roulette register");
2017-08-17 00:07:42 +02:00
}
void Core::Network::GameConnection::cfDutyAccepted( const Packets::GamePacket& inPacket,
Entity::Player& player)
2017-08-17 00:07:42 +02:00
{
player.sendDebug("TODO: Duty accept");
2017-08-17 00:07:42 +02:00
}