Skip to content

Fix/login enchant and aura durations - #587

Merged
Xian55 merged 6 commits into
Xian55:masterfrom
vdeschuy:fix/login-enchant-and-aura-durations
Nov 5, 2026
Merged

Xian55 merged 6 commits into
Xian55:masterfrom
vdeschuy:fix/login-enchant-and-aura-durations

Conversation

@vdeschuy

@vdeschuy vdeschuy commented Nov 5, 2026

Copy link
Copy Markdown

Keep temporary enchant and buff timers across login

Problem

After logging in, a rogue's poisons (and a shaman's weapon imbues, oils, sharpening stones, etc.) are still on the weapon and still work, but the buff-bar icon shows 0s left. The same can happen to timed buffs when the character logs in with one active. Reapplying the poison or buff fixes the timer until the next login.

Reproduced on a CMaNGOS TBC server with a 2.5.3 client. The same ordering exists in Classic Era, and the enchant half is client-version independent.

Cause

Both are login-ordering problems in the proxy. The legacy server sends the data correctly; the proxy delivers it before the modern client has the object it belongs to.

Temporary weapon enchants

CMaNGOS sends SMSG_ITEM_ENCHANT_TIME_UPDATE immediately after adding the player to the map. HermesProxy holds the player's SMSG_UPDATE_OBJECT create while it resolves item templates, so the client receives the timer before it has the item and drops it. The item still carries the enchantment, which is why the poison is present with no timer.

ItemTimeUpdate already waits for the player create for exactly this reason:

// At login a server sends this ahead of the player, whose items come with it.
public override bool NeedsObject(WowGuid128 guid) => true;

ItemEnchantTimeUpdate was missing the same guard.

Timed auras

The login create carries the player's aura fields, but SMSG_UPDATE_AURA_DURATION / SMSG_SET_EXTRA_AURA_INFO arrive just after it. The proxy parses the create before those durations are stored, so the aura updates built from it have no duration. The later duration updates are sent before the client has the player object and are dropped, and the held create then sends the stale, duration-less aura list.

The existing post-create SMSG_AURA_UPDATE_ALL workaround is gated to the 3.4.3+ clients, so 1.14 and 2.5.3 never got the durations back.

Fix

  1. ItemEnchantTimeUpdate now waits for the player's create, so every temporary weapon enchant timer lands after the item exists.
  2. Aura lists built from a batch now re-read the proxy's tracked durations just before they are sent. The login create is normally flushed by QueryHandler.FlushDeferredUpdate, not the inline update path, so both now go through the same SendAuraUpdates helper. This covers the held login create and any other batch whose duration packets arrived after the fields were read.

No wire-format changes. Both fixes only affect when a packet is sent, or which already-known duration is put into it.

Testing

  • dotnet test: 4726 passed, 37 skipped, 0 failed
  • dotnet build -c Release: 0 warnings, 0 errors
  • New tests:
    • ItemEnchantTimeUpdateTests: legacy handler, NeedsObject, packet fields, and a login timer held until the player create.
    • AuraDurationRefreshTests: a timed aura picks up the tracked duration; a permanent aura keeps no duration; the shared send path refreshes before sending.

Manual reproduction:

  1. Log out with poison on both weapons and a timed buff active.
  2. Log in.
  3. Before: poison and buff icons show 0s. After: both show their real remaining time.
  4. Reapply either one while in the world; both should keep showing the correct timer.

Files

  • HermesProxy/World/Server/Packets/ItemPackets.cs
  • HermesProxy/World/AuraDurationRefresh.cs
  • HermesProxy/World/Client/PacketHandlers/UpdateHandler.cs
  • HermesProxy/World/Client/PacketHandlers/QueryHandler.cs
  • HermesProxy.Tests/World/Client/ItemEnchantTimeUpdateTests.cs
  • HermesProxy.Tests/World/Client/AuraDurationRefreshTests.cs

vdeschuy and others added 6 commits November 5, 2026 19:26
CMaNGOS sends SMSG_ITEM_ENCHANT_TIME_UPDATE at login before the player create the items travel in. HermesProxy defers that create while it resolves item templates, so the modern client got the timer first and dropped it: a poison or imbue stayed on the weapon but the buff bar showed no time left.

ItemTimeUpdate already waits for the player's create for exactly this reason; ItemEnchantTimeUpdate did not. Give it the same guard so every temporary weapon enchant timer survives login.
The login create carries the player's aura fields, but the duration packets arrive after it. The create is held while item templates are resolved, so the aura updates built from it predate the durations, and the later duration updates are sent before the client has the player.

Re-read the tracked durations before the held batch goes out. Timed buffs then show their real time left on the first frame instead of 0s. This is the aura path, separate from the temporary weapon enchant timer.
The login create is usually flushed by QueryHandler.FlushDeferredUpdate, not by UpdateHandler.SendUpdateBatch. That path still sent the aura list built before the duration packets arrived, so a buff consumed around login (for example Scroll of Agility II) showed no timer until a later resync.

Route both paths through SendAuraUpdates so the duration refresh cannot be missed, and cover the call with a test.
SendAuraUpdates took IEnumerable<AuraUpdate>, so its foreach boxed the
List<T> enumerator on every update batch that carries an aura change,
inline and deferred alike: 40 bytes each. Both callers already pass a
List<AuraUpdate>, and taking one keeps the struct enumerator. A warm call
now allocates only what sending its packets does (48 bytes for one update,
88 before), which the new test pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refresh fell back to the full duration when the time left had run
out on the proxy's clock, so an aura whose tracked duration had expired
went out with a new full timer. The update-field reader only gives a
timer when both the time left and the full duration are positive; the
two now share one helper, so they cannot disagree again.

ExpiresAt is dropped from the refresh: it is read only for the auras of
SMSG_AURA_UPDATE (3.3.5a, 4.3.4), never for those read from update fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An update batch that is not held is read and sent in one handler call,
so no duration packet can arrive in between and the refresh found
nothing new: it only repeated the lookups the update-field reader had
just made, on every batch with an aura change. SendUpdateBatch sends its
aura list as before, and the refresh runs for the batch held for item
templates, from FlushDeferredUpdate, as SendHeldAuraUpdates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Xian55

Xian55 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Verified on cMaNGOS TBC with a 2.5.3 client (rogue, Minor Wizard Oil on the main hand, Power Word: Fortitude), logging in through a freshly started proxy so the login create is held for item templates:

Weapon enchant Timed buff
master on the weapon, 0 s left shown, no duration
this PR 1788.9 s left 1789.8 s left

The capture agrees. cMaNGOS sends SMSG_ITEM_ENCHANT_TIME_UPDATE three times at login. On master all three went out before the held SMSG_UPDATE_OBJECT that creates the player and its items, so the client dropped them; with the NeedsObject hold they follow it. The aura list sent behind that create now carries Duration/Remaining (53 → 61 bytes). A relog through the same proxy, which takes the unheld path, keeps both timers as well.

Three commits on top:

  • 7fedd4e SendAuraUpdates took IEnumerable<AuraUpdate>, so its foreach boxed the list's enumerator: 88 B per call instead of the 48 B the packet itself costs. It takes List<AuraUpdate> now, and a test pins that it allocates nothing beyond its packets.
  • 3c8fd4f The refresh fell back to the full duration once the tracked time had run out, so an expired aura went out with a fresh full timer. The refresh and the update-field reader now share one helper with the reader's rule (left > 0 && full > 0), plus a test for the expired case. ExpiresAt is no longer set there: it is only read for SMSG_AURA_UPDATE auras (3.3.5a, 4.3.4).
  • 159748a A batch that is not held is read and sent in one handler call, so the refresh had nothing to pick up there and only repeated lookups on every batch with an aura change. It now runs for the held batch only (SendHeldAuraUpdates, from FlushDeferredUpdate), and SendUpdateBatch sends its aura list as master does.

dotnet test: 4731 passed, 0 failed. The new tests fail with the fixes taken out.

@Xian55 Xian55 added bugfix A fix has been proposed or merged for this reported bug ai Artificial Intelligence contribution tbc The Burning Crusade Expansion cmangos cmangos server labels Nov 5, 2026
@Xian55
Xian55 merged commit 6020f0c into Xian55:master Nov 5, 2026
@Xian55

Xian55 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Merged, thank you @vdeschuy! A clear report with the cause already pinned down (the login ordering, and ItemTimeUpdate as the model for the enchant half) made this quick to confirm, and rogues and shamans get their timers back after login. Much appreciated, and thanks again for #577 too.

@vdeschuy
vdeschuy deleted the fix/login-enchant-and-aura-durations branch November 5, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Artificial Intelligence contribution bugfix A fix has been proposed or merged for this reported bug cmangos cmangos server tbc The Burning Crusade Expansion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants