mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Fix buff bar: opcode merge, isBuff flag, and duration countdown
Root cause: OpcodeTable::loadFromJson() cleared all mappings before loading the expansion JSON, so any WotLK opcode absent from Turtle WoW's opcodes.json (including SMSG_AURA_UPDATE and SMSG_AURA_UPDATE_ALL) was permanently lost. Changed loadFromJson to patch/merge on top of existing defaults so only explicitly listed opcodes are overridden. Also fix isBuff border color: was testing flag 0x02 (effect 2 active) instead of 0x80 (negative/debuff flag). Add client-side duration countdown: AuraSlot.receivedAtMs is stamped when the packet arrives; getRemainingMs(nowMs) subtracts elapsed time so buff tooltips show accurate remaining duration instead of stale snapshot.
This commit is contained in:
parent
df0bfaea4f
commit
55fd692c1a
4 changed files with 32 additions and 9 deletions
|
|
@ -18,8 +18,16 @@ struct AuraSlot {
|
|||
int32_t durationMs = -1;
|
||||
int32_t maxDurationMs = -1;
|
||||
uint64_t casterGuid = 0;
|
||||
uint64_t receivedAtMs = 0; // Client timestamp (ms) when durationMs was set
|
||||
|
||||
bool isEmpty() const { return spellId == 0; }
|
||||
// Remaining duration in ms, counting down from when the packet was received
|
||||
int32_t getRemainingMs(uint64_t nowMs) const {
|
||||
if (durationMs < 0) return -1;
|
||||
uint64_t elapsed = (nowMs > receivedAtMs) ? (nowMs - receivedAtMs) : 0;
|
||||
int32_t remaining = durationMs - static_cast<int32_t>(elapsed);
|
||||
return (remaining > 0) ? remaining : 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue