mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
housing edit interior
This commit is contained in:
parent
37fabec6f5
commit
b014b9265d
7 changed files with 62 additions and 24 deletions
|
@ -194,7 +194,7 @@ namespace Sapphire::Network::Packets
|
|||
EventPlay128 = 0x026E, // updated 5.58
|
||||
EventPlay255 = 0x039E, // updated 5.58
|
||||
|
||||
EventYield = 0x02CB, // updated 5.55 hotfix
|
||||
EventYield = 0x0123, // updated 5.58
|
||||
//EventYield4 = 0x0000,
|
||||
//EventYield8 = 0x0000,
|
||||
//EventYield16 = 0x0000,
|
||||
|
@ -216,7 +216,7 @@ namespace Sapphire::Network::Packets
|
|||
MSQTrackerComplete = 0x01C1, // updated 5.58
|
||||
MSQTrackerProgress = 0xF1CD, // updated 4.5 ? this actually looks like the two opcodes have been combined, see #474
|
||||
|
||||
QuestMessage = 0x036E, // updated 5.55 hotfix
|
||||
QuestMessage = 0x0128, // updated 5.58
|
||||
|
||||
QuestTracker = 0x038E, // updated 5.58
|
||||
|
||||
|
@ -243,7 +243,7 @@ namespace Sapphire::Network::Packets
|
|||
EquipDisplayFlags = 0x0199, // updated 5.58
|
||||
|
||||
MiniCactpotInit = 0x0286, // added 5.31
|
||||
ShopMessage = 0x0162, // updated 5.55 hotfix
|
||||
ShopMessage = 0x00D0, // updated 5.58
|
||||
LootMessage = 0x038C, // updated 5.58
|
||||
ResultDialog = 0x00DF, // updated 5.58
|
||||
DesynthResult = 0x038F, // updated 5.58
|
||||
|
@ -395,7 +395,7 @@ namespace Sapphire::Network::Packets
|
|||
OutOfRangeEventHandler = 0x0294, // updated 5.58
|
||||
EnterTeriEventHandler = 0x00C1, // updated 5.58
|
||||
ShopEventHandler = 0x02B8, // updated 5.58
|
||||
EventYieldHandler = 0x02A0, // updated 5.55 hotfix
|
||||
EventYieldHandler = 0x03A2, // updated 5.58
|
||||
ReturnEventHandler = 0x0333, // updated 5.58
|
||||
TradeReturnEventHandler = 0x0179, // updated 5.58
|
||||
TradeReturnEventHandler2 = 0x0169, // updated 5.55 hotfix
|
||||
|
@ -408,7 +408,8 @@ namespace Sapphire::Network::Packets
|
|||
LandRenameHandler = 0x0083, // updated 5.58
|
||||
HousingUpdateHouseGreeting = 0x031A, // updated 5.58
|
||||
HousingUpdateObjectPosition = 0x010E, // updated 5.58
|
||||
HousingEditAppearance = 0x00D7, // updated 5.55 hotfix
|
||||
HousingEditExterior = 0x0324, // updated 5.58
|
||||
HousingEditInterior = 0x02F7, // updated 5.58
|
||||
|
||||
SetSharedEstateSettings = 0x0342, // updated 5.58
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@ struct FFXIVIpcDive :
|
|||
};
|
||||
|
||||
struct FFXIVIpcHousingEditExterior :
|
||||
FFXIVIpcBasePacket< HousingEditAppearance >
|
||||
FFXIVIpcBasePacket< HousingEditExterior >
|
||||
{
|
||||
uint16_t landId;
|
||||
uint8_t unknown[6];
|
||||
|
@ -438,6 +438,14 @@ struct FFXIVIpcHousingEditExterior :
|
|||
uint16_t padding;
|
||||
};
|
||||
|
||||
struct FFXIVIpcHousingEditInterior :
|
||||
FFXIVIpcBasePacket< HousingEditInterior >
|
||||
{
|
||||
uint64_t unknown;
|
||||
uint16_t container[10];
|
||||
uint16_t slot[10];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //_CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
||||
|
|
|
@ -1632,24 +1632,23 @@ Sapphire::Inventory::HousingItemPtr Sapphire::World::Manager::HousingMgr::getHou
|
|||
return Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId() );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList, uint8_t removeFlag )
|
||||
void Sapphire::World::Manager::HousingMgr::editAppearance( bool isInterior, Sapphire::Entity::Player& player, const Common::LandIdent& landIdent, std::vector< uint16_t > containerList, std::vector< uint8_t> slotList, uint8_t removeFlag )
|
||||
{
|
||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
return;
|
||||
auto landSetId = toLandSetId( static_cast< uint16_t >( landIdent.territoryTypeId ), static_cast< uint8_t >( landIdent.wardNum ) );
|
||||
auto terri = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
auto land = terri->getLand( static_cast< uint8_t >( plot ) );
|
||||
auto land = terri->getLand( static_cast< uint8_t >( landIdent.landId ) );
|
||||
if( !land )
|
||||
return;
|
||||
|
||||
if( !hasPermission( player, *land, 0 ) )
|
||||
return;
|
||||
|
||||
auto& exteriorAppearenceContainer = getEstateInventory( land->getLandIdent() )[ InventoryType::HousingExteriorAppearance ];
|
||||
auto& housingContainer = getEstateInventory( landIdent )[ isInterior ? InventoryType::HousingInteriorAppearance : InventoryType::HousingExteriorAppearance ];
|
||||
|
||||
auto& invMgr = Service< InventoryMgr >::ref();
|
||||
|
||||
for( int i = 0; i < 9; i++ )
|
||||
for( int i = 0; i < ( isInterior ? 10 : 9 ); i++ )
|
||||
{
|
||||
auto container = containerList.at( i );
|
||||
auto slot = slotList.at( i );
|
||||
|
@ -1660,11 +1659,11 @@ void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Playe
|
|||
auto removed = ( ( removeFlag >> ( i - 5 ) ) & 1 ) > 0;
|
||||
if( removed )
|
||||
{
|
||||
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
||||
auto oldItem = housingContainer->getItem( i );
|
||||
if( oldItem )
|
||||
{
|
||||
exteriorAppearenceContainer->removeItem( i );
|
||||
invMgr.removeItemFromHousingContainer( land->getLandIdent(), exteriorAppearenceContainer->getId(), i );
|
||||
housingContainer->removeItem( i );
|
||||
invMgr.removeItemFromHousingContainer( land->getLandIdent(), housingContainer->getId(), i );
|
||||
player.addItem( oldItem, false, false, false );
|
||||
}
|
||||
}
|
||||
|
@ -1674,16 +1673,19 @@ void Sapphire::World::Manager::HousingMgr::editExterior( Sapphire::Entity::Playe
|
|||
auto item = getHousingItemFromPlayer( player, static_cast< Sapphire::Common::InventoryType >( container ), slot );
|
||||
if( item )
|
||||
{
|
||||
auto oldItem = exteriorAppearenceContainer->getItem( i );
|
||||
exteriorAppearenceContainer->setItem( i, item );
|
||||
auto oldItem = housingContainer->getItem( i );
|
||||
housingContainer->setItem( i, item );
|
||||
if( oldItem )
|
||||
{
|
||||
player.insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( container ), slot, oldItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
invMgr.sendInventoryContainer( player, exteriorAppearenceContainer );
|
||||
invMgr.saveHousingContainer( land->getLandIdent(), exteriorAppearenceContainer );
|
||||
invMgr.sendInventoryContainer( player, housingContainer );
|
||||
invMgr.saveHousingContainer( land->getLandIdent(), housingContainer );
|
||||
updateHouseModels( land->getHouse() );
|
||||
std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() )->sendLandUpdate( plot );
|
||||
if( !isInterior )
|
||||
{
|
||||
terri->sendLandUpdate( landIdent.landId );
|
||||
}
|
||||
}
|
|
@ -181,7 +181,7 @@ namespace Sapphire::World::Manager
|
|||
|
||||
bool hasPermission( Entity::Player& player, Land& land, uint32_t permission );
|
||||
|
||||
void editExterior( Sapphire::Entity::Player& player, uint16_t plot, std::vector< uint16_t > containerList, std::vector< uint8_t > slotList, uint8_t removeFlag );
|
||||
void editAppearance( bool isInterior, Sapphire::Entity::Player& player, const Common::LandIdent& landIdent, std::vector< uint16_t > containerList, std::vector< uint8_t > slotList, uint8_t removeFlag );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -90,7 +90,8 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
|||
setZoneHandler( ClientZoneIpcType::ReqPlaceHousingItem, "ReqPlaceHousingItem", &GameConnection::reqPlaceHousingItem );
|
||||
setZoneHandler( ClientZoneIpcType::HousingUpdateObjectPosition, "HousingUpdateObjectPosition",
|
||||
&GameConnection::reqMoveHousingItem );
|
||||
setZoneHandler( ClientZoneIpcType::HousingEditAppearance, "HousingEditAppearance", &GameConnection::housingEditExterior );
|
||||
setZoneHandler( ClientZoneIpcType::HousingEditExterior, "HousingEditExterior", &GameConnection::housingEditExterior );
|
||||
setZoneHandler( ClientZoneIpcType::HousingEditInterior, "HousingEditInterior", &GameConnection::housingEditInterior );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::TalkEventHandler, "EventHandlerTalk", &GameConnection::eventHandlerTalk );
|
||||
setZoneHandler( ClientZoneIpcType::EmoteEventHandler, "EventHandlerEmote", &GameConnection::eventHandlerEmote );
|
||||
|
|
|
@ -183,6 +183,8 @@ namespace Sapphire::Network
|
|||
|
||||
DECLARE_HANDLER( housingEditExterior );
|
||||
|
||||
DECLARE_HANDLER( housingEditInterior );
|
||||
|
||||
DECLARE_HANDLER( marketBoardSearch );
|
||||
|
||||
DECLARE_HANDLER( marketBoardRequestItemInfo );
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "Territory/Territory.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||
#include "Territory/Land.h"
|
||||
#include "Territory/ZonePosition.h"
|
||||
#include "Territory/House.h"
|
||||
|
@ -695,6 +696,9 @@ void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXI
|
|||
{
|
||||
auto& housingMgr = Common::Service< HousingMgr >::ref();
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingEditExterior >( inPacket );
|
||||
auto terri = std::dynamic_pointer_cast< HousingZone >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
return;
|
||||
|
||||
std::vector< uint16_t > containerList;
|
||||
std::vector< uint8_t > slotList;
|
||||
|
@ -705,7 +709,27 @@ void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXI
|
|||
slotList.push_back( container != 0x270F ? static_cast< uint8_t >( packet.data().slot[i] ) : 0xFF );
|
||||
}
|
||||
|
||||
housingMgr.editExterior( player, packet.data().landId, containerList, slotList, packet.data().removeFlag );
|
||||
housingMgr.editAppearance( false, player, terri->getLand( packet.data().landId )->getLandIdent(), containerList, slotList, packet.data().removeFlag );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::housingEditInterior( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
|
||||
{
|
||||
auto& housingMgr = Common::Service< HousingMgr >::ref();
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingEditInterior >( inPacket );
|
||||
auto terri = std::dynamic_pointer_cast< World::Territory::Housing::HousingInteriorTerritory >( player.getCurrentTerritory() );
|
||||
if( !terri )
|
||||
return;
|
||||
|
||||
std::vector< uint16_t > containerList;
|
||||
std::vector< uint8_t > slotList;
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
auto container = packet.data().container[i];
|
||||
containerList.push_back( container );
|
||||
slotList.push_back( container != 0x270F ? static_cast< uint8_t >( packet.data().slot[i] ) : 0xFF );
|
||||
}
|
||||
|
||||
housingMgr.editAppearance( true, player, terri->getLandIdent(), containerList, slotList, 0 );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::marketBoardSearch( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
|
|
Loading…
Add table
Reference in a new issue