From a2fd6eda58f2757835ad3de62f10cc949528735b Mon Sep 17 00:00:00 2001 From: collett Date: Thu, 9 Apr 2020 04:44:29 +0900 Subject: [PATCH] prep for gnb implementation --- src/common/Common.h | 1 + src/world/Action/Action.cpp | 17 +++++++++++++++++ src/world/Actor/Player.cpp | 16 +++++++++++++++- src/world/Actor/Player.h | 3 +++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/common/Common.h b/src/common/Common.h index 839b5421..b38b0d07 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -587,6 +587,7 @@ namespace Sapphire::Common // AetherflowStack = 30, // Status = 32, PLDGauge = 41, + GNBAmmo = 55, WHMBloodLily = 56, WHMLily = 57, // RDMGaugeBoth = 74, diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 8d2ee2f6..1095dcc8 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -947,6 +947,23 @@ bool Action::Action::primaryCostCheck( bool subtractCosts ) return false; } + case Common::ActionPrimaryCostType::GNBAmmo: + { + auto pPlayer = m_pSource->getAsPlayer(); + if( pPlayer ) + { + auto ammo = pPlayer->gaugeGnbGetAmmo(); + if( ammo >= m_primaryCost ) + { + if( subtractCosts ) + pPlayer->gaugeGnbSetAmmo( ammo - m_primaryCost ); + + return true; + } + } + return false; + } + // free casts, likely just pure ogcds case Common::ActionPrimaryCostType::None: { diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 653f61d0..339fef51 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -2419,4 +2419,18 @@ void Sapphire::Entity::Player::gaugeDrkSetShadowTimer( uint16_t value, bool send uint16_t Sapphire::Entity::Player::gaugeDrkGetShadowTimer() { return m_gauge.drk.shadowTimer; -} \ No newline at end of file +} + +void Sapphire::Entity::Player::gaugeGnbSetAmmo( uint8_t value ) +{ + assert( value >= 0 && value <= 2 ); + auto oldValue = gaugeGnbGetAmmo(); + m_gauge.gnb.ammo = value; + if( oldValue != value ) + sendActorGauge(); +} + +uint8_t Sapphire::Entity::Player::gaugeGnbGetAmmo() +{ + return m_gauge.gnb.ammo; +} diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 71d27e8b..c459f80d 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -1001,6 +1001,9 @@ namespace Sapphire::Entity void gaugeDrkSetShadowTimer( uint16_t value, bool sendPacket = false ); uint16_t gaugeDrkGetShadowTimer(); + void gaugeGnbSetAmmo( uint8_t value ); + uint8_t gaugeGnbGetAmmo(); + ////////////////////////////////////////////////////////////////////////////////////////////////////// Common::HuntingLogEntry& getHuntingLogEntry( uint8_t index );