2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
|
|
|
#include <Network/CommonNetwork.h>
|
2019-03-08 15:34:38 +01:00
|
|
|
#include <Network/GamePacket.h>
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Logging/Logger.h>
|
2021-11-27 00:53:57 +01:00
|
|
|
#include <Exd/ExdData.h>
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Network/PacketContainer.h>
|
2018-06-23 21:38:04 +02:00
|
|
|
#include <Network/CommonActorControl.h>
|
2018-07-06 22:43:49 +10:00
|
|
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
2017-08-17 16:19:20 +02:00
|
|
|
|
2019-07-21 22:33:33 +10:00
|
|
|
#include "Territory/Territory.h"
|
2018-12-01 00:27:16 +11:00
|
|
|
#include "Manager/HousingMgr.h"
|
2017-12-08 15:38:25 +01:00
|
|
|
|
2018-03-02 07:22:25 -03:00
|
|
|
#include "Network/GameConnection.h"
|
2018-09-13 11:08:24 +01:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
#include "Network/PacketWrappers/InspectPacket.h"
|
2019-10-09 18:14:53 +02:00
|
|
|
#include "Network/PacketWrappers/ActorControlPacket.h"
|
2021-11-27 00:53:57 +01:00
|
|
|
#include "Network/PacketWrappers/ActorControlTargetPacket.h"
|
2018-03-02 07:22:25 -03:00
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
#include "Action/Action.h"
|
2017-08-17 16:19:20 +02:00
|
|
|
|
2018-09-10 14:34:24 +01:00
|
|
|
|
2018-03-02 07:22:25 -03:00
|
|
|
#include "Session.h"
|
2021-11-27 00:53:57 +01:00
|
|
|
#include "WorldServer.h"
|
2018-03-02 07:22:25 -03:00
|
|
|
#include "Forwards.h"
|
2020-02-29 22:30:10 +11:00
|
|
|
#include <Service.h>
|
2022-01-10 23:50:44 +01:00
|
|
|
#include <Manager/TerritoryMgr.h>
|
2018-03-02 07:22:25 -03:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire::Common;
|
|
|
|
using namespace Sapphire::Network::Packets;
|
2021-11-27 00:53:57 +01:00
|
|
|
using namespace Sapphire::Network::Packets::WorldPackets::Server;
|
|
|
|
using namespace Sapphire::Network::Packets::WorldPackets::Client;
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire::Network::ActorControl;
|
2018-12-01 00:27:16 +11:00
|
|
|
using namespace Sapphire::World::Manager;
|
2017-08-17 16:19:20 +02:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
void examineHandler( Sapphire::Entity::Player& player, uint32_t targetId )
|
2018-09-10 15:01:13 +01:00
|
|
|
{
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire;
|
2018-09-10 15:01:13 +01:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& server = Service< World::WorldServer >::ref();
|
|
|
|
auto pSession = server.getSession( targetId );
|
2018-09-10 15:01:13 +01:00
|
|
|
if( pSession )
|
|
|
|
{
|
2018-09-13 11:08:24 +01:00
|
|
|
auto pTarget = pSession->getPlayer();
|
|
|
|
if( pTarget )
|
2018-09-10 15:01:13 +01:00
|
|
|
{
|
2018-09-25 01:11:14 +10:00
|
|
|
if( pTarget->isActingAsGm() || pTarget->getZoneId() != player.getZoneId() )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
server.queueForPlayer( player.getCharacterId(), makeActorControl( player.getId(), ActorControlType::ExamineError ) );
|
2018-09-25 01:11:14 +10:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
server.queueForPlayer( player.getCharacterId(), std::make_shared< InspectPacket >( player, pTarget ) );
|
2018-09-25 01:11:14 +10:00
|
|
|
}
|
2018-09-10 15:01:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-10 23:50:44 +01:00
|
|
|
void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
2017-08-17 16:19:20 +02:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
const auto packet = ZoneChannelPacket< FFXIVIpcClientTrigger >( inPacket );
|
|
|
|
auto& server = Service< World::WorldServer >::ref();
|
2022-01-10 23:50:44 +01:00
|
|
|
auto& teriMgr = Service< World::Manager::TerritoryMgr >::ref();
|
|
|
|
auto pZone = teriMgr.getTerritoryByGuId( player.getTerritoryId() );
|
2021-11-27 00:53:57 +01:00
|
|
|
|
|
|
|
const auto commandId = packet.data().Id;
|
|
|
|
const auto param1 = *reinterpret_cast< const uint64_t* >( &packet.data().Arg0 );
|
|
|
|
const auto param11 = packet.data().Arg0;
|
|
|
|
const auto param12 = packet.data().Arg1;
|
|
|
|
const auto param2 = packet.data().Arg2;
|
|
|
|
const auto param4 = packet.data().Arg3;
|
|
|
|
const auto param3 = packet.data().Target;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
Logger::debug( "[{0}] Incoming Packet Command: {1:X} ( p1:{2:X} p2:{3:X} p3:{4:X} )",
|
2019-01-04 22:48:09 +11:00
|
|
|
m_pSession->getId(), commandId, param1, param2, param3 );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-01-13 13:19:15 +01:00
|
|
|
//Logger::Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString());
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
switch( commandId )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::DRAWN_SWORD: // Toggle sheathe
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
if( param11 == 1 )
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStance( Stance::Active );
|
2018-08-29 21:40:59 +02:00
|
|
|
else
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStance( Stance::Passive );
|
2018-08-29 21:40:59 +02:00
|
|
|
player.setAutoattack( false );
|
|
|
|
}
|
|
|
|
|
2019-10-09 18:42:25 +02:00
|
|
|
player.sendToInRangeSet( makeActorControl( player.getId(), 0, param11, 1 ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::AUTO_ATTACK: // Toggle auto-attack
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
if( param11 == 1 )
|
|
|
|
{
|
|
|
|
player.setAutoattack( true );
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStance( Stance::Active );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
player.setAutoattack( false );
|
|
|
|
|
2019-10-09 18:42:25 +02:00
|
|
|
player.sendToInRangeSet( makeActorControl( player.getId(), 1, param11, 1 ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::TARGET_DECIDE: // Change target
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
uint64_t targetId = param1;
|
|
|
|
player.changeTarget( targetId );
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::CANCEL_MOUNT:
|
2019-02-02 23:06:57 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setMount( 0 );
|
2019-02-02 23:06:57 +11:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::COMPANION:
|
2020-05-07 23:57:16 +09:00
|
|
|
{
|
2021-12-12 23:26:12 +01:00
|
|
|
player.setCompanion( static_cast< uint16_t >( param1 ) );
|
2020-05-07 23:57:16 +09:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::REQUEST_STATUS_RESET: // Remove status (clicking it off)
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
// todo: check if status can be removed by client from exd
|
|
|
|
player.removeSingleStatusEffectById( static_cast< uint32_t >( param1 ) );
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::CANCEL_CAST:
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
if( player.getCurrentAction() )
|
2021-11-27 00:53:57 +01:00
|
|
|
player.getCurrentAction()->setInterrupted( ActionInterruptType::RegularInterrupt );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::INSPECT:
|
2018-09-10 14:34:24 +01:00
|
|
|
{
|
|
|
|
uint32_t targetId = param11;
|
2020-03-01 01:00:57 +11:00
|
|
|
examineHandler( player, targetId );
|
2018-09-10 15:01:13 +01:00
|
|
|
break;
|
2018-09-10 14:34:24 +01:00
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::MARKING: // Mark player
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::ACTIVE_TITLE: // Set player title
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
player.setTitle( static_cast< uint16_t >( param1 ) );
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::TITLE_LIST: // Get title list
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
player.sendTitleList();
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::SET_HOWTO: // Update howtos seen
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
uint32_t howToId = param11;
|
|
|
|
player.updateHowtosSeen( howToId );
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::SET_CUTSCENE:
|
2018-09-11 17:46:04 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
server.queueForPlayer( player.getCharacterId(), makeActorControl( player.getId(), ActorControlType::SetCutsceneFlag, param11, 1 ) );
|
|
|
|
break;
|
2018-09-11 17:46:04 +01:00
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::EMOTE: // emote
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
uint64_t targetId = player.getTargetId();
|
|
|
|
uint32_t emoteId = param11;
|
|
|
|
bool isSilent = param2 == 1;
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& exdData = Service< Data::ExdData >::ref();
|
|
|
|
auto emoteData = exdData.getRow< Component::Excel::Emote >( emoteId );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
if( !emoteData )
|
|
|
|
return;
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
player.sendToInRangeSet( makeActorControlTarget( player.getId(), ActorControlType::Emote, emoteId, 0, isSilent ? 1 : 0, 0, targetId ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
bool isPersistent = emoteData->data().Mode != 0;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
if( isPersistent )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStance( Stance::Passive );
|
2018-08-29 21:40:59 +02:00
|
|
|
player.setAutoattack( false );
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setPersistentEmote( emoteData->data().Mode );
|
|
|
|
player.setStatus( ActorStatus::EmoteMode );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-10-09 18:42:25 +02:00
|
|
|
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::SetStatus,
|
2021-11-27 00:53:57 +01:00
|
|
|
static_cast< uint8_t >( ActorStatus::EmoteMode ),
|
|
|
|
emoteData->data().IsEndEmoteMode ? 1 : 0 ), true );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
if( emoteData->data().IsAvailableWhenDrawn )
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStance( Stance::Active );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::EMOTE_CANCEL: // emote
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
player.sendToInRangeSet( makeActorControl( player.getId(), ActorControlType::EmoteInterrupt ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
/* case PacketCommand::PersistentEmoteCancel: // cancel persistent emote
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
player.setPersistentEmote( 0 );
|
|
|
|
player.emoteInterrupt();
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setStatus( ActorStatus::Idle );
|
|
|
|
auto pSetStatusPacket = makeActorControl( player.getId(), SetStatus, static_cast< uint8_t >( ActorStatus::Idle ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
player.sendToInRangeSet( pSetStatusPacket );
|
|
|
|
break;
|
2021-11-27 00:53:57 +01:00
|
|
|
}*/
|
|
|
|
case PacketCommand::POSE_EMOTE_CONFIG: // change pose
|
|
|
|
case PacketCommand::POSE_EMOTE_WORK: // reapply pose
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2019-12-26 11:09:15 +03:00
|
|
|
player.setPose( static_cast< uint8_t >( param12 ) );
|
2019-10-09 18:42:25 +02:00
|
|
|
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
|
2018-08-29 21:40:59 +02:00
|
|
|
player.sendToInRangeSet( pSetStatusPacket, true );
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::POSE_EMOTE_CANCEL: // cancel pose
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2019-12-26 11:09:15 +03:00
|
|
|
player.setPose( static_cast< uint8_t >( param12 ) );
|
2019-10-09 18:42:25 +02:00
|
|
|
auto pSetStatusPacket = makeActorControl( player.getId(), SetPose, param11, param12 );
|
2021-11-27 00:53:57 +01:00
|
|
|
player.sendToInRangeSet( pSetStatusPacket, true );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::REVIVE: // return dead / accept raise
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
switch( static_cast < ResurrectType >( param1 ) )
|
|
|
|
{
|
|
|
|
case ResurrectType::RaiseSpell:
|
|
|
|
// todo: handle raise case (set position to raiser, apply weakness status, set hp/mp/tp as well as packet)
|
|
|
|
player.returnToHomepoint();
|
2018-03-15 03:13:20 +11:00
|
|
|
break;
|
2018-08-29 21:40:59 +02:00
|
|
|
case ResurrectType::Return:
|
|
|
|
player.returnToHomepoint();
|
2018-03-15 03:13:20 +11:00
|
|
|
break;
|
2018-08-29 21:40:59 +02:00
|
|
|
default:
|
2018-03-15 03:31:46 +11:00
|
|
|
break;
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::FINISH_LOADING: // Finish zoning
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
player.finishZoning();
|
2021-11-27 00:53:57 +01:00
|
|
|
player.setLoadingComplete( true );
|
2021-12-05 21:16:36 +01:00
|
|
|
if( player.isLogin() )
|
|
|
|
player.setIsLogin( false );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::TELEPO_INQUIRY: // Teleport
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
|
2019-12-26 11:09:15 +03:00
|
|
|
player.teleportQuery( static_cast< uint16_t >( param11 ) );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
/* case PacketCommand::DyeItem: // Dye item
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2019-02-10 19:50:28 +11:00
|
|
|
// param11 = item to dye container
|
|
|
|
// param12 = item to dye slot
|
|
|
|
// param2 = dye bag container
|
|
|
|
// param4 = dye bag slot
|
2020-03-16 01:35:49 -07:00
|
|
|
player.setDyeingInfo( param11, param12, param2, param4 );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
2021-11-27 00:53:57 +01:00
|
|
|
}*/
|
|
|
|
case PacketCommand::DIRECTOR_INIT_RETURN: // Director init finish
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2022-01-10 23:50:44 +01:00
|
|
|
pZone->onInitDirector( player );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::SYNC_DIRECTOR: // Director init finish
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2022-01-10 23:50:44 +01:00
|
|
|
pZone->onDirectorSync( player );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
/* case PacketCommand::EnterTerritoryEventFinished:// this may still be something else. I think i have seen it elsewhere
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
player.setOnEnterEventDone( true );
|
|
|
|
break;
|
2021-11-27 00:53:57 +01:00
|
|
|
}*/
|
|
|
|
case PacketCommand::EVENT_HANDLER:
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
2022-01-10 23:50:44 +01:00
|
|
|
pZone->onEventHandlerOrder( player, param11, param12, param2, param3, param4 );
|
2021-11-27 00:53:57 +01:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::CANCEL_QUEST:
|
2018-08-31 22:57:33 +10:00
|
|
|
{
|
|
|
|
player.removeQuest( static_cast< uint16_t >( param1 ) );
|
2018-08-31 23:02:45 +10:00
|
|
|
break;
|
2018-08-31 22:57:33 +10:00
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_LOCK_LAND_BY_BUILD:
|
2018-11-12 08:32:30 +01:00
|
|
|
{
|
2022-01-10 23:50:44 +01:00
|
|
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
2018-11-12 08:32:30 +01:00
|
|
|
if (!hZone)
|
|
|
|
return;
|
|
|
|
|
2019-12-26 11:09:15 +03:00
|
|
|
player.setActiveLand( static_cast< uint8_t >( param11 ), hZone->getWardNum() );
|
2018-11-12 08:32:30 +01:00
|
|
|
|
2019-10-09 18:42:25 +02:00
|
|
|
auto pShowBuildPresetUIPacket = makeActorControl( player.getId(), ShowBuildPresetUI, param11 );
|
2021-11-27 00:53:57 +01:00
|
|
|
server.queueForPlayer( player.getCharacterId(), pShowBuildPresetUIPacket );
|
2018-11-12 08:32:30 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_AUCTION_INFO:
|
2018-11-04 23:47:10 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-05 16:55:14 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12 );
|
|
|
|
housingMgr.sendLandSignFree( player, ident );
|
2018-12-05 16:55:14 +11:00
|
|
|
|
2018-11-04 23:47:10 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_GET_PROFILE:
|
2018-11-11 14:27:39 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-05 16:55:14 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12, false );
|
|
|
|
housingMgr.sendLandSignOwned( player, ident );
|
2018-12-05 16:55:14 +11:00
|
|
|
|
2018-11-11 14:27:39 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_GET_PROFILE_LIST:
|
2018-11-20 22:52:57 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-11-20 22:52:57 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.sendWardLandInfo( player, static_cast< uint8_t >( param12 ), static_cast< uint8_t >( param11 ) );
|
2018-11-20 22:52:57 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_RELEASE:
|
2018-11-15 22:30:59 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2022-01-10 23:50:44 +01:00
|
|
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( pZone );
|
|
|
|
if (!hZone)
|
|
|
|
return;
|
2020-03-01 01:00:57 +11:00
|
|
|
|
2018-11-15 22:30:59 +01:00
|
|
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
2022-01-10 23:50:44 +01:00
|
|
|
housingMgr.relinquishLand( player, *hZone, plot );
|
2018-11-16 17:07:22 +01:00
|
|
|
|
2018-11-15 22:30:59 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_HOUSE_NAME:
|
2018-11-11 14:27:39 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-11-11 14:27:39 +01:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12 );
|
|
|
|
housingMgr.requestEstateRename( player, ident );
|
2018-11-11 14:27:39 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_EDIT_WELCOME:
|
2018-11-28 00:36:45 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-11-28 00:36:45 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12 );
|
|
|
|
housingMgr.requestEstateEditGreeting( player, ident );
|
2018-11-28 00:36:45 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
/* case PacketCommand::RequestEstateEditGuestAccessSettings:
|
2018-11-29 00:19:37 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-11-29 00:19:37 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12 );
|
|
|
|
housingMgr.requestEstateEditGuestAccess( player, ident );
|
2018-11-29 00:19:37 +11:00
|
|
|
|
|
|
|
break;
|
2021-11-27 00:53:57 +01:00
|
|
|
}*/
|
|
|
|
case PacketCommand::HOUSING_LAYOUTMODE:
|
2018-11-07 09:05:03 +01:00
|
|
|
{
|
2018-12-02 19:44:38 +11:00
|
|
|
// close ui
|
|
|
|
if( param11 == 1 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
// param12 is 0 when inside a house
|
|
|
|
|
|
|
|
uint8_t ward = ( param12 >> 16 ) & 0xFF;
|
2018-11-11 14:27:39 +01:00
|
|
|
uint8_t plot = ( param12 & 0xFF );
|
2019-10-09 18:42:25 +02:00
|
|
|
auto pShowHousingItemUIPacket = makeActorControl( player.getId(), ShowHousingItemUI, 0, plot );
|
2018-11-07 09:05:03 +01:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
server.queueForPlayer( player.getCharacterId(), pShowHousingItemUIPacket );
|
2018-11-07 09:27:57 +01:00
|
|
|
|
2018-11-07 09:05:03 +01:00
|
|
|
//TODO: show item housing container
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::HOUSING_WELCOME:
|
2018-12-04 22:20:41 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-04 22:20:41 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto ident = housingMgr.clientTriggerParamsToLandIdent( param11, param12 );
|
|
|
|
housingMgr.sendEstateGreeting( player, ident );
|
2018-12-04 22:20:41 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
/* case PacketCommand::RequestLandInventory:
|
2018-12-05 19:58:43 +11:00
|
|
|
{
|
|
|
|
uint8_t plot = ( param12 & 0xFF );
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-05 19:58:43 +11:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
uint16_t inventoryType = InventoryType::HousingExteriorPlacedItems;
|
2018-12-20 21:52:18 +11:00
|
|
|
if( param2 == 1 )
|
2021-11-27 00:53:57 +01:00
|
|
|
inventoryType = InventoryType::HousingExteriorStoreroom;
|
2018-12-20 21:52:18 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.sendEstateInventory( player, inventoryType, plot );
|
2018-12-05 19:58:43 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::RequestEstateInventory:
|
2018-12-05 19:58:43 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-05 19:58:43 +11:00
|
|
|
|
2018-12-27 01:09:33 +11:00
|
|
|
// param1 = 1 - storeroom
|
|
|
|
// param1 = 0 - placed items
|
2018-12-27 00:36:47 +11:00
|
|
|
|
2018-12-27 01:09:33 +11:00
|
|
|
if( param1 == 1 )
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.sendInternalEstateInventoryBatch( player, true );
|
2018-12-27 01:09:33 +11:00
|
|
|
else
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.sendInternalEstateInventoryBatch( player );
|
2018-12-05 19:58:43 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::RequestHousingItemRemove:
|
2018-12-28 02:17:29 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-28 02:17:29 +11:00
|
|
|
|
2018-12-28 11:49:12 +11:00
|
|
|
auto slot = param4 & 0xFF;
|
|
|
|
auto sendToStoreroom = ( param4 >> 16 ) != 0;
|
2018-12-28 02:17:29 +11:00
|
|
|
|
2018-12-28 20:10:07 +11:00
|
|
|
//player, plot, containerId, slot, sendToStoreroom
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.reqRemoveHousingItem( player, static_cast< uint16_t >( param12 ), static_cast< uint16_t >( param2 ), static_cast< uint8_t >( slot ), sendToStoreroom );
|
2018-12-28 02:17:29 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::RequestEstateExteriorRemodel:
|
2018-12-28 18:45:08 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-28 18:45:08 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.reqEstateExteriorRemodel( player, static_cast< uint16_t >( param11 ) );
|
2018-12-28 18:45:08 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::RequestEstateInteriorRemodel:
|
2018-12-28 18:45:08 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& housingMgr = Service< HousingMgr >::ref();
|
2018-12-28 18:45:08 +11:00
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
housingMgr.reqEstateInteriorRemodel( player );
|
2018-12-28 18:45:08 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::UpdateEstateGuestAccess:
|
2018-12-29 19:20:47 +11:00
|
|
|
{
|
|
|
|
auto canTeleport = ( param2 & 0xFF ) == 1;
|
|
|
|
auto unk1 = ( param2 >> 8 & 0xFF ) == 1; // todo: related to fc? or unused?
|
|
|
|
auto privateEstateAccess = ( param2 >> 16 & 0xFF ) == 1;
|
|
|
|
auto unk = ( param2 >> 24 & 0xFF ) == 1; // todo: related to fc? or unused?
|
|
|
|
|
2019-01-05 12:32:10 +01:00
|
|
|
player.sendDebug( "can teleport: {0}, unk: {1}, privateEstateAccess: {2}, unk: {3}",
|
|
|
|
canTeleport, unk1, privateEstateAccess, unk );
|
2018-12-29 19:20:47 +11:00
|
|
|
break;
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
case PacketCommand::RequestEventBattle:
|
2020-01-03 22:47:01 +09:00
|
|
|
{
|
|
|
|
auto packet = makeActorControlSelf( player.getId(), ActorControl::EventBattleDialog, 0, param12, param2 );
|
|
|
|
player.queuePacket( packet );
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
player.sendDebug( "event battle level sync: {0}, ilevel sync?: {1}", param12, param2 );
|
2021-02-25 21:28:58 +09:00
|
|
|
break;
|
2021-11-27 00:53:57 +01:00
|
|
|
}*/
|
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
default:
|
|
|
|
{
|
2019-01-04 22:48:09 +11:00
|
|
|
Logger::debug( "[{0}] Unhandled action: {1:04X}", m_pSession->getId(), commandId );
|
2018-08-29 21:40:59 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-08-17 16:19:20 +02:00
|
|
|
}
|