mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 14:07:46 +00:00
Use territoryType instead of TerritoryId, also refactor variables to reflect the change
This commit is contained in:
parent
df052982fa
commit
c512a63b92
15 changed files with 77 additions and 79 deletions
|
@ -50,12 +50,12 @@ void Core::Db::ZoneDbConnection::doPrepareStatements()
|
|||
"CFPenaltyUntil = ?, Pose = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );
|
||||
|
||||
|
||||
prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelMainWeapon, ModelSubWeapon, ModelEquip, TerritoryId, GuardianDeity, "
|
||||
prepareStatement( CHARA_SEL_MINIMAL, "SELECT Name, Customize, ModelMainWeapon, ModelSubWeapon, ModelEquip, TerritoryType, GuardianDeity, "
|
||||
"Class, ContentId, BirthDay, BirthMonth, EquipDisplayFlags "
|
||||
"FROM charainfo WHERE CharacterId = ?;", CONNECTION_SYNC );
|
||||
|
||||
prepareStatement( CHARA_INS, "INSERT INTO charainfo (AccountId, CharacterId, ContentId, Name, Hp, Mp, "
|
||||
"Customize, Voice, IsNewGame, TerritoryId, PosX, PosY, PosZ, PosR, ModelEquip, "
|
||||
"Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, "
|
||||
"IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
|
||||
"HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
|
||||
"Aetheryte, GMRank, Mounts, Orchestrion, UPDATE_DATE ) "
|
||||
|
|
|
@ -64,7 +64,7 @@ void PlayerMinimal::load( uint32_t charId )
|
|||
m_guardianDeity = res->getUInt8( "GuardianDeity" );
|
||||
m_class = res->getUInt8( "Class" );
|
||||
m_contentId = res->getUInt64( "ContentId" );
|
||||
m_zoneId = res->getUInt16( "TerritoryId" );
|
||||
m_zoneId = res->getUInt16( "TerritoryType" );
|
||||
|
||||
res.reset();
|
||||
|
||||
|
@ -245,7 +245,7 @@ void PlayerMinimal::saveAsNew()
|
|||
}
|
||||
|
||||
// "(AccountId, CharacterId, ContentId, Name, Hp, Mp, "
|
||||
// "Customize, Voice, IsNewGame, TerritoryId, PosX, PosY, PosZ, PosR, ModelEquip, "
|
||||
// "Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, "
|
||||
// "IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
|
||||
// "HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
|
||||
// "Aetheryte, GMRank, UPDATE_DATE )
|
||||
|
|
|
@ -423,7 +423,7 @@ bool Core::Entity::Player::setInstance( ZonePtr instance )
|
|||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
|
||||
// zoning within the same zone won't cause the prev data to be overwritten
|
||||
if( instance->getTerritoryId() != m_zoneId )
|
||||
if( instance->getTerritoryTypeId() != m_zoneId )
|
||||
{
|
||||
m_prevPos = m_pos;
|
||||
m_prevRot = m_rot;
|
||||
|
@ -519,7 +519,7 @@ void Core::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
|||
int32_t offset = 4;
|
||||
|
||||
auto info = pExdData->get< Core::Data::Map >(
|
||||
pExdData->get< Core::Data::TerritoryType >( getCurrentZone()->getTerritoryId() )->map );
|
||||
pExdData->get< Core::Data::TerritoryType >( getCurrentZone()->getTerritoryTypeId() )->map );
|
||||
if( info->discoveryArrayByte )
|
||||
offset = 5 + 2 * info->discoveryIndex;
|
||||
else
|
||||
|
@ -993,7 +993,7 @@ void Core::Entity::Player::update( int64_t currTime )
|
|||
if( m_queuedZoneing && ( currTime - m_queuedZoneing->m_queueTime ) > 800 )
|
||||
{
|
||||
Common::FFXIVARR_POSITION3 targetPos = m_queuedZoneing->m_targetPosition;
|
||||
if( getCurrentZone()->getTerritoryId() != m_queuedZoneing->m_targetZone )
|
||||
if( getCurrentZone()->getTerritoryTypeId() != m_queuedZoneing->m_targetZone )
|
||||
{
|
||||
performZoning( m_queuedZoneing->m_targetZone, targetPos, m_queuedZoneing->m_targetRotation );
|
||||
}
|
||||
|
@ -1502,12 +1502,12 @@ void Core::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
|
|||
queuePacket( packet );
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setTerritoryId( uint32_t territoryId )
|
||||
void Core::Entity::Player::setTerritoryTypeId( uint32_t territoryTypeId )
|
||||
{
|
||||
m_zoneId = territoryId;
|
||||
m_zoneId = territoryTypeId;
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::Player::getTerritoryId() const
|
||||
uint32_t Core::Entity::Player::getTerritoryTypeId() const
|
||||
{
|
||||
return m_zoneId;
|
||||
}
|
||||
|
@ -1559,7 +1559,7 @@ void Core::Entity::Player::sendZonePackets()
|
|||
}
|
||||
|
||||
auto initZonePacket = makeZonePacket< FFXIVIpcInitZone >( getId() );
|
||||
initZonePacket->data().zoneId = getCurrentZone()->getTerritoryId();
|
||||
initZonePacket->data().zoneId = getCurrentZone()->getTerritoryTypeId();
|
||||
initZonePacket->data().weatherId = static_cast< uint8_t >( getCurrentZone()->getCurrentWeather() );
|
||||
initZonePacket->data().bitmask = 0x1; //Setting this to 16 (deciaml) makes it so you can fly in the area (more research needed!)
|
||||
initZonePacket->data().unknown5 = 0x2A;
|
||||
|
|
|
@ -481,11 +481,11 @@ namespace Core::Entity
|
|||
/*! returns the player to their position before zoning into an instance */
|
||||
bool exitInstance();
|
||||
|
||||
/*! sets the players territoryId */
|
||||
void setTerritoryId( uint32_t territoryId );
|
||||
/*! sets the players territoryTypeId */
|
||||
void setTerritoryTypeId( uint32_t territoryTypeId );
|
||||
|
||||
/*! gets the players territoryId */
|
||||
uint32_t getTerritoryId() const;
|
||||
/*! gets the players territoryTypeId */
|
||||
uint32_t getTerritoryTypeId() const;
|
||||
|
||||
void forceZoneing( uint32_t zoneId );
|
||||
|
||||
|
|
|
@ -49,9 +49,8 @@ bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
auto name = res->getString( "Name" );
|
||||
strcpy( m_name, name.c_str() );
|
||||
|
||||
auto zoneId = res->getUInt( "TerritoryId" );
|
||||
m_prevZoneId = res->getUInt( "OTerritoryId" );
|
||||
m_prevZoneType = res->getUInt( "OTerritoryType" );
|
||||
auto zoneId = res->getUInt( "TerritoryType" );
|
||||
m_prevZoneId = res->getUInt( "OTerritoryType" );
|
||||
|
||||
// Position
|
||||
m_pos.x = res->getFloat( "PosX" );
|
||||
|
@ -79,12 +78,12 @@ bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
m_pos.y = m_prevPos.y;
|
||||
m_pos.z = m_prevPos.z;
|
||||
setRot( m_prevRot );
|
||||
pCurrZone = pTeriMgr->getZoneByTerriId( zoneId );
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pCurrZone = pTeriMgr->getZoneByTerriId( zoneId );
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( zoneId );
|
||||
}
|
||||
|
||||
m_zoneId = zoneId;
|
||||
|
@ -98,7 +97,7 @@ bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
|
||||
// default to new gridania
|
||||
// TODO: should probably just abort and mark character as corrupt
|
||||
pCurrZone = pTeriMgr->getZoneByTerriId( 132 );
|
||||
pCurrZone = pTeriMgr->getZoneByTerritoryTypeId( 132 );
|
||||
|
||||
m_pos.x = 0.0f;
|
||||
m_pos.y = 0.0f;
|
||||
|
@ -365,15 +364,15 @@ void Core::Entity::Player::updateSql()
|
|||
stmt->setInt( 16, static_cast< uint32_t >( m_bNewGame ) );
|
||||
stmt->setInt( 17, static_cast< uint32_t >( m_bNewAdventurer ) );
|
||||
|
||||
stmt->setInt( 18, 0 ); // TerritoryType
|
||||
stmt->setInt( 19, m_zoneId ); // TerritoryId
|
||||
stmt->setInt( 18, m_zoneId ); // TerritoryType
|
||||
stmt->setInt( 19, 0 ); // TerritoryId
|
||||
stmt->setDouble( 20, m_pos.x );
|
||||
stmt->setDouble( 21, m_pos.y );
|
||||
stmt->setDouble( 22, m_pos.z );
|
||||
stmt->setDouble( 23, getRot() );
|
||||
|
||||
stmt->setInt( 24, m_prevZoneType ); // OTerritoryType
|
||||
stmt->setInt( 25, m_prevZoneId ); // OTerritoryId
|
||||
stmt->setInt( 24, m_prevZoneId ); // OTerritoryType
|
||||
stmt->setInt( 25, m_prevZoneType ); // OTerritoryId
|
||||
stmt->setDouble( 26, m_prevPos.x );
|
||||
stmt->setDouble( 27, m_prevPos.y );
|
||||
stmt->setDouble( 28, m_prevPos.z );
|
||||
|
|
|
@ -535,7 +535,7 @@ void Core::DebugCommandHandler::get( char* data, Entity::Player& player, std::sh
|
|||
if( ( subCommand == "pos" ) )
|
||||
{
|
||||
|
||||
int16_t map_id = pExdData->get< Core::Data::TerritoryType >( player.getCurrentZone()->getTerritoryId() )->map;
|
||||
int16_t map_id = pExdData->get< Core::Data::TerritoryType >( player.getCurrentZone()->getTerritoryTypeId() )->map;
|
||||
|
||||
player.sendNotice( "Pos:\n" +
|
||||
std::to_string( player.getPos().x ) + "\n" +
|
||||
|
@ -543,7 +543,7 @@ void Core::DebugCommandHandler::get( char* data, Entity::Player& player, std::sh
|
|||
std::to_string( player.getPos().z ) + "\n" +
|
||||
std::to_string( player.getRot() ) + "\nMapId: " +
|
||||
std::to_string( map_id ) + "\nZoneID: " +
|
||||
std::to_string( player.getCurrentZone()->getTerritoryId() ) + "\n" );
|
||||
std::to_string( player.getCurrentZone()->getTerritoryTypeId() ) + "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -450,7 +450,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
|||
}
|
||||
else
|
||||
{
|
||||
auto pZone = pTeriMgr->getZoneByTerriId( param1 );
|
||||
auto pZone = pTeriMgr->getZoneByTerritoryTypeId( param1 );
|
||||
if( !pZone )
|
||||
{
|
||||
player.sendUrgent( "No zone instance found for " + std::to_string( param1 ) );
|
||||
|
|
|
@ -348,7 +348,7 @@ void Core::Network::GameConnection::zoneLineHandler( const Core::Network::Packet
|
|||
targetPos.x = 0;
|
||||
targetPos.y = 0;
|
||||
targetPos.z = 0;
|
||||
targetZone = pZone->getTerritoryId();
|
||||
targetZone = pZone->getTerritoryTypeId();
|
||||
}
|
||||
|
||||
player.performZoning( targetZone, targetPos, rotation );
|
||||
|
@ -471,7 +471,7 @@ void Core::Network::GameConnection::socialListHandler( const Core::Network::Pack
|
|||
int32_t entrysizes = sizeof( listPacket->data().entries );
|
||||
memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) );
|
||||
|
||||
listPacket->data().entries[ 0 ].bytes[ 2 ] = player.getCurrentZone()->getTerritoryId();
|
||||
listPacket->data().entries[ 0 ].bytes[ 2 ] = player.getCurrentZone()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].bytes[ 3 ] = 0x80;
|
||||
listPacket->data().entries[ 0 ].bytes[ 4 ] = 0x02;
|
||||
listPacket->data().entries[ 0 ].bytes[ 6 ] = 0x3B;
|
||||
|
@ -479,7 +479,7 @@ void Core::Network::GameConnection::socialListHandler( const Core::Network::Pack
|
|||
listPacket->data().entries[ 0 ].classJob = static_cast< uint8_t >( player.getClass() );
|
||||
listPacket->data().entries[ 0 ].contentId = player.getContentId();
|
||||
listPacket->data().entries[ 0 ].level = player.getLevel();
|
||||
listPacket->data().entries[ 0 ].zoneId = player.getCurrentZone()->getTerritoryId();
|
||||
listPacket->data().entries[ 0 ].zoneId = player.getCurrentZone()->getTerritoryTypeId();
|
||||
listPacket->data().entries[ 0 ].zoneId1 = 0x0100;
|
||||
// TODO: no idea what this does
|
||||
//listPacket.data().entries[0].one = 1;
|
||||
|
|
|
@ -359,7 +359,7 @@ bool Core::Scripting::ScriptMgr::onStatusTimeOut( Entity::CharaPtr pChara, uint3
|
|||
|
||||
bool Core::Scripting::ScriptMgr::onZoneInit( ZonePtr pZone )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< ZoneScript >( pZone->getTerritoryId() );
|
||||
auto script = m_nativeScriptMgr->getScript< ZoneScript >( pZone->getTerritoryTypeId() );
|
||||
if( script )
|
||||
{
|
||||
script->onZoneInit();
|
||||
|
|
|
@ -22,14 +22,14 @@ using namespace Core::Network::Packets;
|
|||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
Core::HousingZone::HousingZone( uint8_t wardNum,
|
||||
uint16_t territoryId,
|
||||
uint16_t territoryTypeId,
|
||||
uint32_t guId,
|
||||
const std::string& internalName,
|
||||
const std::string& contentName ) :
|
||||
Zone( territoryId, guId, internalName, contentName ),
|
||||
Zone( territoryTypeId, guId, internalName, contentName ),
|
||||
m_wardNum( wardNum ),
|
||||
m_zoneId( territoryId ),
|
||||
m_landSetId( ( static_cast< uint32_t >( territoryId ) << 16 ) | wardNum )
|
||||
m_zoneId( territoryTypeId ),
|
||||
m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ bool Core::HousingZone::init()
|
|||
uint32_t landId;
|
||||
for( landId = 0; landId < 60; landId++ )
|
||||
{
|
||||
auto pObject = make_Land( m_territoryId, getWardNum(), landId, m_landSetId, info );
|
||||
auto pObject = make_Land( m_territoryTypeId, getWardNum(), landId, m_landSetId, info );
|
||||
pObject->setHouseSize( 1 );
|
||||
m_landPtrMap[ landId ] = pObject;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ void Core::HousingZone::sendLandSet( Entity::Player& player )
|
|||
auto landsetInitializePacket = makeZonePacket< FFXIVIpcLandSetInitialize >( player.getId() );
|
||||
|
||||
landsetInitializePacket->data().landSetId = m_landSetId;
|
||||
landsetInitializePacket->data().zoneId = m_territoryId;
|
||||
landsetInitializePacket->data().zoneId = m_territoryTypeId;
|
||||
//TODO: get current WorldId
|
||||
landsetInitializePacket->data().worldId = 67;
|
||||
landsetInitializePacket->data().subInstance = isPlayerSubInstance( player ) == false ? 1 : 2;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Core
|
|||
{
|
||||
public:
|
||||
HousingZone( uint8_t landSetId,
|
||||
uint16_t territoryId,
|
||||
uint16_t territoryTypeId,
|
||||
uint32_t guId,
|
||||
const std::string& internalName,
|
||||
const std::string& contentName );
|
||||
|
|
|
@ -108,7 +108,7 @@ bool Core::TerritoryMgr::createDefaultTerritories()
|
|||
// for each entry in territoryTypeExd, check if it is a normal and if so, add the zone object
|
||||
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
||||
{
|
||||
auto territoryId = territory.first;
|
||||
auto territoryTypeId = territory.first;
|
||||
auto territoryInfo = territory.second;
|
||||
|
||||
// if the zone has no name set
|
||||
|
@ -117,24 +117,24 @@ bool Core::TerritoryMgr::createDefaultTerritories()
|
|||
|
||||
auto pPlaceName = pExdData->get< Core::Data::PlaceName >( territoryInfo->placeName );
|
||||
|
||||
if( !pPlaceName || pPlaceName->name.empty() || !isDefaultTerritory( territoryId ) )
|
||||
if( !pPlaceName || pPlaceName->name.empty() || !isDefaultTerritory( territoryTypeId ) )
|
||||
continue;
|
||||
|
||||
uint32_t guid = getNextInstanceId();
|
||||
pLog->info( std::to_string( territoryId ) +
|
||||
pLog->info( std::to_string( territoryTypeId ) +
|
||||
"\t" + std::to_string( guid ) +
|
||||
"\t" + std::to_string( territoryInfo->territoryIntendedUse ) +
|
||||
"\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) +
|
||||
"\t" + ( isPrivateTerritory( territoryId ) ? "PRIVATE" : "PUBLIC" ) +
|
||||
"\t" + ( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ) +
|
||||
"\t" + pPlaceName->name );
|
||||
|
||||
auto pZone = make_Zone( territoryId, guid, territoryInfo->name, pPlaceName->name );
|
||||
auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name );
|
||||
pZone->init();
|
||||
|
||||
InstanceIdToZonePtrMap instanceMap;
|
||||
instanceMap[ guid ] = pZone;
|
||||
m_instanceIdToZonePtrMap[ guid ] = pZone;
|
||||
m_territoryIdToInstanceGuidMap[ territoryId ] = instanceMap;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ] = instanceMap;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool Core::TerritoryMgr::createHousingTerritories()
|
|||
auto pLog = g_fw.get< Logger >();
|
||||
for( const auto& territory : m_territoryTypeDetailCacheMap )
|
||||
{
|
||||
auto territoryId = territory.first;
|
||||
auto territoryTypeId = territory.first;
|
||||
auto territoryInfo = territory.second;
|
||||
uint32_t wardNum;
|
||||
uint32_t wardMaxNum = 1;
|
||||
|
@ -159,13 +159,13 @@ bool Core::TerritoryMgr::createHousingTerritories()
|
|||
|
||||
auto pPlaceName = pExdData->get< Core::Data::PlaceName >( territoryInfo->placeName );
|
||||
|
||||
if( !pPlaceName || pPlaceName->name.empty() || !isHousingTerritory( territoryId ) )
|
||||
if( !pPlaceName || pPlaceName->name.empty() || !isHousingTerritory( territoryTypeId ) )
|
||||
continue;
|
||||
|
||||
for( wardNum = 0; wardNum < wardMaxNum; wardNum++ )
|
||||
{
|
||||
uint32_t guid = getNextInstanceId();
|
||||
pLog->info( std::to_string( territoryId ) +
|
||||
pLog->info( std::to_string( territoryTypeId ) +
|
||||
"\t" + std::to_string( guid ) +
|
||||
"\t" + std::to_string( territoryInfo->territoryIntendedUse ) +
|
||||
"\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) +
|
||||
|
@ -173,14 +173,14 @@ bool Core::TerritoryMgr::createHousingTerritories()
|
|||
"\t" + pPlaceName->name +
|
||||
"#" + std::to_string( wardNum ) );
|
||||
|
||||
auto pHousingZone = make_HousingZone( wardNum, territoryId, guid, territoryInfo->name, pPlaceName->name );
|
||||
auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, guid, territoryInfo->name, pPlaceName->name );
|
||||
pHousingZone->init();
|
||||
wardMaxNum = 18;
|
||||
|
||||
InstanceIdToZonePtrMap instanceMap;
|
||||
instanceMap[ guid ] = pHousingZone;
|
||||
m_instanceIdToZonePtrMap[ guid ] = pHousingZone;
|
||||
m_territoryIdToInstanceGuidMap[ territoryId ][ guid ] = pHousingZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ territoryTypeId ][ guid ] = pHousingZone;
|
||||
m_zoneSet.insert( { pHousingZone } );
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
|
|||
pZone->init();
|
||||
|
||||
m_instanceIdToZonePtrMap[ pZone->getGuId() ] = pZone;
|
||||
m_territoryIdToInstanceGuidMap[ pZone->getTerritoryId() ][ pZone->getGuId() ] = pZone;
|
||||
m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ][ pZone->getGuId() ] = pZone;
|
||||
m_zoneSet.insert( { pZone } );
|
||||
|
||||
return pZone;
|
||||
|
@ -265,13 +265,13 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
|||
m_instanceZoneSet.erase( pZone );
|
||||
m_zoneSet.erase( pZone );
|
||||
|
||||
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
|
||||
if( isInstanceContentTerritory( pZone->getTerritoryTypeId() ) )
|
||||
{
|
||||
auto instance = std::dynamic_pointer_cast< InstanceContent >( pZone );
|
||||
m_instanceContentToInstanceMap[ instance->getInstanceContentId() ].erase( pZone->getGuId() );
|
||||
}
|
||||
else
|
||||
m_territoryIdToInstanceGuidMap[ pZone->getTerritoryId() ].erase( pZone->getGuId() );
|
||||
m_territoryTypeIdToInstanceGuidMap[ pZone->getTerritoryTypeId() ].erase( pZone->getGuId() );
|
||||
|
||||
|
||||
return true;
|
||||
|
@ -340,10 +340,10 @@ Core::ZonePositionPtr Core::TerritoryMgr::getTerritoryPosition( uint32_t territo
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Core::ZonePtr Core::TerritoryMgr::getZoneByTerriId( uint32_t territoryId ) const
|
||||
Core::ZonePtr Core::TerritoryMgr::getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const
|
||||
{
|
||||
auto zoneMap = m_territoryIdToInstanceGuidMap.find( territoryId );
|
||||
if( zoneMap == m_territoryIdToInstanceGuidMap.end() )
|
||||
auto zoneMap = m_territoryTypeIdToInstanceGuidMap.find( territoryTypeId );
|
||||
if( zoneMap == m_territoryTypeIdToInstanceGuidMap.end() )
|
||||
return nullptr;
|
||||
|
||||
// TODO: actually select the proper one
|
||||
|
@ -378,9 +378,9 @@ Core::TerritoryMgr::InstanceIdList Core::TerritoryMgr::getInstanceContentIdList(
|
|||
return idList;
|
||||
}
|
||||
|
||||
bool Core::TerritoryMgr::movePlayer( uint32_t territoryId, Core::Entity::PlayerPtr pPlayer )
|
||||
bool Core::TerritoryMgr::movePlayer( uint32_t territoryTypeId, Core::Entity::PlayerPtr pPlayer )
|
||||
{
|
||||
auto pZone = getZoneByTerriId( territoryId );
|
||||
auto pZone = getZoneByTerritoryTypeId( territoryTypeId );
|
||||
assert( pZone );
|
||||
return movePlayer( pZone, pPlayer );
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ bool Core::TerritoryMgr::movePlayer( ZonePtr pZone, Core::Entity::PlayerPtr pPla
|
|||
|
||||
pPlayer->initSpawnIdQueue();
|
||||
|
||||
pPlayer->setTerritoryId( pZone->getTerritoryId() );
|
||||
pPlayer->setTerritoryTypeId( pZone->getTerritoryTypeId() );
|
||||
|
||||
// mark character as zoning in progress
|
||||
pPlayer->setLoadingComplete( false );
|
||||
|
|
|
@ -112,11 +112,11 @@ public:
|
|||
/*! returns a ZonePositionPtr if found, else nullptr */
|
||||
ZonePositionPtr getTerritoryPosition( uint32_t territoryPositionId ) const;
|
||||
|
||||
/*! returns a default Zone by territoryId
|
||||
/*! returns a default Zone by territoryTypeId
|
||||
TODO: Mind multiple instances?! */
|
||||
ZonePtr getZoneByTerriId( uint32_t territoryId ) const;
|
||||
ZonePtr getZoneByTerritoryTypeId( uint32_t territoryTypeId ) const;
|
||||
|
||||
bool movePlayer( uint32_t territoryId, Entity::PlayerPtr pPlayer );
|
||||
bool movePlayer( uint32_t territoryTypeId, Entity::PlayerPtr pPlayer );
|
||||
|
||||
bool movePlayer( ZonePtr, Entity::PlayerPtr pPlayer );
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
private:
|
||||
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, Data::TerritoryTypePtr >;
|
||||
using InstanceIdToZonePtrMap = std::unordered_map< uint32_t, ZonePtr >;
|
||||
using TerritoryIdToInstanceMap = std::unordered_map< uint16_t, InstanceIdToZonePtrMap >;
|
||||
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 >;
|
||||
|
@ -154,7 +154,7 @@ private:
|
|||
TerritoryTypeDetailCache m_territoryTypeDetailCacheMap;
|
||||
|
||||
/*! map holding actual instances of default territories */
|
||||
TerritoryIdToInstanceMap m_territoryIdToInstanceGuidMap;
|
||||
TerritoryTypeIdToInstanceMap m_territoryTypeIdToInstanceGuidMap;
|
||||
|
||||
/*! map holding actual instances of InstanceContent */
|
||||
InstanceContentIdToInstanceMap m_instanceContentToInstanceMap;
|
||||
|
|
|
@ -48,7 +48,7 @@ extern Core::Framework g_fw;
|
|||
* \brief
|
||||
*/
|
||||
Core::Zone::Zone() :
|
||||
m_territoryId( 0 ),
|
||||
m_territoryTypeId( 0 ),
|
||||
m_guId( 0 ),
|
||||
m_currentWeather( Weather::FairSkies ),
|
||||
m_weatherOverride( Weather::None ),
|
||||
|
@ -57,20 +57,20 @@ Core::Zone::Zone() :
|
|||
{
|
||||
}
|
||||
|
||||
Core::Zone::Zone( uint16_t territoryId, uint32_t guId, const std::string& internalName, const std::string& placeName ) :
|
||||
Core::Zone::Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName ) :
|
||||
m_currentWeather( Weather::FairSkies ),
|
||||
m_nextEObjId( 0x400D0000 )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
m_guId = guId;
|
||||
|
||||
m_territoryId = territoryId;
|
||||
m_territoryTypeId = territoryTypeId;
|
||||
m_internalName = internalName;
|
||||
m_placeName = placeName;
|
||||
m_lastMobUpdate = 0;
|
||||
|
||||
m_weatherOverride = Weather::None;
|
||||
m_territoryTypeInfo = pExdData->get< Core::Data::TerritoryType >( territoryId );
|
||||
m_territoryTypeInfo = pExdData->get< Core::Data::TerritoryType >( territoryTypeId );
|
||||
|
||||
loadWeatherRates();
|
||||
|
||||
|
@ -281,7 +281,7 @@ void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t
|
|||
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
if( pTeriMgr->isPrivateTerritory( getTerritoryId() ) )
|
||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||
return;
|
||||
|
||||
auto pServerZone = g_fw.get< ServerZone >();
|
||||
|
@ -306,9 +306,9 @@ void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t Core::Zone::getTerritoryId() const
|
||||
uint32_t Core::Zone::getTerritoryTypeId() const
|
||||
{
|
||||
return m_territoryId;
|
||||
return m_territoryTypeId;
|
||||
}
|
||||
|
||||
uint32_t Core::Zone::getGuId() const
|
||||
|
@ -611,7 +611,7 @@ void Core::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
|||
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
// TODO: make sure gms can overwrite this. Potentially temporary solution
|
||||
if( pTeriMgr->isPrivateTerritory( getTerritoryId() ) )
|
||||
if( pTeriMgr->isPrivateTerritory( getTerritoryTypeId() ) )
|
||||
return;
|
||||
|
||||
auto iter = pCell->m_actors.begin();
|
||||
|
@ -661,7 +661,7 @@ void Core::Zone::onPlayerZoneIn( Entity::Player& player )
|
|||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug(
|
||||
"Zone::onEnterTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryId() ) +
|
||||
"Zone::onEnterTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
||||
+", Entity#" + std::to_string( player.getId() ) );
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ void Core::Zone::onLeaveTerritory( Entity::Player& player )
|
|||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug(
|
||||
"Zone::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryId() ) +
|
||||
"Zone::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
||||
+", Entity#" + std::to_string( player.getId() ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,10 @@ struct InstanceContent;
|
|||
struct TerritoryType;
|
||||
}
|
||||
|
||||
class Zone :
|
||||
public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
|
||||
class Zone : public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
|
||||
{
|
||||
protected:
|
||||
uint32_t m_territoryId;
|
||||
uint32_t m_territoryTypeId;
|
||||
uint32_t m_guId;
|
||||
|
||||
std::string m_placeName;
|
||||
|
@ -62,7 +61,7 @@ protected:
|
|||
public:
|
||||
Zone();
|
||||
|
||||
Zone( uint16_t territoryId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
||||
Zone( uint16_t territoryTypeId, uint32_t guId, const std::string& internalName, const std::string& placeName );
|
||||
|
||||
virtual ~Zone();
|
||||
|
||||
|
@ -79,7 +78,7 @@ public:
|
|||
|
||||
virtual void loadCellCache();
|
||||
|
||||
virtual uint32_t getTerritoryId() const;
|
||||
virtual uint32_t getTerritoryTypeId() const;
|
||||
|
||||
virtual void onBeforePlayerZoneIn( Entity::Player& player ) {};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue