mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-07 05:33:51 +00:00
fix: face target before casting any targeted spell (not just melee)
Only melee abilities sent MSG_MOVE_SET_FACING before the cast packet. Ranged spells like Smite used whatever orientation was in movementInfo from the last movement, causing "target not in front" server rejection. Now sends a facing update toward the target entity before ANY targeted spell cast. The server checks a ~180° frontal arc for most spells.
This commit is contained in:
parent
c58537e2b8
commit
9cb6c596d5
1 changed files with 14 additions and 0 deletions
|
|
@ -300,6 +300,20 @@ void SpellHandler::castSpell(uint32_t spellId, uint64_t targetGuid) {
|
|||
}
|
||||
}
|
||||
|
||||
// Face the target before casting any targeted spell (server checks facing arc)
|
||||
if (target != 0) {
|
||||
auto entity = owner_.entityManager.getEntity(target);
|
||||
if (entity) {
|
||||
float dx = entity->getX() - owner_.movementInfo.x;
|
||||
float dy = entity->getY() - owner_.movementInfo.y;
|
||||
float lenSq = dx * dx + dy * dy;
|
||||
if (lenSq > 0.01f) {
|
||||
owner_.movementInfo.orientation = std::atan2(dy, dx);
|
||||
owner_.sendMovement(Opcode::MSG_MOVE_SET_FACING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto packet = owner_.packetParsers_
|
||||
? owner_.packetParsers_->buildCastSpell(spellId, target, ++castCount_)
|
||||
: CastSpellPacket::build(spellId, target, ++castCount_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue