mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
spawn housing objects on zone in
This commit is contained in:
parent
e0aa6550ae
commit
fab6a27354
5 changed files with 35 additions and 9 deletions
|
@ -27,6 +27,7 @@ Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, bool isHq ) :
|
|||
m_category = static_cast< Common::ItemUICategory >( itemInfo->itemUICategory );
|
||||
m_itemLevel = itemInfo->levelItem;
|
||||
m_maxStackSize = itemInfo->stackSize;
|
||||
m_additionalData = itemInfo->additionalData;
|
||||
}
|
||||
|
||||
float Sapphire::Item::getAutoAttackDmg() const
|
||||
|
@ -154,3 +155,8 @@ void Sapphire::Item::setStain( uint16_t stain )
|
|||
{
|
||||
m_stain = stain;
|
||||
}
|
||||
|
||||
uint32_t Sapphire::Item::getAdditionalData() const
|
||||
{
|
||||
return m_additionalData;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace Sapphire
|
|||
uint16_t getStain() const;
|
||||
void setStain( uint16_t stain );
|
||||
|
||||
uint32_t getAdditionalData() const;
|
||||
|
||||
|
||||
protected:
|
||||
uint32_t m_id;
|
||||
|
@ -88,6 +90,8 @@ namespace Sapphire
|
|||
uint16_t m_durability;
|
||||
uint16_t m_stain;
|
||||
|
||||
uint32_t m_additionalData;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -669,7 +669,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
|||
player.setLandFlags( LandFlagsSlot::Private, EstateBuilt, ident );
|
||||
player.sendLandFlagsSlot( LandFlagsSlot::Private );
|
||||
|
||||
hZone->registerHouseEntranceEObj( plotNum );
|
||||
hZone->registerEstateEntranceEObj( plotNum );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )
|
||||
|
|
|
@ -94,7 +94,7 @@ bool Sapphire::HousingZone::init()
|
|||
m_landPtrMap[ entry.m_landId ] = land;
|
||||
|
||||
if( entry.m_houseId > 0 )
|
||||
registerHouseEntranceEObj( entry.m_landId );
|
||||
registerEstateEntranceEObj( entry.m_landId );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -109,6 +109,8 @@ void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
|||
"HousingZone::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
||||
", Entity#" + std::to_string( player.getId() ) );
|
||||
|
||||
auto isInSubdivision = isPlayerSubInstance( player ) ? true : false;
|
||||
|
||||
uint32_t yardPacketNum;
|
||||
uint32_t yardPacketTotal = 8;
|
||||
|
||||
|
@ -122,14 +124,21 @@ void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
|||
housingObjectInit->data().packetNum = yardPacketNum;
|
||||
housingObjectInit->data().packetTotal = yardPacketTotal;
|
||||
|
||||
//TODO: Add Objects here
|
||||
auto yardObjectSize = sizeof( Common::YardObject );
|
||||
|
||||
auto& objects = m_yardObjects[ isInSubdivision ? 1 : 0 ];
|
||||
|
||||
memcpy( &housingObjectInit->data().object, objects.data() + ( yardObjectSize * yardPacketNum ),
|
||||
yardObjectSize * 100 );
|
||||
|
||||
player.queuePacket( housingObjectInit );
|
||||
}
|
||||
|
||||
auto landSetMap = makeZonePacket< FFXIVIpcLandSetMap >( player.getId() );
|
||||
landSetMap->data().subdivision = !isPlayerSubInstance( player ) ? 2 : 1;
|
||||
uint8_t startIndex = !isPlayerSubInstance( player ) ? 0 : 30;
|
||||
landSetMap->data().subdivision = isInSubdivision ? 1 : 2;
|
||||
|
||||
uint8_t startIndex = isInSubdivision ? 30 : 0;
|
||||
|
||||
for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); i++, count++ )
|
||||
{
|
||||
landSetMap->data().landInfo[ count ].status = 1;
|
||||
|
@ -252,13 +261,13 @@ Sapphire::LandPtr Sapphire::HousingZone::getLand( uint8_t id )
|
|||
return it->second;
|
||||
}
|
||||
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerHouseEntranceEObj( uint8_t plotId )
|
||||
Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerEstateEntranceEObj( uint8_t landId )
|
||||
{
|
||||
auto land = getLand( plotId );
|
||||
auto land = getLand( landId );
|
||||
assert( land );
|
||||
|
||||
auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 4, land->getMapMarkerPosition(), 0.f, "entrance" );
|
||||
eObj->setHousingLink( plotId << 8 );
|
||||
eObj->setHousingLink( landId << 8 );
|
||||
eObj->setScale( 1.f );
|
||||
|
||||
registerEObj( eObj );
|
||||
|
|
|
@ -50,15 +50,22 @@ namespace Sapphire
|
|||
uint32_t getLandSetId() const;
|
||||
Sapphire::LandPtr getLand( uint8_t id );
|
||||
|
||||
Entity::EventObjectPtr registerHouseEntranceEObj( uint8_t plotId );
|
||||
Entity::EventObjectPtr registerEstateEntranceEObj( uint8_t landId );
|
||||
|
||||
private:
|
||||
using LandPtrMap = std::unordered_map< uint8_t, Sapphire::LandPtr >;
|
||||
using YardObjectArray = std::array< Common::YardObject, 800 >;
|
||||
using YardObjectMap = std::map< uint8_t, YardObjectArray >;
|
||||
|
||||
using YardObjectArrayBoundsPair = std::pair< uint16_t, uint16_t >;
|
||||
|
||||
const uint32_t m_landSetMax = 18;
|
||||
LandPtrMap m_landPtrMap;
|
||||
uint8_t m_wardNum;
|
||||
uint32_t m_landSetId;
|
||||
uint32_t m_territoryTypeId;
|
||||
|
||||
YardObjectMap m_yardObjects;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue