mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
move more housing logic from client trigger handler to housingmgr
This commit is contained in:
parent
4e4097c1c8
commit
a802d98cee
3 changed files with 57 additions and 47 deletions
|
@ -10,10 +10,7 @@
|
||||||
|
|
||||||
#include "Zone/Zone.h"
|
#include "Zone/Zone.h"
|
||||||
#include "Zone/ZonePosition.h"
|
#include "Zone/ZonePosition.h"
|
||||||
#include "Zone/HousingZone.h"
|
|
||||||
#include "Zone/HousingMgr.h"
|
#include "Zone/HousingMgr.h"
|
||||||
#include "Zone/Land.h"
|
|
||||||
#include "Zone/House.h"
|
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
|
|
||||||
|
@ -375,27 +372,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
if( !pHousingMgr )
|
if( !pHousingMgr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto landSetId = pHousingMgr->toLandSetId( territoryTypeId, ward );
|
pHousingMgr->requestEstateRename( player, territoryTypeId, worldId, ward, plot );
|
||||||
auto hZone = pHousingMgr->getHousingZoneByLandSetId( landSetId );
|
|
||||||
|
|
||||||
if( !hZone )
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto land = hZone->getLand( plot );
|
|
||||||
|
|
||||||
auto house = land->getHouse();
|
|
||||||
if( !house )
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto landRenamePacket = makeZonePacket< Server::FFXIVIpcLandRename >( player.getId() );
|
|
||||||
|
|
||||||
landRenamePacket->data().landIdent.landId = land->getLandId();
|
|
||||||
landRenamePacket->data().landIdent.wardNum = land->getWardNum();
|
|
||||||
landRenamePacket->data().landIdent.worldId = 67;
|
|
||||||
landRenamePacket->data().landIdent.territoryTypeId = land->getTerritoryTypeId();
|
|
||||||
memcpy( &landRenamePacket->data().houseName, house->getHouseName().c_str(), 20 );
|
|
||||||
|
|
||||||
player.queuePacket( landRenamePacket );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -411,29 +388,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
if( !pHousingMgr )
|
if( !pHousingMgr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto landSetId = pHousingMgr->toLandSetId( territoryTypeId, ward );
|
pHousingMgr->requestEstateEditGreeting( player, territoryTypeId, worldId, ward, plot );
|
||||||
auto hZone = pHousingMgr->getHousingZoneByLandSetId( landSetId );
|
|
||||||
|
|
||||||
if( !hZone )
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto land = hZone->getLand( plot );
|
|
||||||
if( !land )
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto house = land->getHouse();
|
|
||||||
if( !house )
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto estateGreetingPacket = makeZonePacket< Server::FFXIVIpcHousingEstateGreeting >( player.getId() );
|
|
||||||
|
|
||||||
estateGreetingPacket->data().landIdent.landId = land->getLandId();
|
|
||||||
estateGreetingPacket->data().landIdent.wardNum = land->getWardNum();
|
|
||||||
estateGreetingPacket->data().landIdent.worldId = 67;
|
|
||||||
estateGreetingPacket->data().landIdent.territoryTypeId = land->getTerritoryTypeId();
|
|
||||||
memcpy( &estateGreetingPacket->data().message, house->getHouseGreeting().c_str(), sizeof( estateGreetingPacket->data().message ) );
|
|
||||||
|
|
||||||
player.queuePacket( estateGreetingPacket );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,3 +322,55 @@ void Core::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNu
|
||||||
player.setLandFlags( LandStateSlot::Private, ESTATE_BUILT, pLand->getLandId(), pLand->getWardNum(), pLand->getTerritoryTypeId() );
|
player.setLandFlags( LandStateSlot::Private, ESTATE_BUILT, pLand->getLandId(), pLand->getWardNum(), pLand->getTerritoryTypeId() );
|
||||||
player.sendLandFlagsSlot( LandStateSlot::Private );
|
player.sendLandFlagsSlot( LandStateSlot::Private );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::HousingMgr::requestEstateRename( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId )
|
||||||
|
{
|
||||||
|
auto landSetId = toLandSetId( territoryTypeId, wardId );
|
||||||
|
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
||||||
|
if( !hZone )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto land = hZone->getLand( plotId );
|
||||||
|
|
||||||
|
auto house = land->getHouse();
|
||||||
|
if( !house )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto landRenamePacket = makeZonePacket< Server::FFXIVIpcLandRename >( player.getId() );
|
||||||
|
|
||||||
|
landRenamePacket->data().landIdent.landId = land->getLandId();
|
||||||
|
landRenamePacket->data().landIdent.wardNum = land->getWardNum();
|
||||||
|
landRenamePacket->data().landIdent.worldId = 67;
|
||||||
|
landRenamePacket->data().landIdent.territoryTypeId = land->getTerritoryTypeId();
|
||||||
|
memcpy( &landRenamePacket->data().houseName, house->getHouseName().c_str(), 20 );
|
||||||
|
|
||||||
|
player.queuePacket( landRenamePacket );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::HousingMgr::requestEstateEditGreeting( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId )
|
||||||
|
{
|
||||||
|
auto landSetId = toLandSetId( territoryTypeId, wardId );
|
||||||
|
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
||||||
|
if( !hZone )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto land = hZone->getLand( plotId );
|
||||||
|
if( !land )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto house = land->getHouse();
|
||||||
|
if( !house )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto estateGreetingPacket = makeZonePacket< Server::FFXIVIpcHousingEstateGreeting >( player.getId() );
|
||||||
|
|
||||||
|
estateGreetingPacket->data().landIdent.landId = land->getLandId();
|
||||||
|
estateGreetingPacket->data().landIdent.wardNum = land->getWardNum();
|
||||||
|
estateGreetingPacket->data().landIdent.worldId = 67;
|
||||||
|
estateGreetingPacket->data().landIdent.territoryTypeId = land->getTerritoryTypeId();
|
||||||
|
memcpy( &estateGreetingPacket->data().message, house->getHouseGreeting().c_str(), sizeof( estateGreetingPacket->data().message ) );
|
||||||
|
|
||||||
|
player.queuePacket( estateGreetingPacket );
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ namespace Core
|
||||||
|
|
||||||
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem );
|
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem );
|
||||||
|
|
||||||
|
void requestEstateRename( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId );
|
||||||
|
void requestEstateEditGreeting( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue