mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Merge branch 'housing' into housing
This commit is contained in:
commit
5220587f51
8 changed files with 88 additions and 39 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fPIC")
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||||
else()
|
else()
|
||||||
add_definitions(-D_WIN32_WINNT=0x601)
|
add_definitions(-D_WIN32_WINNT=0x601)
|
||||||
|
|
|
@ -73,8 +73,6 @@ namespace Core::Network::Packets
|
||||||
SocialRequestResponse = 0x00BB, // updated 4.1
|
SocialRequestResponse = 0x00BB, // updated 4.1
|
||||||
CancelAllianceForming = 0x00C6, // updated 4.2
|
CancelAllianceForming = 0x00C6, // updated 4.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Chat = 0x00F4, // updated 4.4
|
Chat = 0x00F4, // updated 4.4
|
||||||
SocialList = 0x00FB, // updated 4.4
|
SocialList = 0x00FB, // updated 4.4
|
||||||
|
|
||||||
|
@ -84,8 +82,7 @@ namespace Core::Network::Packets
|
||||||
|
|
||||||
ServerNotice = 0x0104, // updated 4.4
|
ServerNotice = 0x0104, // updated 4.4
|
||||||
SetOnlineStatus = 0x0105, // updated 4.4
|
SetOnlineStatus = 0x0105, // updated 4.4
|
||||||
|
|
||||||
|
|
||||||
CountdownInitiate = 0x010C, // updated 4.4
|
CountdownInitiate = 0x010C, // updated 4.4
|
||||||
CountdownCancel = 0x010D, // updated 4.4
|
CountdownCancel = 0x010D, // updated 4.4
|
||||||
|
|
||||||
|
@ -184,7 +181,8 @@ namespace Core::Network::Packets
|
||||||
|
|
||||||
EquipDisplayFlags = 0x020C, // updated 4.4
|
EquipDisplayFlags = 0x020C, // updated 4.4
|
||||||
|
|
||||||
// housing
|
/// Housing //////////////////////////////////////
|
||||||
|
|
||||||
LandSetInitialize = 0x0220, // updated 4.4
|
LandSetInitialize = 0x0220, // updated 4.4
|
||||||
LandUpdate = 0x0221, // updated 4.4
|
LandUpdate = 0x0221, // updated 4.4
|
||||||
YardObjectSpawn = 0x0222, // updated 4.4
|
YardObjectSpawn = 0x0222, // updated 4.4
|
||||||
|
@ -192,13 +190,21 @@ namespace Core::Network::Packets
|
||||||
LandPriceUpdate = 0x0224, // updated 4.4
|
LandPriceUpdate = 0x0224, // updated 4.4
|
||||||
LandInfoSign = 0x0225, // updated 4.4
|
LandInfoSign = 0x0225, // updated 4.4
|
||||||
RenameLand = 0x0226, // updated 4.4
|
RenameLand = 0x0226, // updated 4.4
|
||||||
|
|
||||||
|
LandPermissionSlot = 0x0228, // updated 4.4
|
||||||
|
|
||||||
LandPermission = 0x0229, // updated 4.4
|
LandPermission = 0x0229, // updated 4.4
|
||||||
|
|
||||||
LandSetYardInitialize = 0x022C, // updated 4.4
|
LandSetYardInitialize = 0x022C, // updated 4.4
|
||||||
|
|
||||||
YardObjectMove = 0x0230, // updated 4.4
|
YardObjectMove = 0x0230, // updated 4.4
|
||||||
LandSetMap = 0x0251, // updated 4.4
|
|
||||||
|
|
||||||
SharedEstateSettingsResponse = 0x023C, // updated 4.4
|
SharedEstateSettingsResponse = 0x023C, // updated 4.4
|
||||||
|
|
||||||
|
LandSetMap = 0x0251, // updated 4.4
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
|
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
|
||||||
PerformNote = 0x0286, // updated 4.3
|
PerformNote = 0x0286, // updated 4.3
|
||||||
|
|
||||||
|
|
|
@ -1575,8 +1575,14 @@ struct FFXIVIpcPerformNote : FFXIVIpcBasePacket< PerformNote >
|
||||||
uint8_t data[32];
|
uint8_t data[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
//IPCs
|
struct FFXIVIpcLandPermissionSlot : FFXIVIpcBasePacket< LandPermissionSlot >
|
||||||
struct FFXIVIpcLandPermission : FFXIVIpcBasePacket<LandPermission >
|
{
|
||||||
|
uint32_t type;
|
||||||
|
uint32_t unknown;
|
||||||
|
Common::LandPermissionSet permissionSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcLandPermission : FFXIVIpcBasePacket< LandPermission >
|
||||||
{
|
{
|
||||||
Common::LandPermissionSet freeCompanyHouse; // 00
|
Common::LandPermissionSet freeCompanyHouse; // 00
|
||||||
uint64_t unkown1;
|
uint64_t unkown1;
|
||||||
|
|
|
@ -31,30 +31,49 @@ public:
|
||||||
auto pTerritory = player.getCurrentZone();
|
auto pTerritory = player.getCurrentZone();
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||||
|
|
||||||
PurchaseResult res = pHousing->purchseLand( player, activeLand.plot,
|
LandPurchaseResult res = pHousing->purchseLand( player, activeLand.plot,
|
||||||
static_cast< uint8_t >( result.param2 ) );
|
static_cast< uint8_t >( result.param2 ) );
|
||||||
|
|
||||||
switch( res )
|
switch( res )
|
||||||
{
|
{
|
||||||
case PurchaseResult::SUCCESS:
|
case LandPurchaseResult::SUCCESS:
|
||||||
{
|
{
|
||||||
auto screenMsgPkt = makeActorControl143( player.getId(), ActorControl::DutyQuestScreenMsg, m_id, 0x98 );
|
auto screenMsgPkt = makeActorControl143( player.getId(), ActorControl::DutyQuestScreenMsg, m_id, 0x98 );
|
||||||
player.queuePacket( screenMsgPkt );
|
player.queuePacket( screenMsgPkt );
|
||||||
|
auto screenMsgPkt2 = makeActorControl143( player.getId(), ActorControl::LogMsg, 0x0D16, 0x1AA,
|
||||||
|
activeLand.ward + 1, activeLand.plot + 1 );
|
||||||
|
player.queuePacket( screenMsgPkt2 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PurchaseResult::ERR_NOT_ENOUGH_GIL:
|
case LandPurchaseResult::ERR_NOT_ENOUGH_GIL:
|
||||||
{
|
{
|
||||||
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 4027 );
|
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 3314 );
|
||||||
player.queuePacket( errorMsg );
|
player.queuePacket( errorMsg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PurchaseResult::ERR_NOT_AVAILABLE:
|
case LandPurchaseResult::ERR_NOT_AVAILABLE:
|
||||||
|
{
|
||||||
|
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 3312 );
|
||||||
|
player.queuePacket( errorMsg );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PurchaseResult::ERR_INTERNAL:
|
case LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR:
|
||||||
|
{
|
||||||
|
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 3313 );
|
||||||
|
player.queuePacket( errorMsg );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case LandPurchaseResult::ERR_INTERNAL:
|
||||||
|
{
|
||||||
|
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 1995 );
|
||||||
|
player.queuePacket( errorMsg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1580,7 +1580,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, 0x0B, pLand->getLandId(), pLand->getWardNum(), pLand->getZoneId() );
|
setLandPermissions( LandPermissionSlot::Private, 0x00, pLand->getLandId(), pLand->getWardNum(), pLand->getZoneId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
sendLandPermissions();
|
sendLandPermissions();
|
||||||
|
@ -1761,14 +1761,15 @@ bool Core::Entity::Player::isOnEnterEventDone() const
|
||||||
return m_onEnterEventDone;
|
return m_onEnterEventDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setLandPermissions( uint8_t permissionSet, uint32_t permissionMask, int16_t landId, int16_t wardNum, int16_t zoneId )
|
void Core::Entity::Player::setLandPermissions( uint8_t permissionSet, uint32_t permissionMask,
|
||||||
|
int16_t landId, int16_t wardNum, int16_t zoneId )
|
||||||
{
|
{
|
||||||
m_landPermission[permissionSet].landId = landId;
|
m_landPermission[ permissionSet ].landId = landId;
|
||||||
m_landPermission[permissionSet].permissionMask = permissionMask;
|
m_landPermission[ permissionSet ].permissionMask = permissionMask;
|
||||||
m_landPermission[permissionSet].wardNum = wardNum;
|
m_landPermission[ permissionSet ].wardNum = wardNum;
|
||||||
m_landPermission[permissionSet].zoneId = zoneId;
|
m_landPermission[ permissionSet ].zoneId = zoneId;
|
||||||
m_landPermission[permissionSet].worldId = 67;
|
m_landPermission[ permissionSet ].worldId = 67;
|
||||||
m_landPermission[permissionSet].unkown1 = 0;
|
m_landPermission[ permissionSet ].unkown1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendLandPermissions()
|
void Core::Entity::Player::sendLandPermissions()
|
||||||
|
|
|
@ -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, 8, pHousing->getLandSetId(), pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
player.setLandPermissions( permissionSet, 0, pHousing->getLandSetId(), pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
||||||
player.sendLandPermissions();
|
player.sendLandPermissions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -111,7 +111,7 @@ void Core::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
||||||
//memcpy( , &getLand( i )->getLand(), sizeof( Common::LandStruct ) );
|
//memcpy( , &getLand( i )->getLand(), sizeof( Common::LandStruct ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
player.queuePacket( landSetMap );
|
//player.queuePacket( landSetMap );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ bool Core::HousingZone::isPlayerSubInstance( Entity::Player& player )
|
||||||
return player.getPos().x < -15000.0f; //ToDo: get correct pos
|
return player.getPos().x < -15000.0f; //ToDo: get correct pos
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::PurchaseResult Core::HousingZone::purchseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
Core::LandPurchaseResult Core::HousingZone::purchseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto plotPrice = getLand( plot )->getCurrentPrice();
|
auto plotPrice = getLand( plot )->getCurrentPrice();
|
||||||
|
@ -162,35 +162,44 @@ Core::PurchaseResult Core::HousingZone::purchseLand( Entity::Player& player, uin
|
||||||
auto pLand = getLand( plot );
|
auto pLand = getLand( plot );
|
||||||
|
|
||||||
if( !pLand )
|
if( !pLand )
|
||||||
return PurchaseResult::ERR_INTERNAL;
|
return LandPurchaseResult::ERR_INTERNAL;
|
||||||
|
|
||||||
if( pLand->getState() != HouseState::forSale )
|
if( pLand->getState() != HouseState::forSale )
|
||||||
return PurchaseResult::ERR_NOT_AVAILABLE;
|
return LandPurchaseResult::ERR_NOT_AVAILABLE;
|
||||||
|
|
||||||
if( gilAvailable < plotPrice )
|
if( gilAvailable < plotPrice )
|
||||||
return PurchaseResult::ERR_NOT_ENOUGH_GIL;
|
return LandPurchaseResult::ERR_NOT_ENOUGH_GIL;
|
||||||
|
|
||||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||||
|
|
||||||
switch( state )
|
switch( static_cast< LandPurchaseMode >( state ) )
|
||||||
{
|
{
|
||||||
case 1:
|
case LandPurchaseMode::FC:
|
||||||
player.sendDebug( "Free company house purchase aren't supported at this time." );
|
player.sendDebug( "Free company house purchase aren't supported at this time." );
|
||||||
return PurchaseResult::ERR_INTERNAL;
|
return LandPurchaseResult::ERR_INTERNAL;
|
||||||
|
|
||||||
|
case LandPurchaseMode::PRIVATE:
|
||||||
|
{
|
||||||
|
|
||||||
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
|
auto pOldLand = pHousingMgr->getLandByOwnerId( player.getId() );
|
||||||
|
|
||||||
|
if( pOldLand )
|
||||||
|
return LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR;
|
||||||
|
|
||||||
case 2:
|
|
||||||
player.removeCurrency( CurrencyType::Gil, plotPrice );
|
player.removeCurrency( CurrencyType::Gil, plotPrice );
|
||||||
pLand->setPlayerOwner( player.getId() );
|
pLand->setPlayerOwner( player.getId() );
|
||||||
pLand->setState( HouseState::sold );
|
pLand->setState( HouseState::sold );
|
||||||
player.setLandPermissions( LandPermissionSlot::Private, 0x0B, plot,
|
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
|
||||||
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
||||||
player.sendLandPermissions();
|
player.sendLandPermissions();
|
||||||
pLand->UpdateLandDb();
|
pLand->UpdateLandDb();
|
||||||
sendLandUpdate( plot );
|
sendLandUpdate( plot );
|
||||||
return PurchaseResult::SUCCESS;
|
return LandPurchaseResult::SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return PurchaseResult::ERR_INTERNAL;
|
return LandPurchaseResult::ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,22 @@
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
enum class PurchaseResult
|
enum class LandPurchaseResult
|
||||||
{
|
{
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
ERR_NOT_ENOUGH_GIL,
|
ERR_NOT_ENOUGH_GIL,
|
||||||
ERR_NOT_AVAILABLE,
|
ERR_NOT_AVAILABLE,
|
||||||
|
ERR_NO_MORE_LANDS_FOR_CHAR,
|
||||||
ERR_INTERNAL,
|
ERR_INTERNAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class LandPurchaseMode
|
||||||
|
{
|
||||||
|
FC = 1,
|
||||||
|
PRIVATE = 2,
|
||||||
|
RELOCATE = 4,
|
||||||
|
};
|
||||||
|
|
||||||
class HousingZone : public Zone
|
class HousingZone : public Zone
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -34,7 +42,7 @@ namespace Core
|
||||||
void sendLandUpdate( uint8_t landId );
|
void sendLandUpdate( uint8_t landId );
|
||||||
bool isPlayerSubInstance( Entity::Player& player );
|
bool isPlayerSubInstance( Entity::Player& player );
|
||||||
|
|
||||||
PurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||||
|
|
||||||
/* returns current ward number for this zone */
|
/* returns current ward number for this zone */
|
||||||
uint8_t getWardNum() const;
|
uint8_t getWardNum() const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue