mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
rename trigger (working) + build preset (starting)
This commit is contained in:
parent
8c5fbbedad
commit
1808e16585
9 changed files with 89 additions and 1 deletions
|
@ -214,6 +214,8 @@ enum ActorControlType :
|
|||
|
||||
// Housing
|
||||
ShowHousingItemUI = 0x3F7,
|
||||
ShowBuildPresetUI = 0x3E9,
|
||||
BuildPresetResponse = 0x3ED,
|
||||
|
||||
// PvP Duel
|
||||
SetPvPState = 0x5E0, // param3 must be 6 to engage a duel (hardcoded in the client)
|
||||
|
@ -289,6 +291,7 @@ enum ClientTriggerType
|
|||
AchievementCritReq = 0x3E8,
|
||||
AchievementList = 0x3E9,
|
||||
|
||||
RequestHousingBuildPreset = 0x44C,
|
||||
RequestHousingSign = 0x451,
|
||||
RequestHousingInfoSign = 0x452,
|
||||
RequestHousingRename = 0x45A,
|
||||
|
|
|
@ -277,6 +277,7 @@ namespace Core::Network::Packets
|
|||
|
||||
InventoryModifyHandler = 0x0142, // updated 4.4
|
||||
|
||||
BuildPresetHandler = 0x014A, // updated 4.4
|
||||
TalkEventHandler = 0x014B, // updated 4.4
|
||||
EmoteEventHandler = 0x014C, // updated 4.4
|
||||
WithinRangeEventHandler = 0x014D, // updated 4.4
|
||||
|
|
|
@ -200,6 +200,13 @@ struct FFXIVIpcRenameLandHandler :
|
|||
/* 0028 */ uint32_t padding;
|
||||
};
|
||||
|
||||
struct FFXIVIpcBuildPresetHandler :
|
||||
FFXIVIpcBasePacket< BuildPresetHandler >
|
||||
{
|
||||
/* 0000 */ uint32_t itemId;
|
||||
/* 0004 */ uint8_t plotNum;
|
||||
/* 0005 */ char landSetString[27];
|
||||
};
|
||||
|
||||
struct FFXIVIpcSetSharedEstateSettings :
|
||||
FFXIVIpcBasePacket< SetSharedEstateSettings >
|
||||
|
|
|
@ -83,6 +83,8 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
|
|||
setZoneHandler( ClientZoneIpcType::InventoryModifyHandler, "InventoryModifyHandler",
|
||||
&GameConnection::inventoryModifyHandler );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::BuildPresetHandler, "BuildPresetHandler", &GameConnection::eventHandlerTalk );
|
||||
setZoneHandler( ClientZoneIpcType::RenameLandHandler, "RenameLandHandler", &GameConnection::renameLandHandler );
|
||||
setZoneHandler( ClientZoneIpcType::TalkEventHandler, "EventHandlerTalk", &GameConnection::eventHandlerTalk );
|
||||
setZoneHandler( ClientZoneIpcType::EmoteEventHandler, "EventHandlerEmote", &GameConnection::eventHandlerEmote );
|
||||
setZoneHandler( ClientZoneIpcType::WithinRangeEventHandler, "EventHandlerWithinRange",
|
||||
|
|
|
@ -164,6 +164,8 @@ namespace Core::Network
|
|||
|
||||
DECLARE_HANDLER( renameLandHandler );
|
||||
|
||||
DECLARE_HANDLER( buildPresetHandler );
|
||||
|
||||
DECLARE_HANDLER( tellHandler );
|
||||
|
||||
};
|
||||
|
|
|
@ -310,6 +310,23 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
player.removeQuest( static_cast< uint16_t >( param1 ) );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestHousingBuildPreset:
|
||||
{
|
||||
auto pShowBuildPresetUIPacket = makeActorControl142( player.getId(), ShowBuildPresetUI, param11 );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
|
||||
if (!hZone)
|
||||
return;
|
||||
|
||||
player.setActiveLand( param11, hZone->getWardNum() );
|
||||
|
||||
player.queuePacket( pShowBuildPresetUIPacket );
|
||||
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestHousingSign:
|
||||
{
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#include "Zone/TerritoryMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Zone/HousingZone.h"
|
||||
#include "Zone/HousingMgr.h"
|
||||
#include "Zone/Land.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
|
@ -654,4 +657,55 @@ void Core::Network::GameConnection::renameLandHandler( const Core::Network::Pack
|
|||
{
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcRenameLandHandler >( inPacket );
|
||||
|
||||
uint32_t landSetId = ( static_cast< uint32_t >( packet.data().zoneId ) << 16 ) | packet.data().wardNum;
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( packet.data().landId );
|
||||
|
||||
if( !pLand )
|
||||
return;
|
||||
|
||||
pLand->setLandName( packet.data().landName );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::buildPresetHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
Entity::Player& player )
|
||||
{
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcBuildPresetHandler >( inPacket );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
auto plotNum = packet.data().plotNum;
|
||||
auto preset = packet.data().itemId;
|
||||
std::string landString = std::string( packet.data().stateString );
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto pLand = hZone->getLand( plotNum );
|
||||
/*
|
||||
if (!pLand)
|
||||
player.sendDebug( "Something went wrong..." );
|
||||
|
||||
if( stateString.find( "Private" ) )
|
||||
{
|
||||
pLand->setPreset( preset );
|
||||
pLand->setState( HouseState::privateHouse );
|
||||
pLand->UpdateLandDb();
|
||||
hZone->sendLandUpdate( plotNum );
|
||||
}
|
||||
else if( stateString.find("Free") )
|
||||
{
|
||||
pLand->setPreset( preset );
|
||||
pLand->setState( HouseState::fcHouse );
|
||||
pLand->UpdateLandDb();
|
||||
hZone->sendLandUpdate( plotNum );
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendDebug( "You tried to build a preset on not supported land." );
|
||||
}
|
||||
|
||||
auto pSuccessBuildingPacket = makeActorControl142( player.getId(), BuildPresetResponse, plotNum );
|
||||
|
||||
player.queuePacket( pSuccessBuildingPacket );*/
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ void Core::Land::load()
|
|||
m_currentPrice = m_landInfo->prices[ m_landId ];
|
||||
m_minPrice = m_landInfo->minPrices[ m_landId ];
|
||||
m_land.houseSize = m_landInfo->sizes[ m_landId ];
|
||||
m_land.houseState = HouseState::forSale;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ void Core::Land::setSharing( uint8_t state )
|
|||
|
||||
void Core::Land::setLandName( const std::string& name )
|
||||
{
|
||||
memcpy( &m_landName, &name, 20 );
|
||||
memcpy( &m_landName, name.c_str(), 20 );
|
||||
}
|
||||
|
||||
uint8_t Core::Land::getHouseSize()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LAND_H_
|
||||
#define LAND_H_
|
||||
#include <Common.h>
|
||||
#include "Exd/ExdDataGenerated.h"
|
||||
#include "ForwardsZone.h"
|
||||
|
||||
namespace Core
|
||||
|
|
Loading…
Add table
Reference in a new issue