mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +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() );
|
setHp( getMaxHp() );
|
||||||
|
|
||||||
m_state = BNpcState::Idle;
|
m_state = BNpcState::Idle;
|
||||||
|
setOwner( nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -515,7 +516,7 @@ void Sapphire::Entity::BNpc::update( int64_t currTime )
|
||||||
hateListClear();
|
hateListClear();
|
||||||
changeTarget( INVALID_GAME_OBJECT_ID64 );
|
changeTarget( INVALID_GAME_OBJECT_ID64 );
|
||||||
setStance( Stance::Passive );
|
setStance( Stance::Passive );
|
||||||
//setOwner( nullptr );
|
setOwner( nullptr );
|
||||||
m_state = BNpcState::Retreat;
|
m_state = BNpcState::Retreat;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -568,8 +569,8 @@ void Sapphire::Entity::BNpc::onActionHostile( Sapphire::Entity::CharaPtr pSource
|
||||||
if( !hateListGetHighest() )
|
if( !hateListGetHighest() )
|
||||||
aggro( pSource );
|
aggro( pSource );
|
||||||
|
|
||||||
//if( !getClaimer() )
|
if( !m_pOwner )
|
||||||
// setOwner( pSource->getAsPlayer() );
|
setOwner( pSource );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::onDeath()
|
void Sapphire::Entity::BNpc::onDeath()
|
||||||
|
@ -578,6 +579,7 @@ void Sapphire::Entity::BNpc::onDeath()
|
||||||
m_currentStance = Stance::Passive;
|
m_currentStance = Stance::Passive;
|
||||||
m_state = BNpcState::Dead;
|
m_state = BNpcState::Dead;
|
||||||
m_timeOfDeath = Util::getTimeSeconds();
|
m_timeOfDeath = Util::getTimeSeconds();
|
||||||
|
setOwner( nullptr );
|
||||||
|
|
||||||
for( auto& pHateEntry : m_hateList )
|
for( auto& pHateEntry : m_hateList )
|
||||||
{
|
{
|
||||||
|
@ -666,3 +668,22 @@ void Sapphire::Entity::BNpc::pushNearbyBNpcs()
|
||||||
// m_pos.z + ( zBase * -pushDistance ) );
|
// 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 pushNearbyBNpcs();
|
||||||
|
|
||||||
|
void setOwner( CharaPtr m_pChara );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_bNpcBaseId;
|
uint32_t m_bNpcBaseId;
|
||||||
uint32_t m_bNpcNameId;
|
uint32_t m_bNpcNameId;
|
||||||
|
@ -130,6 +132,8 @@ namespace Sapphire::Entity
|
||||||
uint8_t m_naviPathStep;
|
uint8_t m_naviPathStep;
|
||||||
Common::FFXIVARR_POSITION3 m_naviTarget;
|
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 );
|
auto note = pExdData->get< Sapphire::Data::MonsterNote >( monsterNoteId );
|
||||||
for( auto x = 0; x < 4; ++x )
|
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 ] );
|
auto note1 = pExdData->get< Sapphire::Data::MonsterNoteTarget >( note->monsterNoteTarget[ x ] );
|
||||||
if( note1->bNpcName == id && logEntry.entries[ i - 1 ][ x ] < note->count[ x ] )
|
if( note1->bNpcName == id && logEntry.entries[ i - 1 ][ x ] < note->count[ x ] )
|
||||||
{
|
{
|
||||||
logEntry.entries[ i - 1 ][ x ]++;
|
logEntry.entries[ i - 1 ][ x ]++;
|
||||||
queuePacket( makeActorControl143( getId(), HuntingLogEntryUpdate, monsterNoteId, x, logEntry.entries[ i - 1 ][ x ] ) );
|
queuePacket( makeActorControl143( getId(), HuntingLogEntryUpdate, monsterNoteId, x, logEntry.entries[ i - 1 ][ x ] ) );
|
||||||
Logger::debug( "Kill counts!" );
|
|
||||||
logChanged = true;
|
logChanged = true;
|
||||||
sectionChanged = true;
|
sectionChanged = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue