mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: show stat gains in level-up toast from SMSG_LEVELUP_INFO
Parse hp/mana/str/agi/sta/int/spi deltas from SMSG_LEVELUP_INFO payload and display them in green below the "You have reached level X!" banner. Extends DING_DURATION to 4s to give players time to read the gains.
This commit is contained in:
parent
6df8c72cf7
commit
6957ba97ea
4 changed files with 80 additions and 9 deletions
|
|
@ -1438,6 +1438,14 @@ public:
|
|||
using LevelUpCallback = std::function<void(uint32_t newLevel)>;
|
||||
void setLevelUpCallback(LevelUpCallback cb) { levelUpCallback_ = std::move(cb); }
|
||||
|
||||
// Stat deltas from the last SMSG_LEVELUP_INFO (valid until next level-up)
|
||||
struct LevelUpDeltas {
|
||||
uint32_t hp = 0;
|
||||
uint32_t mana = 0;
|
||||
uint32_t str = 0, agi = 0, sta = 0, intel = 0, spi = 0;
|
||||
};
|
||||
const LevelUpDeltas& getLastLevelUpDeltas() const { return lastLevelUpDeltas_; }
|
||||
|
||||
// Other player level-up callback — fires when another player gains a level
|
||||
using OtherPlayerLevelUpCallback = std::function<void(uint64_t guid, uint32_t newLevel)>;
|
||||
void setOtherPlayerLevelUpCallback(OtherPlayerLevelUpCallback cb) { otherPlayerLevelUpCallback_ = std::move(cb); }
|
||||
|
|
@ -2793,6 +2801,7 @@ private:
|
|||
NpcVendorCallback npcVendorCallback_;
|
||||
ChargeCallback chargeCallback_;
|
||||
LevelUpCallback levelUpCallback_;
|
||||
LevelUpDeltas lastLevelUpDeltas_;
|
||||
OtherPlayerLevelUpCallback otherPlayerLevelUpCallback_;
|
||||
AchievementEarnedCallback achievementEarnedCallback_;
|
||||
AreaDiscoveryCallback areaDiscoveryCallback_;
|
||||
|
|
|
|||
|
|
@ -511,9 +511,12 @@ private:
|
|||
bool leftClickWasPress_ = false;
|
||||
|
||||
// Level-up ding animation
|
||||
static constexpr float DING_DURATION = 3.0f;
|
||||
static constexpr float DING_DURATION = 4.0f;
|
||||
float dingTimer_ = 0.0f;
|
||||
uint32_t dingLevel_ = 0;
|
||||
uint32_t dingHpDelta_ = 0;
|
||||
uint32_t dingManaDelta_ = 0;
|
||||
uint32_t dingStats_[5] = {}; // str/agi/sta/int/spi deltas
|
||||
void renderDingEffect();
|
||||
|
||||
// Achievement toast banner
|
||||
|
|
@ -616,7 +619,9 @@ private:
|
|||
size_t dpsLogSeenCount_ = 0; // log entries already scanned
|
||||
|
||||
public:
|
||||
void triggerDing(uint32_t newLevel);
|
||||
void triggerDing(uint32_t newLevel, uint32_t hpDelta = 0, uint32_t manaDelta = 0,
|
||||
uint32_t str = 0, uint32_t agi = 0, uint32_t sta = 0,
|
||||
uint32_t intel = 0, uint32_t spi = 0);
|
||||
void triggerAchievementToast(uint32_t achievementId, std::string name = {});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue