mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(DB/BlackTemple): Rework Black Temple (#18569)
* init * more * Update rev_1710358311839208100.sql
This commit is contained in:
4181
data/sql/updates/pending_db_world/rev_1710358311839208100.sql
Normal file
4181
data/sql/updates/pending_db_world/rev_1710358311839208100.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
|
#include "WaypointMgr.h"
|
||||||
|
|
||||||
FormationMgr::~FormationMgr()
|
FormationMgr::~FormationMgr()
|
||||||
{
|
{
|
||||||
@@ -290,41 +291,27 @@ void CreatureGroup::MemberEvaded(Creature* member)
|
|||||||
Creature* pMember = itr.first;
|
Creature* pMember = itr.first;
|
||||||
// This should never happen
|
// This should never happen
|
||||||
if (!pMember)
|
if (!pMember)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (pMember == member || pMember->IsInEvadeMode() || !itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_MASK)))
|
if (pMember == member || pMember->IsInEvadeMode() || !itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_MASK)))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_TOGETHER)))
|
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_TOGETHER)))
|
||||||
{
|
{
|
||||||
if (!pMember->IsAlive() || !pMember->IsInCombat())
|
if (!pMember->IsAlive() || !pMember->IsInCombat())
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (pMember->IsAIEnabled)
|
if (pMember->IsAIEnabled)
|
||||||
{
|
|
||||||
if (CreatureAI* pMemberAI = pMember->AI())
|
if (CreatureAI* pMemberAI = pMember->AI())
|
||||||
{
|
|
||||||
pMemberAI->EnterEvadeMode();
|
pMemberAI->EnterEvadeMode();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pMember->IsAlive())
|
if (pMember->IsAlive())
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_DONT_RESPAWN_LEADER_ON_EVADE)) && pMember == m_leader)
|
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_DONT_RESPAWN_LEADER_ON_EVADE)) && pMember == m_leader)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
pMember->Respawn();
|
pMember->Respawn();
|
||||||
}
|
}
|
||||||
@@ -334,9 +321,7 @@ void CreatureGroup::MemberEvaded(Creature* member)
|
|||||||
void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
|
void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
|
||||||
{
|
{
|
||||||
if (m_members.size() && !(m_members.begin()->second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_FOLLOW_LEADER))))
|
if (m_members.size() && !(m_members.begin()->second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_FOLLOW_LEADER))))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const& itr : m_members)
|
for (auto const& itr : m_members)
|
||||||
{
|
{
|
||||||
@@ -346,13 +331,10 @@ void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
|
|||||||
if (initMotionMaster)
|
if (initMotionMaster)
|
||||||
{
|
{
|
||||||
if (dismiss)
|
if (dismiss)
|
||||||
{
|
|
||||||
member->GetMotionMaster()->Initialize();
|
member->GetMotionMaster()->Initialize();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
member->GetMotionMaster()->MoveIdle();
|
member->GetMotionMaster()->MoveIdle();
|
||||||
}
|
|
||||||
LOG_DEBUG("entities.unit", "Set {} movement for member {}", dismiss ? "default" : "idle", member->GetGUID().ToString());
|
LOG_DEBUG("entities.unit", "Set {} movement for member {}", dismiss ? "default" : "idle", member->GetGUID().ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,14 +342,12 @@ void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
|
|||||||
m_Formed = !dismiss;
|
m_Formed = !dismiss;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
|
void CreatureGroup::LeaderMoveTo(float x, float y, float z, uint32 move_type)
|
||||||
{
|
{
|
||||||
//! To do: This should probably get its own movement generator or use WaypointMovementGenerator.
|
//! To do: This should probably get its own movement generator or use WaypointMovementGenerator.
|
||||||
//! If the leader's path is known, member's path can be plotted as well using formation offsets.
|
//! If the leader's path is known, member's path can be plotted as well using formation offsets.
|
||||||
if (!m_leader)
|
if (!m_leader)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
float pathDist = m_leader->GetExactDist(x, y, z);
|
float pathDist = m_leader->GetExactDist(x, y, z);
|
||||||
float pathAngle = std::atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
|
float pathAngle = std::atan2(m_leader->GetPositionY() - y, m_leader->GetPositionX() - x);
|
||||||
@@ -377,15 +357,11 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
|
|||||||
Creature* member = itr.first;
|
Creature* member = itr.first;
|
||||||
FormationInfo const& pFormationInfo = itr.second;
|
FormationInfo const& pFormationInfo = itr.second;
|
||||||
if (member == m_leader || !member->IsAlive() || member->GetVictim() || !pFormationInfo.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_FOLLOW_LEADER)))
|
if (member == m_leader || !member->IsAlive() || member->GetVictim() || !pFormationInfo.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_FOLLOW_LEADER)))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// Xinef: If member is stunned / rooted etc don't allow to move him
|
// Xinef: If member is stunned / rooted etc don't allow to move him
|
||||||
if (member->HasUnitState(UNIT_STATE_NOT_MOVE))
|
if (member->HasUnitState(UNIT_STATE_NOT_MOVE))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// Xinef: this should be automatized, if turn angle is greater than PI/2 (90<39>) we should swap formation angle
|
// Xinef: this should be automatized, if turn angle is greater than PI/2 (90<39>) we should swap formation angle
|
||||||
float followAngle = pFormationInfo.follow_angle;
|
float followAngle = pFormationInfo.follow_angle;
|
||||||
@@ -406,17 +382,22 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
|
|||||||
|
|
||||||
Acore::NormalizeMapCoord(dx);
|
Acore::NormalizeMapCoord(dx);
|
||||||
Acore::NormalizeMapCoord(dy);
|
Acore::NormalizeMapCoord(dy);
|
||||||
|
if (move_type < 2)
|
||||||
member->UpdateGroundPositionZ(dx, dy, dz);
|
member->UpdateGroundPositionZ(dx, dy, dz);
|
||||||
|
|
||||||
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
|
|
||||||
// pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function
|
// pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function
|
||||||
if (run && member->IsWalking())
|
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
|
||||||
{
|
switch (move_type)
|
||||||
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
|
||||||
}
|
|
||||||
else if (!run && !member->IsWalking())
|
|
||||||
{
|
{
|
||||||
|
case WAYPOINT_MOVE_TYPE_WALK:
|
||||||
member->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
member->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
|
break;
|
||||||
|
case WAYPOINT_MOVE_TYPE_RUN:
|
||||||
|
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
|
break;
|
||||||
|
case WAYPOINT_MOVE_TYPE_LAND:
|
||||||
|
member->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// xinef: if we move members to position without taking care of sizes, we should compare distance without sizes
|
// xinef: if we move members to position without taking care of sizes, we should compare distance without sizes
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
void RemoveMember(Creature* member);
|
void RemoveMember(Creature* member);
|
||||||
void FormationReset(bool dismiss, bool initMotionMaster);
|
void FormationReset(bool dismiss, bool initMotionMaster);
|
||||||
|
|
||||||
void LeaderMoveTo(float x, float y, float z, bool run);
|
void LeaderMoveTo(float x, float y, float z, uint32 move_type);
|
||||||
void MemberEngagingTarget(Creature* member, Unit* target);
|
void MemberEngagingTarget(Creature* member, Unit* target);
|
||||||
Unit* GetNewTargetForMember(Creature* member);
|
Unit* GetNewTargetForMember(Creature* member);
|
||||||
void MemberEvaded(Creature* member);
|
void MemberEvaded(Creature* member);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
|||||||
init.SetWalk(true);
|
init.SetWalk(true);
|
||||||
init.Launch();
|
init.Launch();
|
||||||
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
||||||
creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), false);
|
creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
|||||||
|
|
||||||
//Call for creature group update
|
//Call for creature group update
|
||||||
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
||||||
creature->GetFormation()->LeaderMoveTo(finalPoint.x, finalPoint.y, finalPoint.z, false);
|
creature->GetFormation()->LeaderMoveTo(finalPoint.x, finalPoint.y, finalPoint.z, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
|||||||
|
|
||||||
//Call for creature group update
|
//Call for creature group update
|
||||||
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature)
|
||||||
creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node->move_type == WAYPOINT_MOVE_TYPE_RUN);
|
creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node->move_type);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user