mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
Fix for BNpcs positions not being updated properly through timelines and removal of unnused code
This commit is contained in:
parent
866103c9d5
commit
e3b53b5e19
4 changed files with 33 additions and 25 deletions
|
@ -1091,4 +1091,14 @@ const Common::FFXIVARR_POSITION3& BNpc::getRoamTargetPos() const
|
||||||
const Common::FFXIVARR_POSITION3& BNpc::getSpawnPos() const
|
const Common::FFXIVARR_POSITION3& BNpc::getSpawnPos() const
|
||||||
{
|
{
|
||||||
return m_spawnPos;
|
return m_spawnPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BNpc::setPos( float x, float y, float z, bool broadcastUpdate )
|
||||||
|
{
|
||||||
|
Chara::setPos( x, y, z, broadcastUpdate );
|
||||||
|
}
|
||||||
|
|
||||||
|
void BNpc::setPos( const FFXIVARR_POSITION3& pos, bool broadcastUpdate )
|
||||||
|
{
|
||||||
|
setPos( pos.x, pos.y, pos.z, broadcastUpdate );
|
||||||
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ namespace Sapphire::Entity
|
||||||
uint32_t getTimeOfDeath() const;
|
uint32_t getTimeOfDeath() const;
|
||||||
void setTimeOfDeath( uint32_t timeOfDeath );
|
void setTimeOfDeath( uint32_t timeOfDeath );
|
||||||
|
|
||||||
|
void setPos( const Common::FFXIVARR_POSITION3& pos, bool broadcastUpdate = true ) override;
|
||||||
|
void setPos( float x, float y, float z, bool broadcastUpdate = true ) override;
|
||||||
|
|
||||||
void restHp();
|
void restHp();
|
||||||
|
|
||||||
void checkAggro();
|
void checkAggro();
|
||||||
|
|
|
@ -19,11 +19,8 @@ namespace Sapphire
|
||||||
|
|
||||||
void init() override
|
void init() override
|
||||||
{
|
{
|
||||||
m_status = EncounterFightStatus::IDLE;
|
|
||||||
m_startTime = 0;
|
m_startTime = 0;
|
||||||
|
|
||||||
m_stateStack = std::make_shared< EncounterState::StateStack >();
|
|
||||||
|
|
||||||
// todo: i don't like this
|
// todo: i don't like this
|
||||||
auto boss = m_pInstance->createBNpcFromLayoutId( NPC_IFRIT, VAL_IFRIT_HP, Common::BNpcType::Enemy );
|
auto boss = m_pInstance->createBNpcFromLayoutId( NPC_IFRIT, VAL_IFRIT_HP, Common::BNpcType::Enemy );
|
||||||
boss->init();
|
boss->init();
|
||||||
|
@ -33,7 +30,6 @@ namespace Sapphire
|
||||||
void start() override
|
void start() override
|
||||||
{
|
{
|
||||||
|
|
||||||
m_status = EncounterFightStatus::ACTIVE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() override
|
void reset() override
|
||||||
|
@ -51,24 +47,7 @@ namespace Sapphire
|
||||||
|
|
||||||
void update( uint64_t deltaTime ) override
|
void update( uint64_t deltaTime ) override
|
||||||
{
|
{
|
||||||
// todo: better way to start fights here..
|
|
||||||
// this probably doesn't need to be overriden either
|
|
||||||
|
|
||||||
auto ifrit = getBNpc( NPC_IFRIT );
|
|
||||||
|
|
||||||
if( ifrit; ifrit->hateListGetHighestValue() != 0 && m_status == EncounterFightStatus::IDLE )
|
|
||||||
{
|
|
||||||
m_startTime = deltaTime;
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_status == EncounterFightStatus::ACTIVE && ifrit && ( !ifrit->hateListGetHighest() || !ifrit->hateListGetHighest()->isAlive() ) )
|
|
||||||
{
|
|
||||||
m_status = EncounterFightStatus::FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pInstance->getEncounterTimeline().update( getInstance(), deltaTime );
|
m_pInstance->getEncounterTimeline().update( getInstance(), deltaTime );
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}// namespace Sapphire
|
}// namespace Sapphire
|
|
@ -11,10 +11,13 @@
|
||||||
|
|
||||||
#include <Event/Director.h>
|
#include <Event/Director.h>
|
||||||
|
|
||||||
|
#include <Manager/TerritoryMgr.h>
|
||||||
#include <Manager/ActionMgr.h>
|
#include <Manager/ActionMgr.h>
|
||||||
#include <Manager/PlayerMgr.h>
|
#include <Manager/PlayerMgr.h>
|
||||||
#include <Service.h>
|
#include <Service.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include <Territory/Territory.h>
|
||||||
#include <Territory/QuestBattle.h>
|
#include <Territory/QuestBattle.h>
|
||||||
#include <Territory/InstanceContent.h>
|
#include <Territory/InstanceContent.h>
|
||||||
#include <Util/UtilMath.h>
|
#include <Util/UtilMath.h>
|
||||||
|
@ -22,6 +25,8 @@
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
#include <Network/Util/PacketUtil.h>
|
#include <Network/Util/PacketUtil.h>
|
||||||
|
|
||||||
|
#include <Navi/NaviProvider.h>
|
||||||
|
|
||||||
namespace Sapphire::Encounter
|
namespace Sapphire::Encounter
|
||||||
{
|
{
|
||||||
const TimepointDataPtr Timepoint::getData() const
|
const TimepointDataPtr Timepoint::getData() const
|
||||||
|
@ -58,7 +63,7 @@ namespace Sapphire::Encounter
|
||||||
{ "idle", TimepointDataType::Idle },
|
{ "idle", TimepointDataType::Idle },
|
||||||
{ "castAction", TimepointDataType::CastAction },
|
{ "castAction", TimepointDataType::CastAction },
|
||||||
{ "setPos", TimepointDataType::SetPos },
|
{ "setPos", TimepointDataType::SetPos },
|
||||||
{ "playActionTimeLine", TimepointDataType::ActionTimeLine },
|
{ "actionTimeline", TimepointDataType::ActionTimeLine },
|
||||||
|
|
||||||
{ "logMessage", TimepointDataType::LogMessage },
|
{ "logMessage", TimepointDataType::LogMessage },
|
||||||
{ "battleTalk", TimepointDataType::BattleTalk },
|
{ "battleTalk", TimepointDataType::BattleTalk },
|
||||||
|
@ -156,7 +161,7 @@ namespace Sapphire::Encounter
|
||||||
case TimepointDataType::ActionTimeLine:
|
case TimepointDataType::ActionTimeLine:
|
||||||
{
|
{
|
||||||
auto& dataJ = json.at( "data" );
|
auto& dataJ = json.at( "data" );
|
||||||
auto action = dataJ.at( "action" ).get< uint32_t >();
|
auto action = dataJ.at( "actionTimelineId" ).get< uint32_t >();
|
||||||
auto actorRef = dataJ.at( "actorName" ).get< std::string >();
|
auto actorRef = dataJ.at( "actorName" ).get< std::string >();
|
||||||
|
|
||||||
m_pData = std::make_shared< TimepointDataActionTimeLine >( actorRef, action );
|
m_pData = std::make_shared< TimepointDataActionTimeLine >( actorRef, action );
|
||||||
|
@ -179,10 +184,11 @@ namespace Sapphire::Encounter
|
||||||
auto pBattleTalkData = std::make_shared< TimepointDataBattleTalk >( params );
|
auto pBattleTalkData = std::make_shared< TimepointDataBattleTalk >( params );
|
||||||
|
|
||||||
pBattleTalkData->m_battleTalkId = dataJ.at( "battleTalkId" ).get< uint32_t >();
|
pBattleTalkData->m_battleTalkId = dataJ.at( "battleTalkId" ).get< uint32_t >();
|
||||||
pBattleTalkData->m_handlerRef = dataJ.at( "handlerActorName" ).get< std::string >();
|
|
||||||
pBattleTalkData->m_kind = dataJ.at( "kind" ).get< uint32_t >();
|
pBattleTalkData->m_kind = dataJ.at( "kind" ).get< uint32_t >();
|
||||||
pBattleTalkData->m_nameId = dataJ.at( "nameId" ).get< uint32_t >();
|
pBattleTalkData->m_nameId = dataJ.at( "nameId" ).get< uint32_t >();
|
||||||
pBattleTalkData->m_talkerRef = dataJ.at( "talkerActorName" ).get< std::string >();
|
pBattleTalkData->m_talkerRef = dataJ.at( "talkerActorName" ).get< std::string >();
|
||||||
|
pBattleTalkData->m_handlerRef = pBattleTalkData->m_talkerRef;
|
||||||
|
|
||||||
m_pData = pBattleTalkData;
|
m_pData = pBattleTalkData;
|
||||||
}
|
}
|
||||||
|
@ -456,6 +462,16 @@ namespace Sapphire::Encounter
|
||||||
{
|
{
|
||||||
pBNpc->setRot( pSetPosData->m_rot );
|
pBNpc->setRot( pSetPosData->m_rot );
|
||||||
pBNpc->setPos( pSetPosData->m_x, pSetPosData->m_y, pSetPosData->m_z, true );
|
pBNpc->setPos( pSetPosData->m_x, pSetPosData->m_y, pSetPosData->m_z, true );
|
||||||
|
auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref();
|
||||||
|
auto pZone = teriMgr.getTerritoryByGuId( pBNpc->getTerritoryId() );
|
||||||
|
|
||||||
|
auto pNaviProvider = pZone->getNaviProvider();
|
||||||
|
|
||||||
|
if( pNaviProvider )
|
||||||
|
{
|
||||||
|
pNaviProvider->updateAgentPosition( *pBNpc );
|
||||||
|
}
|
||||||
|
pBNpc->sendPositionUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue