diff options
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 32 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 32 | ||||
-rwxr-xr-x | src/server/game/Miscellaneous/SharedDefines.h | 2 | ||||
-rwxr-xr-x | src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp | 1 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 7 |
5 files changed, 41 insertions, 33 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d0eda0dc99f..ed3f3bf3827 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -267,7 +267,6 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject) m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); _focusSpell = NULL; - _targetLocked = false; _lastLiquid = NULL; _isWalkingBeforeCharm = false; } @@ -423,6 +422,9 @@ void Unit::UpdateSplineMovement(uint32 t_diff) transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation); } + if (HasUnitState(UNIT_STATE_CANNOT_TURN)) + loc.orientation = GetOrientation(); + UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); } } @@ -17731,3 +17733,31 @@ void Unit::SendMovementCanFlyChange() BuildMovementPacket(&data); SendMessageToSet(&data, false); } + +void Unit::FocusTarget(Spell const* focusSpell, uint64 target) +{ + // already focused + if (_focusSpell) + return; + + _focusSpell = focusSpell; + SetUInt64Value(UNIT_FIELD_TARGET, target); + if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) + AddUnitState(UNIT_STATE_ROTATING); +} + +void Unit::ReleaseFocus(Spell const* focusSpell) +{ + // focused to something else + if (focusSpell != _focusSpell) + return; + + _focusSpell = NULL; + if (Unit* victim = getVictim()) + SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + else + SetUInt64Value(UNIT_FIELD_TARGET, 0); + + if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) + ClearUnitState(UNIT_STATE_ROTATING); +} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 03d5b6d194a..8eb822831aa 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2207,34 +2207,13 @@ class Unit : public WorldObject void SetTarget(uint64 guid) { - if (!_targetLocked) + if (!_focusSpell) SetUInt64Value(UNIT_FIELD_TARGET, guid); } - void FocusTarget(Spell const* focusSpell, uint64 target) - { - // already focused - if (_focusSpell) - return; - - _focusSpell = focusSpell; - _targetLocked = true; - SetUInt64Value(UNIT_FIELD_TARGET, target); - } - - void ReleaseFocus(Spell const* focusSpell) - { - // focused to something else - if (focusSpell != _focusSpell) - return; - - _focusSpell = NULL; - _targetLocked = false; - if (Unit* victim = getVictim()) - SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); - else - SetUInt64Value(UNIT_FIELD_TARGET, 0); - } + // Handling caster facing during spellcast + void FocusTarget(Spell const* focusSpell, uint64 target); + void ReleaseFocus(Spell const* focusSpell); // Movement info Movement::MoveSpline * movespline; @@ -2358,8 +2337,7 @@ class Unit : public WorldObject bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world - Spell const* _focusSpell; - bool _targetLocked; // locks the target during spell cast for proper facing + Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing bool _isWalkingBeforeCharm; // Are we walking before we were charmed? }; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index e7f50e2a609..4f6ad917423 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -465,7 +465,7 @@ enum SpellAttr5 SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused - SPELL_ATTR5_UNK19 = 0x00080000, // 19 + SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET) SPELL_ATTR5_UNK20 = 0x00100000, // 20 SPELL_ATTR5_UNK21 = 0x00200000, // 21 SPELL_ATTR5_UNK22 = 0x00400000, // 22 diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index fdff5a92564..2cd3d745750 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -89,6 +89,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner) Movement::MoveSplineInit init(owner); init.MoveTo(x,y,z); + init.SetFacing(i_target.getTarget()); init.SetWalk(((D*)this)->EnableWalking()); init.Launch(); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 98aa0e03512..bac8d2fe4eb 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3069,10 +3069,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered SendSpellStart(); // set target for proper facing - if (m_casttime && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)) - if (uint64 target = m_targets.GetUnitTargetGUID()) - if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT) - m_caster->FocusTarget(this, target); + if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)) + if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT) + m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID()); if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) TriggerGlobalCooldown(); |