mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
implement whm lily
This commit is contained in:
parent
b59c96a5dd
commit
d3c656e8b8
4 changed files with 100 additions and 0 deletions
|
@ -587,6 +587,7 @@ namespace Sapphire::Common
|
|||
// AetherflowStack = 30,
|
||||
// Status = 32,
|
||||
PLDGauge = 41,
|
||||
WHMLily = 57,
|
||||
// RDMGaugeBoth = 74,
|
||||
//// RDMGaugeBlack = 75, // not right?
|
||||
// DRGGauge3Eyes = 76,
|
||||
|
|
|
@ -808,6 +808,31 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
|
|||
return false;
|
||||
}
|
||||
|
||||
case Common::ActionPrimaryCostType::WHMLily:
|
||||
{
|
||||
auto pPlayer = m_pSource->getAsPlayer();
|
||||
if( pPlayer )
|
||||
{
|
||||
auto lily = pPlayer->gaugeWhmGetLily();
|
||||
if( lily >= m_primaryCost )
|
||||
{
|
||||
if( subtractCosts )
|
||||
{
|
||||
lily -= m_primaryCost;
|
||||
auto bloodLily = pPlayer->gaugeWhmGetBloodLily();
|
||||
if( pPlayer->getLevel() >= 74 )
|
||||
{
|
||||
bloodLily = std::min( 3, bloodLily + m_primaryCost );
|
||||
}
|
||||
pPlayer->gaugeWhmSetLilies( lily, bloodLily );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// free casts, likely just pure ogcds
|
||||
case Common::ActionPrimaryCostType::None:
|
||||
{
|
||||
|
|
|
@ -1124,6 +1124,7 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
|||
if( !isAlive() )
|
||||
return;
|
||||
|
||||
int64_t interval = tickCount - m_lastUpdate;
|
||||
m_lastUpdate = tickCount;
|
||||
|
||||
if( !checkAction() )
|
||||
|
@ -1165,6 +1166,35 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
|||
}
|
||||
}
|
||||
|
||||
switch( getClass() )
|
||||
{
|
||||
case Common::ClassJob::Conjurer:
|
||||
case Common::ClassJob::Whitemage:
|
||||
{
|
||||
if( hasStateFlag( Common::PlayerStateFlag::InCombat ) )
|
||||
{
|
||||
if( gaugeWhmGetLily() < 3 )
|
||||
{
|
||||
auto lilyTimer = gaugeWhmGetLilyTimer();
|
||||
lilyTimer += interval;
|
||||
if( lilyTimer >= 30000 )
|
||||
{
|
||||
gaugeWhmSetLilyTimer( 0 ); // packet is sent together with following lily update
|
||||
gaugeWhmSetLilies( gaugeWhmGetLily() + 1, gaugeWhmGetBloodLily() );
|
||||
}
|
||||
else
|
||||
{
|
||||
gaugeWhmSetLilyTimer( lilyTimer ); // don't send any packet, the client increases the timer by itself
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gaugeWhmSetLilyTimer( 0 );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Chara::update( tickCount );
|
||||
}
|
||||
|
||||
|
@ -1464,13 +1494,17 @@ void Sapphire::Entity::Player::onMobAggro( BNpcPtr pBNpc )
|
|||
{
|
||||
hateListAdd( pBNpc );
|
||||
queuePacket( makeActorControl( getId(), ToggleAggro, 1 ) );
|
||||
setStateFlag( Common::PlayerStateFlag::InCombat );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::onMobDeaggro( BNpcPtr pBNpc )
|
||||
{
|
||||
hateListRemove( pBNpc );
|
||||
if( m_actorIdTohateSlotMap.empty() )
|
||||
{
|
||||
queuePacket( makeActorControl( getId(), ToggleAggro ) );
|
||||
unsetStateFlag( Common::PlayerStateFlag::InCombat );
|
||||
}
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::isLogin() const
|
||||
|
@ -2201,6 +2235,7 @@ void Sapphire::Entity::Player::sendActorGauge()
|
|||
|
||||
void Sapphire::Entity::Player::gaugeWarSetIb( uint8_t value )
|
||||
{
|
||||
assert( value >= 0 && value <= 100 );
|
||||
auto oldValue = gaugeWarGetIb();
|
||||
if( ( oldValue == 0 && value != 0 ) ||
|
||||
( oldValue != 0 && value == 0 ) )
|
||||
|
@ -2224,6 +2259,7 @@ uint8_t Sapphire::Entity::Player::gaugeWarGetIb()
|
|||
|
||||
void Sapphire::Entity::Player::gaugePldSetOath( uint8_t value )
|
||||
{
|
||||
assert( value >= 0 && value <= 100 );
|
||||
auto oldValue = gaugePldGetOath();
|
||||
m_gauge.pld.oathGauge = value;
|
||||
if( oldValue != value )
|
||||
|
@ -2233,4 +2269,36 @@ void Sapphire::Entity::Player::gaugePldSetOath( uint8_t value )
|
|||
uint8_t Sapphire::Entity::Player::gaugePldGetOath()
|
||||
{
|
||||
return m_gauge.pld.oathGauge;
|
||||
}
|
||||
|
||||
uint8_t Sapphire::Entity::Player::gaugeWhmGetLily()
|
||||
{
|
||||
return m_gauge.whm.lilies;
|
||||
}
|
||||
|
||||
uint8_t Sapphire::Entity::Player::gaugeWhmGetBloodLily()
|
||||
{
|
||||
return m_gauge.whm.bloodLilies;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::gaugeWhmSetLilies( uint8_t liles, uint8_t bloodLilies )
|
||||
{
|
||||
assert( liles >= 0 && liles <= 3 );
|
||||
assert( bloodLilies >= 0 && bloodLilies <= 3 );
|
||||
m_gauge.whm.lilies = liles;
|
||||
m_gauge.whm.bloodLilies = bloodLilies;
|
||||
sendActorGauge();
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::gaugeWhmSetLilyTimer( uint16_t value, bool sendPacket )
|
||||
{
|
||||
assert( value >= 0 && value <= 30000 );
|
||||
m_gauge.whm.lilyTimer = value;
|
||||
if( sendPacket )
|
||||
sendActorGauge();
|
||||
}
|
||||
|
||||
uint16_t Sapphire::Entity::Player::gaugeWhmGetLilyTimer()
|
||||
{
|
||||
return m_gauge.whm.lilyTimer;
|
||||
}
|
|
@ -982,6 +982,12 @@ namespace Sapphire::Entity
|
|||
void gaugePldSetOath( uint8_t value );
|
||||
uint8_t gaugePldGetOath();
|
||||
|
||||
uint8_t gaugeWhmGetLily();
|
||||
uint8_t gaugeWhmGetBloodLily();
|
||||
void gaugeWhmSetLilies( uint8_t liles, uint8_t bloodLilies );
|
||||
void gaugeWhmSetLilyTimer( uint16_t value, bool sendPacket = false );
|
||||
uint16_t gaugeWhmGetLilyTimer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Common::HuntingLogEntry& getHuntingLogEntry( uint8_t index );
|
||||
|
|
Loading…
Add table
Reference in a new issue