Repository navigation
Fix/login enchant and aura durations - #587
Merged
Xian55 merged 6 commits intoNov 5, 2026
Merged
Conversation
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>
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:
The capture agrees. cMaNGOS sends Three commits on top:
|
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
0sleft. 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_UPDATEimmediately after adding the player to the map. HermesProxy holds the player'sSMSG_UPDATE_OBJECTcreate 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.ItemTimeUpdatealready waits for the player create for exactly this reason:ItemEnchantTimeUpdatewas missing the same guard.Timed auras
The login create carries the player's aura fields, but
SMSG_UPDATE_AURA_DURATION/SMSG_SET_EXTRA_AURA_INFOarrive 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_ALLworkaround is gated to the 3.4.3+ clients, so 1.14 and 2.5.3 never got the durations back.Fix
ItemEnchantTimeUpdatenow waits for the player's create, so every temporary weapon enchant timer lands after the item exists.QueryHandler.FlushDeferredUpdate, not the inline update path, so both now go through the sameSendAuraUpdateshelper. 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 faileddotnet build -c Release: 0 warnings, 0 errorsItemEnchantTimeUpdateTests: 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:
0s. After: both show their real remaining time.Files
HermesProxy/World/Server/Packets/ItemPackets.csHermesProxy/World/AuraDurationRefresh.csHermesProxy/World/Client/PacketHandlers/UpdateHandler.csHermesProxy/World/Client/PacketHandlers/QueryHandler.csHermesProxy.Tests/World/Client/ItemEnchantTimeUpdateTests.csHermesProxy.Tests/World/Client/AuraDurationRefreshTests.cs