diff options
Diffstat (limited to 'src')
20 files changed, 41 insertions, 34 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 14bc9ec4ec2..deb2774b232 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 426f9e88298..ba20bb68750 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2873,10 +2873,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); @@ -2922,7 +2922,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay) if (m_suppressedTarget) { 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 d4185b0b06d..4581037d87a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17242,8 +17242,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 (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && GetTransGUID()) @@ -17252,10 +17255,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 3f6ea205563..aa232577d3d 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1611,8 +1611,8 @@ class TC_GAME_API Unit : public WorldObject virtual bool SetHover(bool enable, bool packetOnly = false); 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 d2fce399ac0..113c403d9fb 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -470,7 +470,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 3886c50a9da..d376f6aa58f 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -200,7 +200,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 63a8e6783bf..fb0cf7e2e13 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 860ca08a3f3..2c8afa9c5ca 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -73,9 +73,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; @@ -85,7 +85,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 2b670b467e2..45f342fd878 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -219,7 +219,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 9f38b2aabf5..a0aba48b1c0 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, 3, 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/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index 43fb547a99f..92f6238099f 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -363,7 +363,7 @@ public: me->GetMotionMaster()->MoveIdle(); if (Creature* gryshka = ObjectAccessor::GetCreature(*me, gryshkaGUID)) { - me->SetFacingTo(me->GetAngle(gryshka->GetPositionX(), gryshka->GetPositionY())); + me->SetFacingToObject(gryshka); gryshka->AI()->Talk(SAY_GRYSHKA_1); } events.ScheduleEvent(EVENT_SCENE_2, 4500); @@ -631,7 +631,7 @@ public: if (Creature* jaina = me->SummonCreature(NPC_JAINA_PROUDMOORE, PortalSpawnPosition)) { - me->SetFacingTo(me->GetAngle(jaina->GetPositionX(), jaina->GetPositionY())); + me->SetFacingToObject(jaina); jainaGUID = jaina->GetGUID(); jaina->CastSpell(jaina, SPELL_JAINA_SPAWNIN); } @@ -689,7 +689,7 @@ public: case EVENT_HERALD_SCENE2: Talk(SAY_THRALL_1); if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) - me->SetFacingTo(me->GetAngle(jaina->GetPositionX(), jaina->GetPositionY())); + me->SetFacingToObject(jaina); events.ScheduleEvent(EVENT_HERALD_SCENE3, 3500); break; case EVENT_HERALD_SCENE3: 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 11e113ac95f..8998b77d8b5 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 c8060c2f11c..a2348119dff 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: @@ -723,7 +723,7 @@ class npc_spinestalker : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 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); } @@ -860,7 +860,7 @@ class npc_rimefang : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 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 07a57d9ce5e..b618cb9ce2d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -834,7 +834,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); @@ -849,7 +849,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 3aca037276e..0cd77a53f56 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 ed58d6542b9..4d4d7620b1c 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 4c8afb72886..aa230f3c31f 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 b5a4748d540..c22cd2d9ad7 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -174,7 +174,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 1a2eefbc453..347843ec7ff 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 d4e07baf8f0..9d9d985166e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -595,7 +595,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); |
