mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: track and visualize global cooldown (GCD) on action bar
- GameHandler tracks GCD in gcdTotal_/gcdStartedAt_ (time-based) - SMSG_SPELL_COOLDOWN: spellId=0 entries (<=2s) are treated as GCD - castSpell(): optimistically starts 1.5s GCD client-side on cast - Action bar: non-cooldown slots show subtle dark sweep + dim tint during the GCD window, matching WoW standard behavior
This commit is contained in:
parent
61c0b91e39
commit
b6a43d6ce7
3 changed files with 58 additions and 0 deletions
|
|
@ -743,6 +743,17 @@ public:
|
|||
float getGameTime() const { return gameTime_; }
|
||||
float getTimeSpeed() const { return timeSpeed_; }
|
||||
|
||||
// Global Cooldown (GCD) — set when the server sends a spellId=0 cooldown entry
|
||||
float getGCDRemaining() const {
|
||||
if (gcdTotal_ <= 0.0f) return 0.0f;
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - gcdStartedAt_).count() / 1000.0f;
|
||||
float rem = gcdTotal_ - elapsed;
|
||||
return rem > 0.0f ? rem : 0.0f;
|
||||
}
|
||||
float getGCDTotal() const { return gcdTotal_; }
|
||||
bool isGCDActive() const { return getGCDRemaining() > 0.0f; }
|
||||
|
||||
// Weather state (updated by SMSG_WEATHER)
|
||||
// weatherType: 0=clear, 1=rain, 2=snow, 3=storm/fog
|
||||
uint32_t getWeatherType() const { return weatherType_; }
|
||||
|
|
@ -2559,6 +2570,10 @@ private:
|
|||
float timeSpeed_ = 0.0166f; // Time scale (default: 1 game day = 1 real hour)
|
||||
void handleLoginSetTimeSpeed(network::Packet& packet);
|
||||
|
||||
// ---- Global Cooldown (GCD) ----
|
||||
float gcdTotal_ = 0.0f;
|
||||
std::chrono::steady_clock::time_point gcdStartedAt_{};
|
||||
|
||||
// ---- Weather state (SMSG_WEATHER) ----
|
||||
uint32_t weatherType_ = 0; // 0=clear, 1=rain, 2=snow, 3=storm
|
||||
float weatherIntensity_ = 0.0f; // 0.0 to 1.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue