Core/Spells: Launch cast time trajectory spells with the client's final aim - #32039
Open
ayoub-khemissi wants to merge 1 commit into
Open
ayoub-khemissi wants to merge 1 commit into
ayoub-khemissi wants to merge 1 commit into
Conversation
…al aim The client sends CMSG_UPDATE_MISSILE_TRAJECTORY with its final aim (impact point, pitch, speed) when its own cast bar ends and expects the missile only then. The spell launched on the server timer, before that packet arrived, so the missile kept the aim of the cast start and the caster's client drew it towards (0, 0, 0) (Plague Barrel of Wintergrasp Catapult). Such spells now wait up to 1 second for that packet after their cast time, then launch as soon as it arrives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GCPYbmr5ZSurtKRpog1xuZ
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.
Changes proposed:
For a trajectory spell with a cast time, the client sends its final aim (
CMSG_UPDATE_MISSILE_TRAJECTORY: fire position, impact point, pitch, speed,moveStop) when its own cast bar ends, and expects the missile only then.Spell::update()launched the spell as soon as the server timer reached 0, a few milliseconds (the latency) before that packet arrived. As a result:HandleUpdateMissileTrajectorydropped it.SMSG_SPELL_GOfor a missile it had not aimed yet, and drew it towards (0, 0, 0). In Wintergrasp that is always south-east and downward, through the ground. Other players see it correctly.The case where this shows is the Plague Barrel (57606) of the Wintergrasp Catapult, the only Wintergrasp siege weapon with a cast time (1.5 s). The demolisher's boulder and the cannons are instant and were already fine.
With this change, such a spell (cast by a client, with a cast time and a trajectory) waits up to 1 second after its cast time for
CMSG_UPDATE_MISSILE_TRAJECTORY, then launches as soon as the packet arrives. The added delay is only the client-to-server latency.Issues addressed:
No TrinityCore issue that I could find. AzerothCore has the same code and reports for the same bug:
Tests performed:
Tested in game on a server based on TrinityCore 3.3.5 (same
Spell::updateandHandleUpdateMissileTrajectorycode), with a Wintergrasp Catapult:CMSG_UPDATE_MISSILE_TRAJECTORYwas ever processed. The barrel visual flew towards (0, 0, 0) for the driver, and the impact stayed on the aim of the cast start.CMSG_UPDATE_MISSILE_TRAJECTORY(moveStop1) arrives at the end of every cast. The barrel flies to the reticle and lands there, including when the vehicle turns or changes pitch during the cast.This exact patch was not compiled on the current 3.3.5 HEAD. The same change builds and runs on our fork.
These packet changes were tried first and did not fix the visual:
CAST_FLAG_ADJUST_MISSILEadded to SMSG_SPELL_START or removed from SMSG_SPELL_GO;SMSG_SET_PROJECTILE_POSITIONsent with the impact point.Known issues and TODO list:
Spell::SelectImplicitTrajTargets()still uses the caster's orientation for the trajectory direction, both forsrcPosand for the shortened impact point when a unit is hit first. The direction from the source to the destination the client sent may be more accurate. That is left out of this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01GCPYbmr5ZSurtKRpog1xuZ