From 47f449f4e103986c09db6f54c4c360cd4645e347 Mon Sep 17 00:00:00 2001 From: Mordred Date: Thu, 26 Jan 2023 15:30:57 +0100 Subject: [PATCH] WiP check permissions before removing the estate hall. --- src/world/Manager/HousingMgr.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 8c58308d..42e148df 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -1710,6 +1710,22 @@ void HousingMgr::removeHouse( Entity::Player& player, uint16_t plot ) if( !terri ) return; + auto& server = Common::Service< World::WorldServer >::ref(); + auto pSession = server.getSession( player.getCharacterId() ); + + auto pLand = terri->getLand( plot ); + if( !pLand ) + return; + + // can't remove when you are not the owner + // TODO: actually use permissions here for FC houses + if( !hasPermission( player, *pLand, 0 ) ) + { + auto msgPkt = makeActorControlSelf( player.getId(), ActorControl::LogMsg, 3305, 0 ); + pSession->getZoneConnection()->queueOutPacket( msgPkt ); + return; + } + auto land = terri->getLand( static_cast< uint8_t >( plot ) ); if( !land || !land->getHouse() ) return;