mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
commit
ea2acfcd8f
7 changed files with 321 additions and 182 deletions
|
@ -2,6 +2,9 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
#include "Actor/EventObject.h"
|
#include "Actor/EventObject.h"
|
||||||
|
#include "Territory/HousingZone.h"
|
||||||
|
#include "Manager/TerritoryMgr.h"
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -18,13 +21,31 @@ public:
|
||||||
{
|
{
|
||||||
player.sendDebug( "Found plot entrance for plot: " + std::to_string( eobj.getHousingLink() >> 8 ) );
|
player.sendDebug( "Found plot entrance for plot: " + std::to_string( eobj.getHousingLink() >> 8 ) );
|
||||||
|
|
||||||
player.playScene( eventId, 0, 0, []( Entity::Player& player, const Event::SceneResult& result )
|
player.playScene( eventId, 0, 0, [this, eobj]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
|
auto terriMgr = getFramework()->get< Sapphire::World::Manager::TerritoryMgr >();
|
||||||
|
if( !terriMgr )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto zone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||||
|
if( !zone )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Common::LandIdent ident;
|
||||||
|
ident.landId = eobj.getHousingLink() >> 8;
|
||||||
|
ident.territoryTypeId = zone->getTerritoryTypeId();
|
||||||
|
ident.wardNum = zone->getWardNum();
|
||||||
|
|
||||||
|
auto internalZone = terriMgr->findOrCreateHousingInterior( ident );
|
||||||
|
if( internalZone )
|
||||||
|
{
|
||||||
|
player.sendDebug( "created zone with guid: " + std::to_string( internalZone->getGuId() ) + "\nname: " + internalZone->getName() );
|
||||||
|
}
|
||||||
|
|
||||||
if( result.param2 != 1 )
|
if( result.param2 != 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// param2 == 1, zone into instance
|
// param2 == 1, zone into instance
|
||||||
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -19,7 +19,8 @@ file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
Network/PacketWrappers/*.c*
|
Network/PacketWrappers/*.c*
|
||||||
Script/*.c*
|
Script/*.c*
|
||||||
StatusEffect/*.c*
|
StatusEffect/*.c*
|
||||||
Territory/*.c*)
|
Territory/*.c*
|
||||||
|
Territory/Housing/*.c*)
|
||||||
|
|
||||||
add_executable( sapphire_zone ${SERVER_SOURCE_FILES} )
|
add_executable( sapphire_zone ${SERVER_SOURCE_FILES} )
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,11 @@ TYPE_FORWARD( Session );
|
||||||
TYPE_FORWARD( ZonePosition );
|
TYPE_FORWARD( ZonePosition );
|
||||||
TYPE_FORWARD( Land )
|
TYPE_FORWARD( Land )
|
||||||
|
|
||||||
|
namespace World::Territory::Housing
|
||||||
|
{
|
||||||
|
TYPE_FORWARD( HousingInteriorTerritory );
|
||||||
|
}
|
||||||
|
|
||||||
namespace World::Manager
|
namespace World::Manager
|
||||||
{
|
{
|
||||||
TYPE_FORWARD( HousingMgr );
|
TYPE_FORWARD( HousingMgr );
|
||||||
|
|
|
@ -7,12 +7,16 @@
|
||||||
#include "Actor/Player.h"
|
#include "Actor/Player.h"
|
||||||
|
|
||||||
#include "Territory/Zone.h"
|
#include "Territory/Zone.h"
|
||||||
#include "Territory/HousingZone.h"
|
|
||||||
#include "Territory/ZonePosition.h"
|
#include "Territory/ZonePosition.h"
|
||||||
#include "Territory/InstanceContent.h"
|
#include "Territory/InstanceContent.h"
|
||||||
#include "TerritoryMgr.h"
|
#include "TerritoryMgr.h"
|
||||||
|
#include "HousingMgr.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
|
#include "Territory/Land.h"
|
||||||
|
#include "Territory/House.h"
|
||||||
|
#include "Territory/Housing/HousingInteriorTerritory.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
extern Sapphire::Framework g_fw;
|
||||||
|
|
||||||
Sapphire::World::Manager::TerritoryMgr::TerritoryMgr() :
|
Sapphire::World::Manager::TerritoryMgr::TerritoryMgr() :
|
||||||
|
@ -278,9 +282,75 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent(
|
||||||
return pZone;
|
return pZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createHousingInterior( const Common::LandIdent& landIdent )
|
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInterior( const Common::LandIdent landIdent )
|
||||||
{
|
{
|
||||||
|
// check if zone already spawned first
|
||||||
|
auto ident = *reinterpret_cast< const uint64_t* >( &landIdent );
|
||||||
|
|
||||||
|
auto it = m_landIdentToZonePtrMap.find( ident );
|
||||||
|
if( it != m_landIdentToZonePtrMap.end() )
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, create it
|
||||||
|
auto housingMgr = g_fw.get< Manager::HousingMgr >();
|
||||||
|
|
||||||
|
auto parentZone = std::dynamic_pointer_cast< HousingZone >(
|
||||||
|
getZoneByLandSetId( housingMgr->toLandSetId( landIdent.territoryTypeId, landIdent.wardNum ) ) );
|
||||||
|
|
||||||
|
if( !parentZone )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto land = parentZone->getLand( landIdent.landId );
|
||||||
|
if( !land )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto house = land->getHouse();
|
||||||
|
if( !house )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
// get house instance id
|
||||||
|
uint16_t territoryTypeId = 0;
|
||||||
|
switch( landIdent.territoryTypeId )
|
||||||
|
{
|
||||||
|
case 339: // mist
|
||||||
|
territoryTypeId = 282;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 340: // lavender beds
|
||||||
|
territoryTypeId = 342;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 341: // goblet
|
||||||
|
territoryTypeId = 345;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 641: // shirogane
|
||||||
|
territoryTypeId = 649;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// zones are sequential in the exd for small, med, large
|
||||||
|
territoryTypeId += land->getSize();
|
||||||
|
|
||||||
|
auto terriInfo = getTerritoryDetail( territoryTypeId );
|
||||||
|
if( !terriInfo )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto zone = World::Territory::Housing::make_HousingInteriorTerritory( ident, territoryTypeId, getNextInstanceId(),
|
||||||
|
terriInfo->name, house->getHouseName() );
|
||||||
|
|
||||||
|
zone->init();
|
||||||
|
|
||||||
|
m_landIdentToZonePtrMap[ ident ] = zone;
|
||||||
|
m_instanceIdToZonePtrMap[ zone->getGuId() ] = zone;
|
||||||
|
m_zoneSet.insert( { zone } );
|
||||||
|
|
||||||
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
||||||
|
|
|
@ -19,186 +19,187 @@ namespace Sapphire::Data
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
\class TerritoryMgr_c
|
\class TerritoryMgr_c
|
||||||
\brief A class managing zones
|
\brief A class managing zones
|
||||||
|
|
||||||
This class manages persistent and temporary instances alike.
|
This class manages persistent and temporary instances alike.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class TerritoryMgr
|
class TerritoryMgr
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum TerritoryIntendedUse :
|
|
||||||
uint8_t //TODO: Add the rest of the territory types and have better names for them
|
|
||||||
{
|
{
|
||||||
Town = 0,
|
|
||||||
OpenWorld = 1,
|
public:
|
||||||
Inn = 2,
|
enum TerritoryIntendedUse : uint8_t //TODO: Add the rest of the territory types and have better names for them
|
||||||
Dungeon = 3,
|
{
|
||||||
JailArea = 5,
|
Town = 0,
|
||||||
OpeningArea = 6,
|
OpenWorld = 1,
|
||||||
BeforeTrialDung = 7,
|
Inn = 2,
|
||||||
AllianceRaid = 8,
|
Dungeon = 3,
|
||||||
OpenWorldInstanceBattle = 9,
|
JailArea = 5,
|
||||||
Trial = 10,
|
OpeningArea = 6,
|
||||||
HousingArea = 13,
|
BeforeTrialDung = 7,
|
||||||
HousingPrivateArea = 14,
|
AllianceRaid = 8,
|
||||||
MSQPrivateArea = 15,
|
OpenWorldInstanceBattle = 9,
|
||||||
Raids = 16,
|
Trial = 10,
|
||||||
RaidFights = 17,
|
HousingArea = 13,
|
||||||
ChocoboTutorial = 21,
|
HousingPrivateArea = 14,
|
||||||
Wedding = 22,
|
MSQPrivateArea = 15,
|
||||||
BeginnerTutorial = 27,
|
Raids = 16,
|
||||||
FreeCompanyGarrison = 30,
|
RaidFights = 17,
|
||||||
PalaceOfTheDead = 31,
|
ChocoboTutorial = 21,
|
||||||
TreasureMapInstance = 33,
|
Wedding = 22,
|
||||||
EventTrial = 36,
|
BeginnerTutorial = 27,
|
||||||
TheFeastArea = 37,
|
FreeCompanyGarrison = 30,
|
||||||
PrivateEventArea = 40,
|
PalaceOfTheDead = 31,
|
||||||
//Eureka = 41, // wat
|
TreasureMapInstance = 33,
|
||||||
|
EventTrial = 36,
|
||||||
|
TheFeastArea = 37,
|
||||||
|
PrivateEventArea = 40,
|
||||||
|
//Eureka = 41, // wat
|
||||||
|
};
|
||||||
|
|
||||||
|
TerritoryMgr();
|
||||||
|
|
||||||
|
/*! initializes the territoryMgr */
|
||||||
|
bool init();
|
||||||
|
|
||||||
|
bool createDefaultTerritories();
|
||||||
|
|
||||||
|
bool createHousingTerritories();
|
||||||
|
|
||||||
|
/*! caches TerritoryType details into m_territoryTypeMap */
|
||||||
|
void loadTerritoryTypeDetailCache();
|
||||||
|
|
||||||
|
/*! List of positions for zonelines */
|
||||||
|
void loadTerritoryPositionMap();
|
||||||
|
|
||||||
|
/*! returns true if the given territoryTypeId is in fact a valid zone
|
||||||
|
based on informations in the dats ( checks if an entry in the dats exists trhough cache ) */
|
||||||
|
bool isValidTerritory( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! returns the next available instanceId */
|
||||||
|
uint32_t getNextInstanceId();
|
||||||
|
|
||||||
|
/*! returns true if the territoryType in question is not a persistant zone */
|
||||||
|
bool isInstanceContentTerritory( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! returns true if the territoryType in question is not a private zone */
|
||||||
|
bool isPrivateTerritory( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! returns true if the territoryType is a default non-instanced zone */
|
||||||
|
bool isDefaultTerritory( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! returns true if the territoryType is a housing zone */
|
||||||
|
bool isHousingTerritory( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! creates a new instance for a given territoryTypeId */
|
||||||
|
ZonePtr createTerritoryInstance( uint32_t territoryTypeId );
|
||||||
|
|
||||||
|
ZonePtr createInstanceContent( uint32_t contentFinderConditionId );
|
||||||
|
|
||||||
|
ZonePtr findOrCreateHousingInterior( const Common::LandIdent landIdent );
|
||||||
|
|
||||||
|
/*! removes instance by instanceId, return true if successful */
|
||||||
|
bool removeTerritoryInstance( uint32_t territoryTypeId );
|
||||||
|
|
||||||
|
/*! returns a ZonePtr to the instance or nullptr if not found */
|
||||||
|
ZonePtr getInstanceZonePtr( uint32_t instanceId ) const;
|
||||||
|
|
||||||
|
/*! returns the cached detail of a territory, nullptr if not found */
|
||||||
|
Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! loop for processing territory logic, iterating all existing instances */
|
||||||
|
void updateTerritoryInstances( uint32_t currentTime );
|
||||||
|
|
||||||
|
/*! returns a ZonePositionPtr if found, else nullptr */
|
||||||
|
ZonePositionPtr getTerritoryPosition( uint32_t territoryPositionId ) const;
|
||||||
|
|
||||||
|
/*! returns a default Zone by territoryTypeId
|
||||||
|
TODO: Mind multiple instances?! */
|
||||||
|
ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
||||||
|
|
||||||
|
/*! returns a Zone by landSetId */
|
||||||
|
ZonePtr getZoneByLandSetId( uint32_t landSetId ) const;
|
||||||
|
|
||||||
|
bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer );
|
||||||
|
|
||||||
|
bool movePlayer( ZonePtr, Entity::PlayerPtr pPlayer );
|
||||||
|
|
||||||
|
/*! returns an instancePtr if the player is still bound to an isntance */
|
||||||
|
ZonePtr getLinkedInstance( uint32_t playerId ) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Sets the current festival for every zone
|
||||||
|
* @param festivalId A valid festival id from festival.exd
|
||||||
|
* @param additionalFestival A valid festival id from festival.exd, this is shown in addition to the first festival
|
||||||
|
*/
|
||||||
|
void setCurrentFestival( uint16_t festivalId, uint16_t additionalFestival = 0 );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Disables the current festival(s) in every zone
|
||||||
|
*/
|
||||||
|
void disableCurrentFestival();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Gets the current festival set on the server
|
||||||
|
* @return a pair with the 2 festivals currently active
|
||||||
|
*/
|
||||||
|
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
||||||
|
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||||
|
using LandSetIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||||
|
using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||||
|
using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||||
|
using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >;
|
||||||
|
using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >;
|
||||||
|
using InstanceIdList = std::vector< uint32_t >;
|
||||||
|
using LandIdentToZonePtrMap = std::unordered_map< uint64_t, ZonePtr >;
|
||||||
|
|
||||||
|
/*! map holding details for territory templates */
|
||||||
|
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
||||||
|
|
||||||
|
/*! map holding actual instances of default territories */
|
||||||
|
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
|
||||||
|
|
||||||
|
/*! map holding actual instances of default territories */
|
||||||
|
LandSetIdToZonePtrMap m_landSetIdToZonePtrMap;
|
||||||
|
|
||||||
|
/*! map holding actual instances of InstanceContent */
|
||||||
|
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
||||||
|
|
||||||
|
/*! flat map for easier lookup of instances by guid */
|
||||||
|
InstanceIdToZonePtrMap m_instanceIdToZonePtrMap;
|
||||||
|
|
||||||
|
/*! map holding positions for zonelines */
|
||||||
|
PositionMap m_territoryPositionMap;
|
||||||
|
|
||||||
|
/*! map storing playerIds to instanceIds, used for instanceContent */
|
||||||
|
PlayerIdToInstanceIdMap m_playerIdToInstanceMap;
|
||||||
|
|
||||||
|
/*! map for storing landident to zones, used for internal housing zones */
|
||||||
|
LandIdentToZonePtrMap m_landIdentToZonePtrMap;
|
||||||
|
|
||||||
|
/*! internal counter for instanceIds */
|
||||||
|
uint32_t m_lastInstanceId;
|
||||||
|
|
||||||
|
/*! set of ZonePtrs for quick iteration*/
|
||||||
|
std::set< ZonePtr > m_zoneSet;
|
||||||
|
|
||||||
|
/*! set of ZonePtrs for quick iteration*/
|
||||||
|
std::set< ZonePtr > m_instanceZoneSet;
|
||||||
|
|
||||||
|
/*! current festival(s) to set for public zones from festival.exd */
|
||||||
|
std::pair< uint16_t, uint16_t > m_currentFestival;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/*! returns a list of instanceContent InstanceIds currently active */
|
||||||
|
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TerritoryMgr();
|
|
||||||
|
|
||||||
/*! initializes the territoryMgr */
|
|
||||||
bool init();
|
|
||||||
|
|
||||||
bool createDefaultTerritories();
|
|
||||||
|
|
||||||
bool createHousingTerritories();
|
|
||||||
|
|
||||||
/*! caches TerritoryType details into m_territoryTypeMap */
|
|
||||||
void loadTerritoryTypeDetailCache();
|
|
||||||
|
|
||||||
/*! List of positions for zonelines */
|
|
||||||
void loadTerritoryPositionMap();
|
|
||||||
|
|
||||||
/*! returns true if the given territoryTypeId is in fact a valid zone
|
|
||||||
based on informations in the dats ( checks if an entry in the dats exists trhough cache ) */
|
|
||||||
bool isValidTerritory( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! returns the next available instanceId */
|
|
||||||
uint32_t getNextInstanceId();
|
|
||||||
|
|
||||||
/*! returns true if the territoryType in question is not a persistant zone */
|
|
||||||
bool isInstanceContentTerritory( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! returns true if the territoryType in question is not a private zone */
|
|
||||||
bool isPrivateTerritory( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! returns true if the territoryType is a default non-instanced zone */
|
|
||||||
bool isDefaultTerritory( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! returns true if the territoryType is a housing zone */
|
|
||||||
bool isHousingTerritory( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! creates a new instance for a given territoryTypeId */
|
|
||||||
ZonePtr createTerritoryInstance( uint32_t territoryTypeId );
|
|
||||||
|
|
||||||
ZonePtr createInstanceContent( uint32_t contentFinderConditionId );
|
|
||||||
|
|
||||||
ZonePtr createHousingInterior( const Common::LandIdent& landIdent );
|
|
||||||
|
|
||||||
/*! removes instance by instanceId, return true if successful */
|
|
||||||
bool removeTerritoryInstance( uint32_t territoryTypeId );
|
|
||||||
|
|
||||||
/*! returns a ZonePtr to the instance or nullptr if not found */
|
|
||||||
ZonePtr getInstanceZonePtr( uint32_t instanceId ) const;
|
|
||||||
|
|
||||||
/*! returns the cached detail of a territory, nullptr if not found */
|
|
||||||
Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! loop for processing territory logic, iterating all existing instances */
|
|
||||||
void updateTerritoryInstances( uint32_t currentTime );
|
|
||||||
|
|
||||||
/*! returns a ZonePositionPtr if found, else nullptr */
|
|
||||||
ZonePositionPtr getTerritoryPosition( uint32_t territoryPositionId ) const;
|
|
||||||
|
|
||||||
/*! returns a default Zone by territoryTypeId
|
|
||||||
TODO: Mind multiple instances?! */
|
|
||||||
ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
|
||||||
|
|
||||||
/*! returns a Zone by landSetId */
|
|
||||||
ZonePtr getZoneByLandSetId( uint32_t landSetId ) const;
|
|
||||||
|
|
||||||
bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer );
|
|
||||||
|
|
||||||
bool movePlayer( ZonePtr, Entity::PlayerPtr pPlayer );
|
|
||||||
|
|
||||||
/*! returns an instancePtr if the player is still bound to an isntance */
|
|
||||||
ZonePtr getLinkedInstance( uint32_t playerId ) const;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Sets the current festival for every zone
|
|
||||||
* @param festivalId A valid festival id from festival.exd
|
|
||||||
* @param additionalFestival A valid festival id from festival.exd, this is shown in addition to the first festival
|
|
||||||
*/
|
|
||||||
void setCurrentFestival( uint16_t festivalId, uint16_t additionalFestival = 0 );
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Disables the current festival(s) in every zone
|
|
||||||
*/
|
|
||||||
void disableCurrentFestival();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Gets the current festival set on the server
|
|
||||||
* @return a pair with the 2 festivals currently active
|
|
||||||
*/
|
|
||||||
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
|
||||||
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
|
||||||
using LandSetIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
|
||||||
using TerritoryTypeIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
|
||||||
using InstanceContentIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
|
||||||
using PlayerIdToInstanceIdMap = std::unordered_map< uint32_t, uint32_t >;
|
|
||||||
using PositionMap = std::unordered_map< int32_t, ZonePositionPtr >;
|
|
||||||
using InstanceIdList = std::vector< uint32_t >;
|
|
||||||
|
|
||||||
/*! map holding details for territory templates */
|
|
||||||
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
|
||||||
|
|
||||||
/*! map holding actual instances of default territories */
|
|
||||||
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
|
|
||||||
|
|
||||||
/*! map holding actual instances of default territories */
|
|
||||||
LandSetIdToZonePtrMap m_landSetIdToZonePtrMap;
|
|
||||||
|
|
||||||
/*! map holding actual instances of InstanceContent */
|
|
||||||
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
|
||||||
|
|
||||||
/*! flat map for easier lookup of instances by guid */
|
|
||||||
InstanceIdToZonePtrMap m_instanceIdToZonePtrMap;
|
|
||||||
|
|
||||||
/*! map holding positions for zonelines */
|
|
||||||
PositionMap m_territoryPositionMap;
|
|
||||||
|
|
||||||
/*! map storing playerIds to instanceIds, used for instanceContent */
|
|
||||||
PlayerIdToInstanceIdMap m_playerIdToInstanceMap;
|
|
||||||
|
|
||||||
/*! internal counter for instanceIds */
|
|
||||||
uint32_t m_lastInstanceId;
|
|
||||||
|
|
||||||
/*! set of ZonePtrs for quick iteration*/
|
|
||||||
std::set< ZonePtr > m_zoneSet;
|
|
||||||
|
|
||||||
/*! set of ZonePtrs for quick iteration*/
|
|
||||||
std::set< ZonePtr > m_instanceZoneSet;
|
|
||||||
|
|
||||||
/*! current festival(s) to set for public zones from festival.exd */
|
|
||||||
std::pair< uint16_t, uint16_t > m_currentFestival;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
/*! returns a list of instanceContent InstanceIds currently active */
|
|
||||||
InstanceIdList getInstanceContentIdList( uint16_t instanceContentId ) const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SAPPHIRE_TERRITORYMGR_H
|
#endif // SAPPHIRE_TERRITORYMGR_H
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#include "HousingInteriorTerritory.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
using namespace Sapphire::World::Territory;
|
||||||
|
|
||||||
|
Housing::HousingInteriorTerritory::HousingInteriorTerritory( uint64_t ident, uint16_t territoryTypeId,
|
||||||
|
uint32_t guId,
|
||||||
|
const std::string& internalName,
|
||||||
|
const std::string& contentName ) :
|
||||||
|
Zone( territoryTypeId, guId, internalName, contentName ),
|
||||||
|
m_landIdent( ident )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Housing::HousingInteriorTerritory::~HousingInteriorTerritory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Housing::HousingInteriorTerritory::init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Housing::HousingInteriorTerritory::onUpdate( uint32_t currTime )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Zone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "Territory/Zone.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Territory::Housing
|
namespace Sapphire::World::Territory::Housing
|
||||||
{
|
{
|
||||||
|
@ -10,9 +11,14 @@ namespace Sapphire::World::Territory::Housing
|
||||||
const std::string& internalName,
|
const std::string& internalName,
|
||||||
const std::string& contentName );
|
const std::string& contentName );
|
||||||
|
|
||||||
|
virtual ~HousingInteriorTerritory();
|
||||||
|
|
||||||
bool init() override;
|
bool init() override;
|
||||||
|
|
||||||
void onPlayerZoneIn( Entity::Player& player ) override;
|
void onPlayerZoneIn( Entity::Player& player ) override;
|
||||||
void onUpdate( uint32_t currTime ) override;
|
void onUpdate( uint32_t currTime ) override;
|
||||||
}
|
|
||||||
|
private:
|
||||||
|
uint64_t m_landIdent;
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue