mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 15:17:46 +00:00
wip: encounter timeline actually populate the entry before adding to cache
This commit is contained in:
parent
43f9254086
commit
cf712cb3c8
2 changed files with 41 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Add table
Reference in a new issue