mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 20:27:46 +00:00
refreshed status keeps its old last tick time
This commit is contained in:
parent
271edea8ec
commit
5b05900455
3 changed files with 13 additions and 5 deletions
|
@ -148,12 +148,14 @@ void EffectResult::execute()
|
||||||
|
|
||||||
case Common::ActionEffectType::ApplyStatusEffect:
|
case Common::ActionEffectType::ApplyStatusEffect:
|
||||||
{
|
{
|
||||||
|
uint64_t lastTickOverride = 0;
|
||||||
//remove same effect from the same source (refreshing old buff)
|
//remove same effect from the same source (refreshing old buff)
|
||||||
for( auto const& entry : m_target->getStatusEffectMap() )
|
for( auto const& entry : m_target->getStatusEffectMap() )
|
||||||
{
|
{
|
||||||
auto statusEffect = entry.second;
|
auto statusEffect = entry.second;
|
||||||
if( statusEffect->getId() == m_value && statusEffect->getSrcActorId() == m_source->getId() )
|
if( statusEffect->getId() == m_value && statusEffect->getSrcActorId() == m_source->getId() )
|
||||||
{
|
{
|
||||||
|
lastTickOverride = statusEffect->getLastTickMs();
|
||||||
// refreshing does not show "-status" flying text, and we don't send status list now because we are adding a new one
|
// refreshing does not show "-status" flying text, and we don't send status list now because we are adding a new one
|
||||||
m_target->removeStatusEffect( entry.first, false, false );
|
m_target->removeStatusEffect( entry.first, false, false );
|
||||||
break;
|
break;
|
||||||
|
@ -161,9 +163,13 @@ void EffectResult::execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pPreBuiltStatusEffect )
|
if( m_pPreBuiltStatusEffect )
|
||||||
|
{
|
||||||
|
m_pPreBuiltStatusEffect->setLastTick( lastTickOverride );
|
||||||
m_target->addStatusEffect( m_pPreBuiltStatusEffect );
|
m_target->addStatusEffect( m_pPreBuiltStatusEffect );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_target->addStatusEffectById( m_value, m_value2, *m_source, m_param2 );
|
m_target->addStatusEffectById( m_value, m_value2, *m_source, m_param2, lastTickOverride );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,20 +536,22 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
||||||
sendStatusEffectUpdate(); // although client buff displays correctly without this but retail sends it so we do it as well
|
sendStatusEffectUpdate(); // although client buff displays correctly without this but retail sends it so we do it as well
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
|
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, uint64_t lastTickOverride )
|
||||||
{
|
{
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
|
effect->setLastTick( lastTickOverride );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
|
void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param, uint64_t lastTickOverride )
|
||||||
{
|
{
|
||||||
if( getStatusEffectById( id ).second )
|
if( getStatusEffectById( id ).second )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
|
effect->setLastTick( lastTickOverride );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,10 +174,10 @@ namespace Sapphire::Entity
|
||||||
const uint32_t* getModelArray() const;
|
const uint32_t* getModelArray() const;
|
||||||
|
|
||||||
// add a status effect by id
|
// add a status effect by id
|
||||||
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
|
void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, uint64_t lastTickOverride = 0 );
|
||||||
|
|
||||||
// add a status effect by id if it doesn't exist
|
// add a status effect by id if it doesn't exist
|
||||||
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 );
|
void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0, uint64_t lastTickOverride = 0 );
|
||||||
|
|
||||||
/// End Status Effect Functions
|
/// End Status Effect Functions
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue