mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
Re-added setOwner method to BNpc, not working yet though
This commit is contained in:
parent
c2ca32592c
commit
3f22f0de18
4 changed files with 1804 additions and 1867 deletions
File diff suppressed because it is too large
Load diff
|
@ -450,6 +450,7 @@ void Sapphire::Entity::BNpc::update( int64_t currTime )
|
|||
setHp( getMaxHp() );
|
||||
|
||||
m_state = BNpcState::Idle;
|
||||
setOwner( nullptr );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -515,7 +516,7 @@ void Sapphire::Entity::BNpc::update( int64_t currTime )
|
|||
hateListClear();
|
||||
changeTarget( INVALID_GAME_OBJECT_ID64 );
|
||||
setStance( Stance::Passive );
|
||||
//setOwner( nullptr );
|
||||
setOwner( nullptr );
|
||||
m_state = BNpcState::Retreat;
|
||||
break;
|
||||
}
|
||||
|
@ -568,8 +569,8 @@ void Sapphire::Entity::BNpc::onActionHostile( Sapphire::Entity::CharaPtr pSource
|
|||
if( !hateListGetHighest() )
|
||||
aggro( pSource );
|
||||
|
||||
//if( !getClaimer() )
|
||||
// setOwner( pSource->getAsPlayer() );
|
||||
if( !m_pOwner )
|
||||
setOwner( pSource );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::BNpc::onDeath()
|
||||
|
@ -578,6 +579,7 @@ void Sapphire::Entity::BNpc::onDeath()
|
|||
m_currentStance = Stance::Passive;
|
||||
m_state = BNpcState::Dead;
|
||||
m_timeOfDeath = Util::getTimeSeconds();
|
||||
setOwner( nullptr );
|
||||
|
||||
for( auto& pHateEntry : m_hateList )
|
||||
{
|
||||
|
@ -665,4 +667,23 @@ void Sapphire::Entity::BNpc::pushNearbyBNpcs()
|
|||
// m_pos.y,
|
||||
// m_pos.z + ( zBase * -pushDistance ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sapphire::Entity::BNpc::setOwner( Sapphire::Entity::CharaPtr m_pChara )
|
||||
{
|
||||
m_pOwner = m_pChara;
|
||||
if( m_pChara != nullptr )
|
||||
{
|
||||
auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( m_pChara->getId() );
|
||||
setOwnerPacket->data().type = 0x01;
|
||||
setOwnerPacket->data().actorId2 = m_pChara->getId();
|
||||
sendToInRangeSet( setOwnerPacket );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto setOwnerPacket = makeZonePacket< FFXIVIpcActorOwner >( m_pChara->getId() );
|
||||
setOwnerPacket->data().type = 0x01;
|
||||
setOwnerPacket->data().actorId2 = INVALID_GAME_OBJECT_ID;
|
||||
sendToInRangeSet( setOwnerPacket );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ namespace Sapphire::Entity
|
|||
|
||||
void pushNearbyBNpcs();
|
||||
|
||||
void setOwner( CharaPtr m_pChara );
|
||||
|
||||
private:
|
||||
uint32_t m_bNpcBaseId;
|
||||
uint32_t m_bNpcNameId;
|
||||
|
@ -130,6 +132,8 @@ namespace Sapphire::Entity
|
|||
uint8_t m_naviPathStep;
|
||||
Common::FFXIVARR_POSITION3 m_naviTarget;
|
||||
|
||||
CharaPtr m_pOwner;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2054,13 +2054,11 @@ void Sapphire::Entity::Player::updateHuntingLog( uint16_t id )
|
|||
auto note = pExdData->get< Sapphire::Data::MonsterNote >( monsterNoteId );
|
||||
for( auto x = 0; x < 4; ++x )
|
||||
{
|
||||
Logger::debug( "checking monsterNoteId#{}, monsternoteTarget#{}", monsterNoteId, note->monsterNoteTarget[ x ] );
|
||||
auto note1 = pExdData->get< Sapphire::Data::MonsterNoteTarget >( note->monsterNoteTarget[ x ] );
|
||||
if( note1->bNpcName == id && logEntry.entries[ i - 1 ][ x ] < note->count[ x ] )
|
||||
{
|
||||
logEntry.entries[ i - 1 ][ x ]++;
|
||||
queuePacket( makeActorControl143( getId(), HuntingLogEntryUpdate, monsterNoteId, x, logEntry.entries[ i - 1 ][ x ] ) );
|
||||
Logger::debug( "Kill counts!" );
|
||||
logChanged = true;
|
||||
sectionChanged = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue