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,
|
RequestHousingBuildPreset = 0x44C,
|
||||||
RequestLandSignFree = 0x451,
|
RequestLandSignFree = 0x451,
|
||||||
RequestLandSignOwned = 0x452,
|
RequestLandSignOwned = 0x452,
|
||||||
|
RequestLandRelinquish = 0x454,
|
||||||
RequestEstateRename = 0x45A,
|
RequestEstateRename = 0x45A,
|
||||||
RequestHousingItemUI = 0x463,
|
RequestHousingItemUI = 0x463,
|
||||||
RequestSharedEstateSettings = 0x46F,
|
RequestSharedEstateSettings = 0x46F,
|
||||||
|
|
|
@ -1792,3 +1792,16 @@ void Core::Entity::Player::sendLandPermissions()
|
||||||
|
|
||||||
queuePacket( landPermissions );
|
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 setLandPermissions( uint8_t permissionSet, uint32_t permissionMask, int16_t landId, int16_t wardNum, int16_t zoneId );
|
||||||
|
|
||||||
void sendLandPermissions();
|
void sendLandPermissions();
|
||||||
|
void sendLandPermissionSlot( uint8_t slotId, uint8_t landId, uint8_t wardId, uint16_t zoneId );
|
||||||
|
|
||||||
// Player Battle Handling
|
// Player Battle Handling
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -312,17 +312,14 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestHousingBuildPreset:
|
case ClientTriggerType::RequestHousingBuildPreset:
|
||||||
{
|
{
|
||||||
auto pShowBuildPresetUIPacket = makeActorControl142( player.getId(), ShowBuildPresetUI, param11 );
|
|
||||||
|
|
||||||
auto zone = player.getCurrentZone();
|
auto zone = player.getCurrentZone();
|
||||||
|
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( zone );
|
||||||
|
|
||||||
if (!hZone)
|
if (!hZone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.setActiveLand( param11, hZone->getWardNum() );
|
player.setActiveLand( param11, hZone->getWardNum() );
|
||||||
|
|
||||||
|
auto pShowBuildPresetUIPacket = makeActorControl142( player.getId(), ShowBuildPresetUI, param11 );
|
||||||
player.queuePacket( pShowBuildPresetUIPacket );
|
player.queuePacket( pShowBuildPresetUIPacket );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -343,6 +340,15 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
pHousingMgr->sendLandSignOwned( player, ward, plot );
|
pHousingMgr->sendLandSignOwned( player, ward, plot );
|
||||||
break;
|
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:
|
case ClientTriggerType::RequestEstateRename:
|
||||||
{
|
{
|
||||||
// removed temporarly, there is no such thing as a LandName
|
// 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() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().chatType = ChatType::GMSay;
|
chatPacket->data().chatType = ChatType::GMSay;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Yell:
|
case ChatType::Yell:
|
||||||
|
@ -557,7 +557,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
if( player.isActingAsGm() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().chatType = ChatType::GMYell;
|
chatPacket->data().chatType = ChatType::GMYell;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatType::Shout:
|
case ChatType::Shout:
|
||||||
|
@ -565,12 +565,12 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
if( player.isActingAsGm() )
|
if( player.isActingAsGm() )
|
||||||
chatPacket->data().chatType = ChatType::GMShout;
|
chatPacket->data().chatType = ChatType::GMShout;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queuePacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
player.getCurrentZone()->queuePacketForRange( player, 50, chatPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,15 +176,21 @@ Core::LandPurchaseResult Core::HousingMgr::purchseLand( Entity::Player& player,
|
||||||
|
|
||||||
if( pOldLand )
|
if( pOldLand )
|
||||||
return LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR;
|
return LandPurchaseResult::ERR_NO_MORE_LANDS_FOR_CHAR;
|
||||||
|
|
||||||
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 );
|
||||||
pLand->setLandType( Common::LandType::Private );
|
pLand->setLandType( Common::LandType::Private );
|
||||||
|
|
||||||
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
|
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
|
||||||
pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
|
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->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
|
||||||
pLand->updateLandDb();
|
pLand->updateLandDb();
|
||||||
|
|
||||||
pHousing->sendLandUpdate( plot );
|
pHousing->sendLandUpdate( plot );
|
||||||
return LandPurchaseResult::SUCCESS;
|
return LandPurchaseResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,10 +144,10 @@ void Core::HousingZone::sendLandSet( Entity::Player& player )
|
||||||
|
|
||||||
void Core::HousingZone::sendLandUpdate( uint8_t landId )
|
void Core::HousingZone::sendLandUpdate( uint8_t landId )
|
||||||
{
|
{
|
||||||
|
auto pLand = getLand( landId );
|
||||||
for( const auto& playerIt : m_playerMap )
|
for( const auto& playerIt : m_playerMap )
|
||||||
{
|
{
|
||||||
auto pPlayer = playerIt.second;
|
auto pPlayer = playerIt.second;
|
||||||
auto pLand = getLand( landId );
|
|
||||||
|
|
||||||
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
|
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
|
||||||
landUpdatePacket->data().landId = landId;
|
landUpdatePacket->data().landId = landId;
|
||||||
|
|
|
@ -277,8 +277,8 @@ 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 )
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||||
|
@ -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
|
uint32_t Core::Zone::getTerritoryTypeId() const
|
||||||
{
|
{
|
||||||
return m_territoryTypeId;
|
return m_territoryTypeId;
|
||||||
|
|
|
@ -114,8 +114,11 @@ public:
|
||||||
|
|
||||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
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 );
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
||||||
|
|
||||||
|
void queuePacketForZone( Entity::Player& sourcePlayer, Network::Packets::FFXIVPacketBasePtr pPacketEntry,
|
||||||
|
bool forSelf = false );
|
||||||
|
|
||||||
uint32_t getGuId() const;
|
uint32_t getGuId() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue