fix(DB/BlackTemple): Rework Black Temple (#18569)

* init

* more

* Update rev_1710358311839208100.sql
This commit is contained in:
Gultask
2024-03-18 18:31:05 -03:00
committed by GitHub
parent 3b2c3e59fd
commit b69df485cf
5 changed files with 4200 additions and 38 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
#include "Log.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"
#include "WaypointMgr.h"
FormationMgr::~FormationMgr()
{
@@ -290,41 +291,27 @@ void CreatureGroup::MemberEvaded(Creature* member)
Creature* pMember = itr.first;
// This should never happen
if (!pMember)
{
continue;
}
if (pMember == member || pMember->IsInEvadeMode() || !itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_MASK)))
{
continue;
}
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_EVADE_TOGETHER)))
{
if (!pMember->IsAlive() || !pMember->IsInCombat())
{
continue;
}
if (pMember->IsAIEnabled)
{
if (CreatureAI* pMemberAI = pMember->AI())
{
pMemberAI->EnterEvadeMode();
}
}
}
else
{
if (pMember->IsAlive())
{
continue;
}
if (itr.second.HasGroupFlag(std::underlying_type_t<GroupAIFlags>(GroupAIFlags::GROUP_AI_FLAG_DONT_RESPAWN_LEADER_ON_EVADE)) && pMember == m_leader)
{
continue;
}
pMember->Respawn();
}
@@ -334,9 +321,7 @@ void CreatureGroup::MemberEvaded(Creature* member)
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))))
{
return;
}
for (auto const& itr : m_members)
{
@@ -346,13 +331,10 @@ void CreatureGroup::FormationReset(bool dismiss, bool initMotionMaster)
if (initMotionMaster)
{
if (dismiss)
{
member->GetMotionMaster()->Initialize();
}
else
{
member->GetMotionMaster()->MoveIdle();
}
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;
}
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.
//! If the leader's path is known, member's path can be plotted as well using formation offsets.
if (!m_leader)
{
return;
}
float pathDist = m_leader->GetExactDist(x, y, z);
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;
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)))
{
continue;
}
// Xinef: If member is stunned / rooted etc don't allow to move him
if (member->HasUnitState(UNIT_STATE_NOT_MOVE))
{
continue;
}
// 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;
@@ -406,17 +382,22 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
Acore::NormalizeMapCoord(dx);
Acore::NormalizeMapCoord(dy);
member->UpdateGroundPositionZ(dx, dy, dz);
if (move_type < 2)
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
if (run && member->IsWalking())
{
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
}
else if (!run && !member->IsWalking())
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
switch (move_type)
{
case WAYPOINT_MOVE_TYPE_WALK:
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

View File

@@ -107,7 +107,7 @@ public:
void RemoveMember(Creature* member);
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);
Unit* GetNewTargetForMember(Creature* member);
void MemberEvaded(Creature* member);

View File

@@ -54,7 +54,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
init.SetWalk(true);
init.Launch();
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;
}
@@ -230,7 +230,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
//Call for creature group update
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<>

View File

@@ -200,7 +200,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
//Call for creature group update
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;
}