mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Start of land interaction
This commit is contained in:
parent
93794ed4fe
commit
d1750ebb69
7 changed files with 60 additions and 20 deletions
|
@ -26,6 +26,12 @@ namespace Core::Common
|
|||
float z;
|
||||
};
|
||||
|
||||
struct ActiveLand
|
||||
{
|
||||
uint8_t ward;
|
||||
uint8_t plot;
|
||||
};
|
||||
|
||||
enum InventoryOperation : uint8_t
|
||||
{
|
||||
Discard = 0x07,
|
||||
|
@ -770,7 +776,7 @@ namespace Core::Common
|
|||
|
||||
struct LandPermissionSet
|
||||
{
|
||||
int16_t landSetId; //00
|
||||
int16_t landId; //00
|
||||
int16_t wardNum; //02
|
||||
int16_t zoneId; //04
|
||||
int16_t worldId; //06
|
||||
|
|
|
@ -1,20 +1,34 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Zone/Zone.h>
|
||||
#include <Zone/HousingZone.h>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class CmnDefHousingSignboard :
|
||||
public EventScript
|
||||
class CmnDefHousingSignboard : public EventScript
|
||||
{
|
||||
public:
|
||||
CmnDefHousingSignboard() :
|
||||
EventScript( 721031 )
|
||||
CmnDefHousingSignboard() : EventScript( 721031 )
|
||||
{
|
||||
}
|
||||
|
||||
void Scene00000( Entity::Player& player )
|
||||
{
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0 );
|
||||
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// Purchase Land
|
||||
if( result.param2 == 2 )
|
||||
{
|
||||
auto activeLand = player.getActiveLand();
|
||||
auto territoryId = player.getTerritoryId();
|
||||
|
||||
auto pTerritory = player.getCurrentZone();
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||
}
|
||||
};
|
||||
|
||||
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, callback );
|
||||
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
|
|
|
@ -91,8 +91,8 @@ Core::Entity::Player::Player() :
|
|||
|
||||
for ( uint8_t i = 0; i < 5; i++ )
|
||||
{
|
||||
memset( &m_housePermission[i], 0xFF, 8 );
|
||||
memset( &m_housePermission[i].permissionMask, 0, 8 );
|
||||
memset( &m_landPermission[i], 0xFF, 8 );
|
||||
memset( &m_landPermission[i].permissionMask, 0, 8 );
|
||||
}
|
||||
|
||||
m_objSpawnIndexAllocator.init( MAX_DISPLAYED_EOBJS );
|
||||
|
@ -1754,22 +1754,22 @@ bool Core::Entity::Player::isOnEnterEventDone() const
|
|||
|
||||
void Core::Entity::Player::setLandPermissions( uint8_t permissionSet, uint32_t permissionMask, int16_t landSetId, int16_t wardNum, int16_t zoneId )
|
||||
{
|
||||
m_housePermission[permissionSet].landSetId = landSetId;
|
||||
m_housePermission[permissionSet].permissionMask = permissionMask;
|
||||
m_housePermission[permissionSet].wardNum = wardNum;
|
||||
m_housePermission[permissionSet].worldId = 67;
|
||||
m_housePermission[permissionSet].unkown1 = 0;
|
||||
m_landPermission[permissionSet].landId = landSetId;
|
||||
m_landPermission[permissionSet].permissionMask = permissionMask;
|
||||
m_landPermission[permissionSet].wardNum = wardNum;
|
||||
m_landPermission[permissionSet].worldId = 67;
|
||||
m_landPermission[permissionSet].unkown1 = 0;
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendLandPermissions()
|
||||
{
|
||||
auto landPermissions = makeZonePacket< FFXIVIpcLandPermission >( getId() );
|
||||
|
||||
landPermissions->data().freeCompanyHouse = m_housePermission[Common::LandPermissionSlot::FreeCompany];
|
||||
landPermissions->data().privateHouse = m_housePermission[Common::LandPermissionSlot::Private];
|
||||
landPermissions->data().apartment = m_housePermission[Common::LandPermissionSlot::Apartment];
|
||||
landPermissions->data().sharedHouse[0] = m_housePermission[Common::LandPermissionSlot::SharedHouse1];
|
||||
landPermissions->data().sharedHouse[1] = m_housePermission[Common::LandPermissionSlot::SharedHouse2];
|
||||
landPermissions->data().freeCompanyHouse = m_landPermission[Common::LandPermissionSlot::FreeCompany];
|
||||
landPermissions->data().privateHouse = m_landPermission[Common::LandPermissionSlot::Private];
|
||||
landPermissions->data().apartment = m_landPermission[Common::LandPermissionSlot::Apartment];
|
||||
landPermissions->data().sharedHouse[0] = m_landPermission[Common::LandPermissionSlot::SharedHouse1];
|
||||
landPermissions->data().sharedHouse[1] = m_landPermission[Common::LandPermissionSlot::SharedHouse2];
|
||||
memset( &landPermissions->data().unkownHouse, 0xFF, 8 );
|
||||
memset( &landPermissions->data().unkownHouse.permissionMask, 0, 8 );
|
||||
landPermissions->data().unkownHouse.permissionMask = 2;
|
||||
|
|
|
@ -911,6 +911,10 @@ namespace Core::Entity
|
|||
|
||||
uint8_t getFreeSlotsInBags();
|
||||
|
||||
void setActiveLand( uint8_t land, uint8_t ward );
|
||||
Common::ActiveLand getActiveLand() const;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint64_t m_lastMoveTime;
|
||||
|
@ -1020,7 +1024,9 @@ namespace Core::Entity
|
|||
uint8_t m_searchSelectClass; // class selected to show up in profile
|
||||
|
||||
// housing info
|
||||
Common::LandPermissionSet m_housePermission[5];
|
||||
Common::LandPermissionSet m_landPermission[5];
|
||||
|
||||
Common::ActiveLand m_activeLand;
|
||||
|
||||
// gc info
|
||||
uint8_t m_gc;
|
||||
|
|
|
@ -822,6 +822,17 @@ void Core::Entity::Player::discardItem( uint16_t fromInventoryId, uint8_t fromSl
|
|||
queuePacket( invTransFinPacket );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setActiveLand( uint8_t land, uint8_t ward )
|
||||
{
|
||||
m_activeLand.plot = land;
|
||||
m_activeLand.ward = ward;
|
||||
}
|
||||
|
||||
Core::Common::ActiveLand Core::Entity::Player::getActiveLand() const
|
||||
{
|
||||
return m_activeLand;
|
||||
}
|
||||
|
||||
uint16_t Core::Entity::Player::calculateEquippedGearItemLevel()
|
||||
{
|
||||
uint32_t iLvlResult = 0;
|
||||
|
|
|
@ -311,12 +311,15 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
}
|
||||
case ClientTriggerType::RequestHousingSign:
|
||||
{
|
||||
|
||||
auto plotPricePacket = makeZonePacket< Server::FFXIVIpcLandPriceUpdate >( player.getId() );
|
||||
|
||||
uint8_t ward = ( param12 & 0xFF00 ) >> 8;
|
||||
uint8_t plot = ( param12 & 0xFF );
|
||||
pLog->debug( " Ward: " + std::to_string( ward ) + " Plot: " + std::to_string( plot ) );
|
||||
|
||||
player.setActiveLand( plot, ward );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
|
|
|
@ -442,7 +442,7 @@ void Core::Network::GameConnection::finishLoadingHandler( const Core::Network::P
|
|||
gcPacket->data().gcRank[ 1 ] = player.getGcRankArray()[ 1 ];
|
||||
gcPacket->data().gcRank[ 2 ] = player.getGcRankArray()[ 2 ];
|
||||
player.queuePacket( gcPacket );
|
||||
|
||||
|
||||
player.getCurrentZone()->onFinishLoading( player );
|
||||
|
||||
// player is done zoning
|
||||
|
|
Loading…
Add table
Reference in a new issue