mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 16:57:47 +00:00
Use the right packet to update permission + cleanup + new clienttrigger
This commit is contained in:
parent
d0e99ea7fd
commit
6f8abf951b
9 changed files with 66 additions and 14 deletions
|
@ -292,6 +292,7 @@ enum ActorControlType : uint16_t
|
|||
RequestHousingBuildPreset = 0x44C,
|
||||
RequestLandSignFree = 0x451,
|
||||
RequestLandSignOwned = 0x452,
|
||||
RequestLandRelinquish = 0x454,
|
||||
RequestEstateRename = 0x45A,
|
||||
RequestHousingItemUI = 0x463,
|
||||
RequestSharedEstateSettings = 0x46F,
|
||||
|
|
|
@ -1792,3 +1792,16 @@ void Core::Entity::Player::sendLandPermissions()
|
|||
|
||||
queuePacket( landPermissions );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::sendLandPermissionSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId )
|
||||
{
|
||||
auto landPermissions = makeZonePacket< FFXIVIpcLandPermissionSlot >( getId() );
|
||||
landPermissions->data().type = slotId;
|
||||
|
||||
landPermissions->data().permissionSet.landId = landId;
|
||||
landPermissions->data().permissionSet.wardNum = wardId;
|
||||
landPermissions->data().permissionSet.zoneId = zoneId;
|
||||
landPermissions->data().permissionSet.worldId = 67;
|
||||
landPermissions->data().permissionSet.permissionMask = 0;
|
||||
queuePacket( landPermissions );
|
||||
}
|
|
@ -766,6 +766,7 @@ namespace Core::Entity
|
|||
void setLandPermissions( uint8_t permissionSet, uint32_t permissionMask, int16_t landId, int16_t wardNum, int16_t zoneId );
|
||||
|
||||
void sendLandPermissions();
|
||||
void sendLandPermissionSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId );
|
||||
|
||||
// Player Battle Handling
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -312,17 +312,14 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
}
|
||||
case ClientTriggerType::RequestHousingBuildPreset:
|
||||
{
|
||||
auto pShowBuildPresetUIPacket = makeActorControl142( player.getId(), ShowBuildPresetUI, param11 );
|
||||
|
||||
auto zone = player.getCurrentZone();
|
||||
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||
|
||||
if (!hZone)
|
||||
return;
|
||||
|
||||
player.setActiveLand( param11, hZone->getWardNum() );
|
||||
|
||||
auto pShowBuildPresetUIPacket = makeActorControl142( player.getId(), ShowBuildPresetUI, param11 );
|
||||
player.queuePacket( pShowBuildPresetUIPacket );
|
||||
|
||||
break;
|
||||
|
@ -343,6 +340,15 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
pHousingMgr->sendLandSignOwned( player, ward, plot );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestLandRelinquish:
|
||||
{
|
||||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
|
||||
// TODO: do stuff!
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestEstateRename:
|
||||
{
|
||||
// removed temporarly, there is no such thing as a LandName
|
||||
|
|
|
@ -549,7 +549,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMSay;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Yell:
|
||||
|
@ -557,7 +557,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMYell;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
case ChatType::Shout:
|
||||
|
@ -565,12 +565,12 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
|||
if( player.isActingAsGm() )
|
||||
chatPacket->data().chatType = ChatType::GMShout;
|
||||
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,15 +176,21 @@ Core::LandPurchaseResult Core::HousingMgr::purchseLand( Entity::Player& player,
|
|||
|
||||
if( pOldLand )
|
||||
return LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR;
|
||||
|
||||
player.removeCurrency( CurrencyType::Gil, plotPrice );
|
||||
pLand->setPlayerOwner( player.getId() );
|
||||
pLand->setState( HouseState::sold );
|
||||
pLand->setLandType( Common::LandType::Private );
|
||||
|
||||
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
|
||||
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
||||
player.sendLandPermissions();
|
||||
|
||||
player.sendLandPermissionSlot( static_cast< uint8_t >( LandType::Private ), plot, pHousing->getWardNum(),
|
||||
pHousing->getTerritoryTypeId() );
|
||||
|
||||
//pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
||||
pLand->updateLandDb();
|
||||
|
||||
pHousing->sendLandUpdate( plot );
|
||||
return LandPurchaseResult::SUCCESS;
|
||||
}
|
||||
|
|
|
@ -144,10 +144,10 @@ void Core::HousingZone::sendLandSet( Entity::Player& player )
|
|||
|
||||
void Core::HousingZone::sendLandUpdate( uint8_t landId )
|
||||
{
|
||||
auto pLand = getLand( landId );
|
||||
for( const auto& playerIt : m_playerMap )
|
||||
{
|
||||
auto pPlayer = playerIt.second;
|
||||
auto pLand = getLand( landId );
|
||||
|
||||
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
|
||||
landUpdatePacket->data().landId = landId;
|
||||
|
|
|
@ -277,7 +277,7 @@ void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
|||
|
||||
}
|
||||
|
||||
void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
void Core::Zone::queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
|
@ -306,6 +306,28 @@ void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
void Core::Zone::queuePacketForZone( Entity::Player& sourcePlayer,
|
||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||
bool forSelf )
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||
return;
|
||||
|
||||
auto pServerZone = g_fw.get< ServerZone >();
|
||||
for( auto entry : m_playerMap )
|
||||
{
|
||||
auto player = entry.second;
|
||||
if( ( sourcePlayer.getId() != player->getId() ) ||
|
||||
( ( sourcePlayer.getId() == player->getId() ) && forSelf ) )
|
||||
{
|
||||
auto pSession = pServerZone->getSession( player->getId() );
|
||||
if( pSession )
|
||||
pSession->getZoneConnection()->queueOutPacket( pPacketEntry );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Core::Zone::getTerritoryTypeId() const
|
||||
{
|
||||
return m_territoryTypeId;
|
||||
|
|
|
@ -114,9 +114,12 @@ public:
|
|||
|
||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
||||
|
||||
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
void queuePacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||
Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
||||
|
||||
void queuePacketForZone( Entity::Player& sourcePlayer, Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||
bool forSelf = false );
|
||||
|
||||
uint32_t getGuId() const;
|
||||
|
||||
uint32_t getNextEObjId();
|
||||
|
|
Loading…
Add table
Reference in a new issue