1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-08 03:37:45 +00:00

add LandAvailability packet

New packet introduced in 6.1 that tells the client on clicking on a housing placard, whether the property is available by lottery or first-come-first-served, private or FC, etc.
This commit is contained in:
Moydow 2023-03-04 00:11:02 +00:00
parent 789a9e7058
commit 445597a639
6 changed files with 70 additions and 0 deletions

View file

@ -1015,6 +1015,38 @@ namespace Sapphire::Common
UNKNOWN_3 = 0x10,
};
enum class LandSellMode : uint8_t
{
Unavailable,
FirstComeFirstServed,
Lottery,
};
enum class LandAvailableTo : uint8_t
{
All,
FreeCompany,
Private,
};
enum class LandLotteryStatus : uint8_t
{
FirstComeFirstServed,
Available,
Results,
Unavailable,
};
enum class LandLotteryPlayerResult : uint8_t
{
NoEntry,
Entered,
Winner,
WinnerForfeit,
Loser,
RefundExpired,
};
struct LandIdent
{
int16_t landId; //00

View file

@ -257,6 +257,7 @@ namespace Sapphire::Network::Packets
LandSetInitialize = 0x69, // updated 6.31h
LandUpdate = 0x32a, // updated 6.31h
LandAvailability = 0x8f, // updated 6.31h
YardObjectSpawn = 0x183, // updated 6.31h
HousingIndoorInitialize = 0x206, // updated 6.31h
LandPriceUpdate = 0x330, // updated 6.31h

View file

@ -1902,6 +1902,26 @@ namespace Sapphire::Network::Packets::Server
uint32_t timeLeft;
};
/**
* Sent when the client clicks a housing placard
* to indicate if the plot is available to FCs or private housing or both,
* lottery or first-come-first-served, and lottery status/results
*/
struct FFXIVIpcLandAvailability : FFXIVIpcBasePacket< LandAvailability >
{
Common::LandSellMode sellMode;
Common::LandAvailableTo availableTo;
Common::LandLotteryStatus lotteryStatus;
Common::LandLotteryPlayerResult lotteryPlayerResult;
uint32_t lotteryUpdateTime;
uint32_t refundExpiryTime;
uint32_t lotteryEntries;
uint32_t lotteryWinningNumber;
uint32_t lotteryPlayerNumber;
uint32_t refundAmount;
uint32_t unknown;
};
struct FFXIVIpcLandInfoSign : FFXIVIpcBasePacket< LandInfoSign >
{
Common::LandIdent landIdent;

View file

@ -2,6 +2,7 @@
#include <Actor/Player.h>
#include <Territory/HousingZone.h>
#include <Manager/HousingMgr.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Network/PacketWrappers/ActorControlSelfPacket.h>
#include <Network/CommonActorControl.h>
#include <Exd/ExdDataGenerated.h>
@ -84,6 +85,10 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
// maybe not the best place to put this, but looks to be where it goes on retail
auto& pHouMgr = Common::Service< HousingMgr >::ref();
pHouMgr.sendLandAvailability( player, player.getActiveLand() );
Scene00000( player );
}
};

View file

@ -307,6 +307,16 @@ Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32
return hZone->getLand( static_cast< uint8_t >( res->getUInt( 2 ) ) );
}
void Sapphire::World::Manager::HousingMgr::sendLandAvailability( Entity::Player& player, Common::ActiveLand activeLand )
{
// to do: make these properties of the land database
auto landAvailabilityPacket = makeZonePacket< FFXIVIpcLandAvailability >( player.getId() );
landAvailabilityPacket->data().sellMode = Common::LandSellMode::FirstComeFirstServed;
landAvailabilityPacket->data().availableTo = Common::LandAvailableTo::Private;
landAvailabilityPacket->data().lotteryStatus = Common::LandLotteryStatus::FirstComeFirstServed;
player.queuePacket( landAvailabilityPacket );
}
void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident )
{
auto& serverMgr = Common::Service< World::ServerMgr >::ref();

View file

@ -77,6 +77,8 @@ namespace Sapphire::World::Manager
Sapphire::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
Sapphire::LandPtr getLandByOwnerId( uint32_t id );
void sendLandAvailability( Entity::Player& player, const Common::ActiveLand activeLand );
void sendLandSignOwned( Entity::Player& player, const Common::LandIdent ident );
void sendLandSignFree( Entity::Player& player, const Common::LandIdent ident );
LandPurchaseResult purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state );