diff --git a/src/world/Encounter/EncounterTimeline.cpp b/src/world/Encounter/EncounterTimeline.cpp index 106b6e75..ed896e18 100644 --- a/src/world/Encounter/EncounterTimeline.cpp +++ b/src/world/Encounter/EncounterTimeline.cpp @@ -591,7 +591,7 @@ namespace Sapphire } } - EncounterTimeline::TimelinePack EncounterTimeline::buildEncounterTimeline( uint32_t encounterId, bool reload ) + EncounterTimeline::TimelinePack EncounterTimeline::getEncounterPack( uint32_t encounterId, bool reload ) { static std::map< uint32_t, TimelinePack > cache = {}; const static std::unordered_map< std::string, ConditionId > conditionIdMap = @@ -757,6 +757,16 @@ namespace Sapphire throw std::runtime_error( fmt::format( std::string( "EncounterTimeline::buildEncounterTimeline - no state found by name: %s" ), phaseRef ) ); } } + + for( const auto& actor : actorNameMap ) + pack.addTimelineActor( actor.second ); + + std::string name( "Encounter" ); + name += std::to_string( encounterId ); + + pack.setName( name ); + + // todo: reload will probably kill the server when CastAction.callbacks are added if( reload ) cache[ encounterId ] = pack; else diff --git a/src/world/Encounter/EncounterTimeline.h b/src/world/Encounter/EncounterTimeline.h index 5f6273b5..968d0012 100644 --- a/src/world/Encounter/EncounterTimeline.h +++ b/src/world/Encounter/EncounterTimeline.h @@ -532,6 +532,17 @@ namespace Sapphire uint32_t m_hp{ 0 }; std::string m_name; + TimelineActor() { } + TimelineActor( const TimelineActor& rhs ) : + m_layoutId( rhs.m_layoutId ), + m_hp( rhs.m_hp ), + m_name( rhs.m_name ), + m_phaseConditions( rhs.m_phaseConditions ), + m_conditionStates( rhs.m_conditionStates ) + { + + } + void addPhaseCondition( PhaseConditionPtr pCondition ) { m_phaseConditions.push_back( pCondition ); @@ -579,8 +590,26 @@ namespace Sapphire uint64_t m_startTime{ 0 }; public: TimelinePack() { } + TimelinePack( const TimelinePack& rhs ) : + m_type( rhs.m_type ), + m_name( rhs.m_name ), + m_actors( rhs.m_actors ), + m_startTime( 0 ) + { + + } TimelinePack( TimelinePackType type ) : m_type( type ) {} + void setName( const std::string& name ) + { + m_name = name; + } + + void addTimelineActor(const TimelineActor& actor) + { + m_actors.push_back( actor ); + } + void setStartTime( uint64_t time ) { m_startTime = time; @@ -669,6 +698,6 @@ namespace Sapphire public: - TimelinePack buildEncounterTimeline( uint32_t encounterId, bool reload = false ); + TimelinePack getEncounterPack( uint32_t encounterId, bool reload = false ); }; }// namespace Sapphire \ No newline at end of file