diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index a9602057..f80d3253 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -511,7 +511,7 @@ void Sapphire::Entity::BNpc::doDefaultBNpcUpdate( uint64_t tickCount ) auto pHatedActor = hateListGetHighest(); - while( pHatedActor && !pHatedActor->isAlive() ) + while( pHatedActor && ( !pHatedActor->isAlive() || getCurrentTerritory()->getGuId() != pHatedActor->getCurrentTerritory()->getGuId() ) ) { hateListRemove( pHatedActor ); pHatedActor = hateListGetHighest(); diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 59779515..2b72f3a6 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1871,6 +1871,10 @@ void Sapphire::Entity::Player::sendZonePackets() sendInventory(); + setTargetId( INVALID_GAME_OBJECT_ID64 ); + setStance( Common::Stance::Passive ); + setAutoattack( false ); + if( isLogin() ) { queuePacket( makeActorControlSelf( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 1 ) ); diff --git a/src/world/Territory/Cell.cpp b/src/world/Territory/Cell.cpp index 7f0e39cb..e6bd4769 100644 --- a/src/world/Territory/Cell.cpp +++ b/src/world/Territory/Cell.cpp @@ -102,3 +102,12 @@ void Sapphire::Cell::unload() removeActors(); } +uint32_t Sapphire::Cell::getLastActiveTime() const +{ + return m_lastActiveTime; +} + +void Sapphire::Cell::setLastActiveTime( uint32_t lastActiveTime ) +{ + m_lastActiveTime = lastActiveTime; +} \ No newline at end of file diff --git a/src/world/Territory/Cell.h b/src/world/Territory/Cell.h index 4a7dbbd6..3913a8b7 100644 --- a/src/world/Territory/Cell.h +++ b/src/world/Territory/Cell.h @@ -23,6 +23,7 @@ private: bool m_bActive; uint16_t m_playerCount; + uint32_t m_lastActiveTime; public: Cell(); @@ -85,6 +86,9 @@ public: { return m_posY; } + + uint32_t getLastActiveTime() const; + void setLastActiveTime( uint32_t lastActiveTime ); }; } diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index c7fdb724..ad0adf22 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -539,6 +539,7 @@ bool Sapphire::Territory::isCellActive( uint32_t x, uint32_t y ) uint32_t posY; Cell* pCell; + uint32_t time = Common::Util::getTimeSeconds(); for( posX = startX; posX <= endX; posX++ ) { @@ -546,7 +547,7 @@ bool Sapphire::Territory::isCellActive( uint32_t x, uint32_t y ) { pCell = getCellPtr( posX, posY ); - if( pCell && ( pCell->hasPlayers() || pCell->isForcedActive() ) ) + if( pCell && ( pCell->hasPlayers() || pCell->isForcedActive() || ( time - pCell->getLastActiveTime() ) < 20 ) ) return true; } } @@ -577,13 +578,13 @@ void Sapphire::Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t ra { pCell = create( posX, posY ); pCell->init( posX, posY ); - pCell->setActivity( true ); - + pCell->setLastActiveTime( Common::Util::getTimeSeconds() ); } } else { + pCell->setLastActiveTime( Common::Util::getTimeSeconds() ); //Cell is now active if( isCellActive( posX, posY ) && !pCell->isActive() ) {