mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 08:07:46 +00:00
refactor landpermission -> landstate
This commit is contained in:
parent
2a5ee25a12
commit
ccc31353e6
9 changed files with 47 additions and 29 deletions
|
@ -758,7 +758,7 @@ namespace Core::Common
|
||||||
SubTag2
|
SubTag2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LandPermissionSlot
|
enum LandStateSlot
|
||||||
{
|
{
|
||||||
FreeCompany,
|
FreeCompany,
|
||||||
Private,
|
Private,
|
||||||
|
@ -782,7 +782,7 @@ namespace Core::Common
|
||||||
int16_t worldId; //06
|
int16_t worldId; //06
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LandPermissionSet
|
struct LandStateSet
|
||||||
{
|
{
|
||||||
LandIdent landIdent;
|
LandIdent landIdent;
|
||||||
uint32_t permissionMask; //08
|
uint32_t permissionMask; //08
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace Core::Network::Packets
|
||||||
|
|
||||||
HousingEstateGreeting = 0x0227, // updated 4.4
|
HousingEstateGreeting = 0x0227, // updated 4.4
|
||||||
|
|
||||||
LandPermissionSlot = 0x0228, // updated 4.4
|
LandStateSlot = 0x0228, // updated 4.4
|
||||||
LandPermission = 0x0229, // updated 4.4
|
LandPermission = 0x0229, // updated 4.4
|
||||||
|
|
||||||
LandSetYardInitialize = 0x022C, // updated 4.4
|
LandSetYardInitialize = 0x022C, // updated 4.4
|
||||||
|
|
|
@ -1575,24 +1575,24 @@ struct FFXIVIpcPerformNote : FFXIVIpcBasePacket< PerformNote >
|
||||||
uint8_t data[32];
|
uint8_t data[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcLandPermissionSlot : FFXIVIpcBasePacket< LandPermissionSlot >
|
struct FFXIVIpcLandStateSlot : FFXIVIpcBasePacket< LandStateSlot >
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t unknown;
|
uint32_t unknown;
|
||||||
Common::LandPermissionSet permissionSet;
|
Common::LandStateSet permissionSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcLandPermission : FFXIVIpcBasePacket< LandPermission >
|
struct FFXIVIpcLandPermission : FFXIVIpcBasePacket< LandPermission >
|
||||||
{
|
{
|
||||||
Common::LandPermissionSet freeCompanyHouse; // 00
|
Common::LandStateSet freeCompanyHouse; // 00
|
||||||
uint64_t unkown1;
|
uint64_t unkown1;
|
||||||
Common::LandPermissionSet privateHouse; // 24
|
Common::LandStateSet privateHouse; // 24
|
||||||
uint64_t unkown2;
|
uint64_t unkown2;
|
||||||
Common::LandPermissionSet apartment; // 48
|
Common::LandStateSet apartment; // 48
|
||||||
uint64_t unkown3;
|
uint64_t unkown3;
|
||||||
Common::LandPermissionSet sharedHouse[2]; //72
|
Common::LandStateSet sharedHouse[2]; //72
|
||||||
uint64_t unkown4;
|
uint64_t unkown4;
|
||||||
Common::LandPermissionSet unkownHouse;
|
Common::LandStateSet unkownHouse;
|
||||||
uint64_t unkown5;
|
uint64_t unkown5;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1587,7 +1587,7 @@ void Core::Entity::Player::sendZonePackets()
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
if( Core::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
if( Core::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
||||||
{
|
{
|
||||||
setLandPermissions( LandPermissionSlot::Private, 0x00, pLand->getLandId(), pLand->getWardNum(), pLand->getTerritoryTypeId() );
|
setLandState( LandStateSlot::Private, 0x00, pLand->getLandId(), pLand->getWardNum(), pLand->getTerritoryTypeId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
sendLandPermissions();
|
sendLandPermissions();
|
||||||
|
@ -1768,7 +1768,7 @@ bool Core::Entity::Player::isOnEnterEventDone() const
|
||||||
return m_onEnterEventDone;
|
return m_onEnterEventDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setLandPermissions( uint8_t permissionSet, uint32_t permissionMask,
|
void Core::Entity::Player::setLandState( uint8_t permissionSet, uint32_t permissionMask,
|
||||||
int16_t landId, int16_t wardNum, int16_t zoneId )
|
int16_t landId, int16_t wardNum, int16_t zoneId )
|
||||||
{
|
{
|
||||||
m_landPermission[ permissionSet ].landIdent.landId = landId;
|
m_landPermission[ permissionSet ].landIdent.landId = landId;
|
||||||
|
@ -1783,11 +1783,11 @@ void Core::Entity::Player::sendLandPermissions()
|
||||||
{
|
{
|
||||||
auto landPermissions = makeZonePacket< FFXIVIpcLandPermission >( getId() );
|
auto landPermissions = makeZonePacket< FFXIVIpcLandPermission >( getId() );
|
||||||
|
|
||||||
landPermissions->data().freeCompanyHouse = m_landPermission[Common::LandPermissionSlot::FreeCompany];
|
landPermissions->data().freeCompanyHouse = m_landPermission[Common::LandStateSlot::FreeCompany];
|
||||||
landPermissions->data().privateHouse = m_landPermission[Common::LandPermissionSlot::Private];
|
landPermissions->data().privateHouse = m_landPermission[Common::LandStateSlot::Private];
|
||||||
landPermissions->data().apartment = m_landPermission[Common::LandPermissionSlot::Apartment];
|
landPermissions->data().apartment = m_landPermission[Common::LandStateSlot::Apartment];
|
||||||
landPermissions->data().sharedHouse[0] = m_landPermission[Common::LandPermissionSlot::SharedHouse1];
|
landPermissions->data().sharedHouse[0] = m_landPermission[Common::LandStateSlot::SharedHouse1];
|
||||||
landPermissions->data().sharedHouse[1] = m_landPermission[Common::LandPermissionSlot::SharedHouse2];
|
landPermissions->data().sharedHouse[1] = m_landPermission[Common::LandStateSlot::SharedHouse2];
|
||||||
memset( &landPermissions->data().unkownHouse, 0xFF, 8 );
|
memset( &landPermissions->data().unkownHouse, 0xFF, 8 );
|
||||||
memset( &landPermissions->data().unkownHouse.permissionMask, 0, 8 );
|
memset( &landPermissions->data().unkownHouse.permissionMask, 0, 8 );
|
||||||
landPermissions->data().unkownHouse.permissionMask = 2;
|
landPermissions->data().unkownHouse.permissionMask = 2;
|
||||||
|
@ -1800,9 +1800,9 @@ void Core::Entity::Player::sendLandPermissions()
|
||||||
queuePacket( landPermissions );
|
queuePacket( landPermissions );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendLandPermissionSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId )
|
void Core::Entity::Player::sendLandStateSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId )
|
||||||
{
|
{
|
||||||
auto landPermissions = makeZonePacket< FFXIVIpcLandPermissionSlot >( getId() );
|
auto landPermissions = makeZonePacket< FFXIVIpcLandStateSlot >( getId() );
|
||||||
landPermissions->data().type = slotId;
|
landPermissions->data().type = slotId;
|
||||||
|
|
||||||
landPermissions->data().permissionSet.landIdent.landId = landId;
|
landPermissions->data().permissionSet.landIdent.landId = landId;
|
||||||
|
|
|
@ -763,10 +763,10 @@ namespace Core::Entity
|
||||||
|
|
||||||
// Housing Handling
|
// Housing Handling
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void setLandPermissions( uint8_t permissionSet, uint32_t permissionMask, int16_t landId, int16_t wardNum, int16_t zoneId );
|
void setLandState( uint8_t permissionSet, uint32_t permissionMask, int16_t landId, int16_t wardNum, int16_t zoneId );
|
||||||
|
|
||||||
void sendLandPermissions();
|
void sendLandPermissions();
|
||||||
void sendLandPermissionSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId );
|
void sendLandStateSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId );
|
||||||
|
|
||||||
// Player Battle Handling
|
// Player Battle Handling
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1025,7 +1025,7 @@ namespace Core::Entity
|
||||||
uint8_t m_searchSelectClass; // class selected to show up in profile
|
uint8_t m_searchSelectClass; // class selected to show up in profile
|
||||||
|
|
||||||
// housing info
|
// housing info
|
||||||
Common::LandPermissionSet m_landPermission[5];
|
Common::LandStateSet m_landPermission[5];
|
||||||
|
|
||||||
Common::ActiveLand m_activeLand;
|
Common::ActiveLand m_activeLand;
|
||||||
|
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ void Core::DebugCommandHandler::housing( char* data, Entity::Player& player, std
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone );
|
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pZone );
|
||||||
if( pHousing )
|
if( pHousing )
|
||||||
{
|
{
|
||||||
player.setLandPermissions( permissionSet, 0, pHousing->getLandSetId(), pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
player.setLandState( permissionSet, 0, pHousing->getLandSetId(), pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
||||||
player.sendLandPermissions();
|
player.sendLandPermissions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,6 +35,9 @@ Core::House::House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_
|
||||||
stmt->setUInt( 2, m_houseId );
|
stmt->setUInt( 2, m_houseId );
|
||||||
|
|
||||||
pDB->execute( stmt );
|
pDB->execute( stmt );
|
||||||
|
|
||||||
|
// todo: make this nicer/configurable?
|
||||||
|
m_houseName = "Estate #" + std::to_string( landId + 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -45,11 +48,10 @@ Core::House::House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_
|
||||||
auto housePartColours = res->getBlobVector( "HousePartColours" );
|
auto housePartColours = res->getBlobVector( "HousePartColours" );
|
||||||
|
|
||||||
auto models = reinterpret_cast< uint32_t* >( &housePartModels[ 0 ] );
|
auto models = reinterpret_cast< uint32_t* >( &housePartModels[ 0 ] );
|
||||||
auto colours = &housePartColours[ 0 ];
|
|
||||||
|
|
||||||
for( auto i = 0; i < 8; i++ )
|
for( auto i = 0; i < 8; i++ )
|
||||||
{
|
{
|
||||||
m_houseParts[ i ] = { models[ i ], colours[ i ] };
|
m_houseParts[ i ] = { models[ i ], housePartColours[ i ] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,3 +146,13 @@ Core::House::HousePartsArray const& Core::House::getHouseParts() const
|
||||||
{
|
{
|
||||||
return m_houseParts;
|
return m_houseParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& Core::House::getHouseName() const
|
||||||
|
{
|
||||||
|
return m_houseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& Core::House::getHouseGreeting() const
|
||||||
|
{
|
||||||
|
return m_estateMessage;
|
||||||
|
}
|
|
@ -25,6 +25,12 @@ namespace Core
|
||||||
uint16_t getTerritoryTypeId() const;
|
uint16_t getTerritoryTypeId() const;
|
||||||
uint32_t getHouseId() const;
|
uint32_t getHouseId() const;
|
||||||
|
|
||||||
|
const std::string& getHouseName() const;
|
||||||
|
void setHouseName( std::string& name );
|
||||||
|
|
||||||
|
const std::string& getHouseGreeting() const;
|
||||||
|
void setHouseGreeting( std::string& greeting );
|
||||||
|
|
||||||
//functions
|
//functions
|
||||||
void setHousePart( Common::HousePartSlot slot, uint32_t id );
|
void setHousePart( Common::HousePartSlot slot, uint32_t id );
|
||||||
void setHousePartColor( Common::HousePartSlot slot, uint32_t id );
|
void setHousePartColor( Common::HousePartSlot slot, uint32_t id );
|
||||||
|
|
|
@ -157,10 +157,10 @@ Core::LandPurchaseResult Core::HousingMgr::purchaseLand( Entity::Player& player,
|
||||||
pLand->setState( HouseState::sold );
|
pLand->setState( HouseState::sold );
|
||||||
pLand->setLandType( Common::LandType::Private );
|
pLand->setLandType( Common::LandType::Private );
|
||||||
|
|
||||||
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
|
player.setLandState( LandStateSlot::Private, 0x00, plot,
|
||||||
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
||||||
|
|
||||||
player.sendLandPermissionSlot( static_cast< uint8_t >( LandType::Private ), plot, pHousing->getWardNum(),
|
player.sendLandStateSlot( static_cast< uint8_t >( LandType::Private ), plot, pHousing->getWardNum(),
|
||||||
pHousing->getTerritoryTypeId() );
|
pHousing->getTerritoryTypeId() );
|
||||||
|
|
||||||
//pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
//pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
||||||
|
@ -210,9 +210,9 @@ bool Core::HousingMgr::relinquishLand( Entity::Player& player, uint8_t plot )
|
||||||
pLand->setLandType( Common::LandType::none );
|
pLand->setLandType( Common::LandType::none );
|
||||||
pLand->updateLandDb();
|
pLand->updateLandDb();
|
||||||
|
|
||||||
player.setLandPermissions( LandPermissionSlot::Private, 0x00, 0xFF, 0xFF, 0xFF );
|
player.setLandState( LandStateSlot::Private, 0x00, 0xFF, 0xFF, 0xFF );
|
||||||
|
|
||||||
player.sendLandPermissionSlot( static_cast< uint8_t >( LandType::Private ), 0xFF, 0xFF, 0xFF );
|
player.sendLandStateSlot( static_cast< uint8_t >( LandType::Private ), 0xFF, 0xFF, 0xFF );
|
||||||
|
|
||||||
auto screenMsgPkt2 = makeActorControl143( player.getId(), ActorControl::LogMsg, 3351, 0x1AA,
|
auto screenMsgPkt2 = makeActorControl143( player.getId(), ActorControl::LogMsg, 3351, 0x1AA,
|
||||||
pLand->getWardNum() + 1, plot + 1 );
|
pLand->getWardNum() + 1, plot + 1 );
|
||||||
|
|
Loading…
Add table
Reference in a new issue