aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CreatureAI.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp6
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp11
-rw-r--r--src/server/game/Entities/Unit/Unit.h4
-rw-r--r--src/server/game/Movement/MotionMaster.cpp2
-rw-r--r--src/server/game/Movement/MotionMaster.h2
-rw-r--r--src/server/game/Scripting/ScriptSystem.cpp6
-rw-r--r--src/server/game/Scripting/ScriptSystem.h6
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp2
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp2
19 files changed, 38 insertions, 31 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 4520aa197fb..ecba6c9abe2 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -162,7 +162,7 @@ void CreatureAI::TriggerAlert(Unit const* who) const
me->SendAIReaction(AI_REACTION_ALERT);
// Face the unit (stealthed player) and set distracted state for 5 seconds
- me->SetFacingTo(me->GetAngle(who->GetPositionX(), who->GetPositionY()));
+ me->SetFacingTo(me->GetAngle(who->GetPositionX(), who->GetPositionY()), true);
me->StopMoving();
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS);
}
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 958d97e785e..cbb026fb665 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2800,10 +2800,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
bool canTurnDuringCast = !focusSpell->GetSpellInfo()->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)
- SetFacingTo(GetAngle(target));
+ SetFacingToObject(target);
else if (!canTurnDuringCast)
if (Unit* victim = GetVictim())
- SetFacingTo(GetAngle(victim)); // ensure orientation is correct at beginning of cast
+ SetFacingToObject(victim); // ensure orientation is correct at beginning of cast
if (!canTurnDuringCast)
AddUnitState(UNIT_STATE_CANNOT_TURN);
@@ -2849,7 +2849,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay)
if (!m_suppressedTarget.IsEmpty())
{
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget))
- SetFacingTo(GetAngle(objTarget));
+ SetFacingToObject(objTarget);
}
else
SetFacingTo(m_suppressedOrientation);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index bd104032a10..6ea885e8d78 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -15271,8 +15271,11 @@ void Unit::SetInFront(WorldObject const* target)
SetOrientation(GetAngle(target));
}
-void Unit::SetFacingTo(float ori)
+void Unit::SetFacingTo(float ori, bool force)
{
+ if (!force && !IsStopped())
+ return;
+
Movement::MoveSplineInit init(this);
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false);
if (GetTransport())
@@ -15281,10 +15284,10 @@ void Unit::SetFacingTo(float ori)
init.Launch();
}
-void Unit::SetFacingToObject(WorldObject const* object)
+void Unit::SetFacingToObject(WorldObject const* object, bool force)
{
- // never face when already moving
- if (!IsStopped())
+ // do not face when already moving
+ if (!force && !IsStopped())
return;
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 054db0ef5eb..0337939cdbe 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1711,8 +1711,8 @@ class TC_GAME_API Unit : public WorldObject
void SendSetVehicleRecId(uint32 vehicleId);
void SetInFront(WorldObject const* target);
- void SetFacingTo(float ori);
- void SetFacingToObject(WorldObject const* object);
+ void SetFacingTo(float ori, bool force = false);
+ void SetFacingToObject(WorldObject const* object, bool force = false);
void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference);
void SendClearThreatListOpcode();
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 79d7c1026d4..898e4841559 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -481,7 +481,7 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, Movement::PointsArray const& p
//MovePoint(EVENT_CHARGE_PREPATH, pos, false);
}
-void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint32 dbChainId, bool walk)
+void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk)
{
Creature* owner = _owner->ToCreature();
if (!owner)
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index a36fab0e735..2dbc5c8f49e 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -210,7 +210,7 @@ class TC_GAME_API MotionMaster //: private std::stack<MovementGenerator *>
void MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk);
void MoveSmoothPath(uint32 pointId, Movement::PointsArray const& points, bool walk);
// Walk along spline chain stored in DB (script_spline_chain_meta and script_spline_chain_waypoints)
- void MoveAlongSplineChain(uint32 pointId, uint32 dbChainId, bool walk);
+ void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk);
void MoveAlongSplineChain(uint32 pointId, SplineChain const& chain, bool walk);
void ResumeSplineChain(SplineChainResumeInfo const& info);
void MoveFall(uint32 id = 0);
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 6cae097c8c4..3e67a44384c 100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -106,7 +106,8 @@ void SystemMgr::LoadScriptSplineChains()
{
Field* fieldsMeta = resultMeta->Fetch();
uint32 entry = fieldsMeta[0].GetUInt32();
- uint8 chainId = fieldsMeta[1].GetUInt8(), splineId = fieldsMeta[2].GetUInt8();
+ uint16 chainId = fieldsMeta[1].GetUInt16();
+ uint8 splineId = fieldsMeta[2].GetUInt8();
SplineChain& chain = m_mSplineChainsMap[{entry,chainId}];
if (splineId != chain.size())
@@ -127,7 +128,8 @@ void SystemMgr::LoadScriptSplineChains()
{
Field* fieldsWP = resultWP->Fetch();
uint32 entry = fieldsWP[0].GetUInt32();
- uint8 chainId = fieldsWP[1].GetUInt8(), splineId = fieldsWP[2].GetUInt8(), wpId = fieldsWP[3].GetUInt8();
+ uint16 chainId = fieldsWP[1].GetUInt16();
+ uint8 splineId = fieldsWP[2].GetUInt8(), wpId = fieldsWP[3].GetUInt8();
float posX = fieldsWP[4].GetFloat(), posY = fieldsWP[5].GetFloat(), posZ = fieldsWP[6].GetFloat();
auto it = m_mSplineChainsMap.find({entry,chainId});
if (it == m_mSplineChainsMap.end())
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index 6086b10e2be..7bce7b2e69e 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -87,9 +87,9 @@ class TC_GAME_API SystemMgr
return &itr->second;
}
- SplineChain const* GetSplineChain(uint32 entry, uint8 id) const
+ SplineChain const* GetSplineChain(uint32 entry, uint16 chainId) const
{
- auto it = m_mSplineChainsMap.find({ entry, id });
+ auto it = m_mSplineChainsMap.find({ entry, chainId });
if (it == m_mSplineChainsMap.end())
return nullptr;
return &it->second;
@@ -99,7 +99,7 @@ class TC_GAME_API SystemMgr
protected:
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
- typedef std::pair<uint32, uint8> ChainKeyType; // creature entry + chain ID
+ typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
std::unordered_map<ChainKeyType, SplineChain> m_mSplineChainsMap; // spline chains
};
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index 6996cfdb71c..bccaf0e5246 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -220,7 +220,7 @@ public:
{
case 4:
SetEscortPaused(true);
- me->SetFacingTo(1.775791f);
+ me->SetFacingTo(1.775791f, true);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Talk(SAY_MORRIDUNE_2);
break;
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index d25585c6174..6f6660219b1 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -246,7 +246,7 @@ public:
me->SetCanFly(true);
me->SetDisableGravity(true);
me->SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
- me->SetFacingTo(me->GetOrientation() + float(M_PI));
+ me->SetFacingTo(me->GetOrientation() + float(M_PI), true);
if (Creature * trigger = me->SummonCreature(NPC_TRIGGER, MiddleRoomLocation, TEMPSUMMON_CORPSE_DESPAWN))
triggerGUID = trigger->GetGUID();
me->GetMotionMaster()->MoveTakeoff(11, Phase2Floating);
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
index 979a1e21fe0..b7eeca93801 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp
@@ -306,7 +306,7 @@ class boss_devourer_of_souls : public CreatureScript
case EVENT_WAILING_SOULS_TICK:
beamAngle += beamAngleDiff;
- me->SetFacingTo(beamAngle);
+ me->SetFacingTo(beamAngle, true);
me->StopMoving();
DoCast(me, SPELL_WAILING_SOULS);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index d990bd4335b..6dca64500d3 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -361,12 +361,12 @@ class boss_sindragosa : public CreatureScript
break;
case POINT_AIR_PHASE:
me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 5, 2, 6), NULL, TRIGGERED_FULL_MASK);
- me->SetFacingTo(float(M_PI));
+ me->SetFacingTo(float(M_PI), true);
events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 1);
events.ScheduleEvent(EVENT_FROST_BOMB, 9000);
break;
case POINT_AIR_PHASE_FAR:
- me->SetFacingTo(float(M_PI));
+ me->SetFacingTo(float(M_PI), true);
events.ScheduleEvent(EVENT_LAND, 30000);
break;
case POINT_LAND:
@@ -722,7 +722,7 @@ class npc_spinestalker : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetHomePosition(SpinestalkerLandPos);
- me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
+ me->SetFacingTo(SpinestalkerLandPos.GetOrientation(), true);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
}
@@ -859,7 +859,7 @@ class npc_rimefang : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetHomePosition(RimefangLandPos);
- me->SetFacingTo(RimefangLandPos.GetOrientation());
+ me->SetFacingTo(RimefangLandPos.GetOrientation(), true);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetReactState(REACT_AGGRESSIVE);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
index e03c8d6205b..2449a14ece8 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -813,7 +813,7 @@ class boss_the_lich_king : public CreatureScript
events.ScheduleEvent(EVENT_INTRO_TALK_1, 9000, 0, PHASE_INTRO);
break;
case POINT_CENTER_1:
- me->SetFacingTo(0.0f);
+ me->SetFacingTo(0.0f, true);
Talk(SAY_LK_REMORSELESS_WINTER);
me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL);
DoCast(me, SPELL_REMORSELESS_WINTER_1);
@@ -828,7 +828,7 @@ class boss_the_lich_king : public CreatureScript
events.ScheduleEvent(EVENT_SOUL_REAPER, 94000, 0, PHASE_TWO);
break;
case POINT_CENTER_2:
- me->SetFacingTo(0.0f);
+ me->SetFacingTo(0.0f, true);
Talk(SAY_LK_REMORSELESS_WINTER);
me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL);
DoCast(me, SPELL_REMORSELESS_WINTER_2);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 5d69d29bacd..e4286c030e4 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -437,7 +437,7 @@ class boss_algalon_the_observer : public CreatureScript
me->SetDisableGravity(false);
else if (pointId == POINT_ALGALON_OUTRO)
{
- me->SetFacingTo(1.605703f);
+ me->SetFacingTo(1.605703f, true);
events.ScheduleEvent(EVENT_OUTRO_3, 1200);
events.ScheduleEvent(EVENT_OUTRO_4, 2400);
events.ScheduleEvent(EVENT_OUTRO_5, 8500);
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 1bc7223f08e..2ece5ec85b7 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -75,7 +75,7 @@ class boss_erekem : public CreatureScript
void MovementInform(uint32 type, uint32 pointId) override
{
if (type == EFFECT_MOTION_TYPE && pointId == POINT_INTRO)
- me->SetFacingTo(4.921828f);
+ me->SetFacingTo(4.921828f, true);
}
void JustReachedHome() override
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index 57527f27c14..b2061ea6369 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -430,6 +430,8 @@ class npc_sinclari_vh : public CreatureScript
me->GetCreatureListWithEntryInGrid(guardList, NPC_VIOLET_HOLD_GUARD, 100.0f);
for (Creature* guard : guardList)
{
+ if (!guard->IsAlive())
+ continue;
guard->SetReactState(REACT_PASSIVE);
guard->SetWalk(false);
guard->GetMotionMaster()->MovePoint(0, GuardsMovePosition);
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index 02b9533bbfe..bac80342e74 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -173,7 +173,7 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
{
if (id == 1)
{
- me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation());
+ me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation(), true);
TurnAudience();
switch (talkWing)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index 9077a992e80..e2fee8d3b73 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -444,7 +444,7 @@ public:
else if (pointId == AKAMA_INTRO_WAYPOINT)
{
me->SetWalk(false);
- me->SetFacingTo(0.08726646f);
+ me->SetFacingTo(0.08726646f, true);
_events.ScheduleEvent(EVENT_START_SOUL_EXPEL, Seconds(1));
}
}
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index e635c63ac20..191634739d4 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -594,7 +594,7 @@ class boss_kaelthas : public CreatureScript
events.ScheduleEvent(EVENT_TRANSITION_1, 1000);
break;
case POINT_TRANSITION_CENTER_ASCENDING:
- me->SetFacingTo(float(M_PI));
+ me->SetFacingTo(float(M_PI), true);
Talk(SAY_PHASE5_NUTS);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetDisableGravity(true);