diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-01-10 00:07:37 +0100 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2018-01-10 00:19:00 +0100 |
| commit | d9c772303cc17d98581cc52bb51116f640e23c08 (patch) | |
| tree | e210bc4c527731af373ef5c1da842af9554d04e5 | |
| parent | b53cbf467b445a9b57a5567f88a26f77289f7fe1 (diff) | |
Core/Unit: Abide UNIT_FLAG2_DISABLE_TURN on creatures. Add that flag to Kologarn (from sniff). Hi sirikfoll.
| -rw-r--r-- | sql/updates/world/3.3.5/2018_01_10_00_world.sql | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 36 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 4 |
3 files changed, 26 insertions, 16 deletions
diff --git a/sql/updates/world/3.3.5/2018_01_10_00_world.sql b/sql/updates/world/3.3.5/2018_01_10_00_world.sql new file mode 100644 index 00000000000..275dbe01224 --- /dev/null +++ b/sql/updates/world/3.3.5/2018_01_10_00_world.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `unit_flags2` = `unit_flags2`|0x8000 WHERE `entry`=32930; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 573f90f2c07..dd41cf1d681 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -723,13 +723,17 @@ void Creature::Update(uint32 diff) if (m_shouldReacquireTarget && !IsFocusing(nullptr, true)) { SetTarget(m_suppressedTarget); - if (m_suppressedTarget) + + if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) { - if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) - SetFacingToObject(objTarget, false); + if (m_suppressedTarget) + { + if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget)) + SetFacingToObject(objTarget, false); + } + else + SetFacingTo(m_suppressedOrientation, false); } - else - SetFacingTo(m_suppressedOrientation, false); m_shouldReacquireTarget = false; } @@ -3122,15 +3126,19 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) } } - bool const canTurnDuringCast = !spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); - // Face the target - we need to do this before the unit state is modified for no-turn spells - if (target) - SetFacingToObject(target, false); - else if (!canTurnDuringCast) - if (Unit* victim = GetVictim()) - SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast + bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); + + if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) + { + // Face the target - we need to do this before the unit state is modified for no-turn spells + if (target) + SetFacingToObject(target, false); + else if (noTurnDuringCast) + if (Unit* victim = GetVictim()) + SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast + } - if (!canTurnDuringCast) + if (noTurnDuringCast) AddUnitState(UNIT_STATE_CANNOT_TURN); } @@ -3168,7 +3176,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) if (focusSpell && focusSpell != m_focusSpell) return; - if (IsPet()) // player pets do not use delay system + if (IsPet() && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) // player pets do not use delay system { SetGuidValue(UNIT_FIELD_TARGET, m_suppressedTarget); if (m_suppressedTarget) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9f37e5b6496..86df2a6d13d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1957,7 +1957,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr if (attType != BASE_ATTACK && attType != OFF_ATTACK) return; // ignore ranged case - if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) // melee attack spell cast at main hand attack only - no normal melee dmg dealt @@ -2005,7 +2005,7 @@ void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BA if (attType != BASE_ATTACK && attType != OFF_ATTACK) return; // ignore ranged case - if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) CalcDamageInfo damageInfo; |
