mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 23:38:54 -04:00
Core/Position: Refactor GetAngle -> GetAbsoluteAngle because code clarity is good.
(cherry picked from commit 4692e10ca2)
This commit is contained in:
@@ -162,7 +162,7 @@ void CreatureAI::TriggerAlert(Unit const* who) const
|
||||
// Face the unit (stealthed player) and set distracted state for 5 seconds
|
||||
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS);
|
||||
me->StopMoving();
|
||||
me->SetFacingTo(me->GetAngle(who));
|
||||
me->SetFacingTo(me->GetAbsoluteAngle(who));
|
||||
}
|
||||
|
||||
void CreatureAI::EnterEvadeMode(EvadeReason why)
|
||||
|
||||
@@ -1278,7 +1278,7 @@ void SimpleCharmedPlayerAI::UpdateAI(const uint32 diff)
|
||||
|
||||
if (me->IsStopped() && !me->HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
{
|
||||
float targetAngle = me->GetAngle(target);
|
||||
float targetAngle = me->GetAbsoluteAngle(target);
|
||||
if (_forceFacing || fabs(me->GetOrientation() - targetAngle) > 0.4f)
|
||||
{
|
||||
me->SetFacingTo(targetAngle);
|
||||
|
||||
@@ -910,7 +910,7 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff)
|
||||
if (GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_FACE_MOVEMENT_DIR))
|
||||
{
|
||||
G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1);
|
||||
orientation = GetAngle(nextPoint.x, nextPoint.y);
|
||||
orientation = GetAbsoluteAngle(nextPoint.x, nextPoint.y);
|
||||
}
|
||||
|
||||
GetMap()->AreaTriggerRelocation(this, currentPosition.x, currentPosition.y, currentPosition.z, orientation);
|
||||
|
||||
@@ -1102,7 +1102,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const
|
||||
G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
|
||||
G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(GetPosition()), GetCombatReach());
|
||||
|
||||
return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAngle(contactPoint.x, contactPoint.y));
|
||||
return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAbsoluteAngle(contactPoint.x, contactPoint.y));
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinLOS(float ox, float oy, float oz, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
|
||||
@@ -1259,7 +1259,7 @@ bool WorldObject::IsInBetween(Position const& pos1, Position const& pos2, float
|
||||
if (!size)
|
||||
size = GetCombatReach() / 2;
|
||||
|
||||
float angle = pos1.GetAngle(pos2);
|
||||
float angle = pos1.GetAbsoluteAngle(pos2);
|
||||
|
||||
// not using sqrt() for performance
|
||||
return (size * size) >= GetExactDist2dSq(pos1.GetPositionX() + std::cos(angle) * dist, pos1.GetPositionY() + std::sin(angle) * dist);
|
||||
@@ -3047,7 +3047,7 @@ Position WorldObject::GetRandomNearPosition(float radius)
|
||||
void WorldObject::GetContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d /*= CONTACT_DISTANCE*/) const
|
||||
{
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2d, GetAngle(obj));
|
||||
GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2d, GetAbsoluteAngle(obj));
|
||||
}
|
||||
|
||||
void WorldObject::MovePosition(Position &pos, float dist, float angle)
|
||||
|
||||
@@ -115,7 +115,7 @@ bool Position::IsWithinDoubleVerticalCylinder(Position const* center, float radi
|
||||
return IsInDist2d(center, radius) && std::abs(verticalDelta) <= height;
|
||||
}
|
||||
|
||||
bool Position::HasInArc(float arc, Position const* obj, float border, Optional<float> orientation) const
|
||||
bool Position::HasInArc(float arc, Position const* obj, float border) const
|
||||
{
|
||||
// always have self in arc
|
||||
if (obj == this)
|
||||
@@ -124,11 +124,8 @@ bool Position::HasInArc(float arc, Position const* obj, float border, Optional<f
|
||||
// move arc to range 0.. 2*pi
|
||||
arc = NormalizeOrientation(arc);
|
||||
|
||||
float angle = GetAngle(obj);
|
||||
angle -= orientation.is_initialized() ? *orientation : GetOrientation();
|
||||
|
||||
// move angle to range -pi ... +pi
|
||||
angle = NormalizeOrientation(angle);
|
||||
float angle = GetRelativeAngle(obj);
|
||||
if (angle > float(M_PI))
|
||||
angle -= 2.0f * float(M_PI);
|
||||
|
||||
@@ -137,13 +134,13 @@ bool Position::HasInArc(float arc, Position const* obj, float border, Optional<f
|
||||
return ((angle >= lborder) && (angle <= rborder));
|
||||
}
|
||||
|
||||
bool Position::HasInLine(Position const* pos, float objSize, float width, Optional<float> orientation) const
|
||||
bool Position::HasInLine(Position const* pos, float objSize, float width) const
|
||||
{
|
||||
if (!HasInArc(float(M_PI), pos, 2.0f, orientation))
|
||||
if (!HasInArc(float(M_PI), pos, 2.0f))
|
||||
return false;
|
||||
|
||||
width += objSize;
|
||||
float angle = GetAngle(pos) - (orientation.is_initialized() ? *orientation : GetOrientation());
|
||||
float angle = GetRelativeAngle(pos);
|
||||
return std::fabs(std::sin(angle)) * GetExactDist2d(pos->GetPositionX(), pos->GetPositionY()) < width;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define Trinity_game_Position_h__
|
||||
|
||||
#include "Define.h"
|
||||
#include "Optional.h"
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
@@ -124,19 +123,20 @@ public:
|
||||
void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const;
|
||||
Position GetPositionWithOffset(Position const& offset) const;
|
||||
|
||||
float GetAngle(float x, float y) const
|
||||
float GetAbsoluteAngle(float x, float y) const
|
||||
{
|
||||
float dx = m_positionX - x;
|
||||
float dy = m_positionY - y;
|
||||
return NormalizeOrientation(std::atan2(dy, dx));
|
||||
}
|
||||
float GetAngle(Position const& pos) const { return GetAngle(pos.m_positionX, pos.m_positionY); }
|
||||
float GetAngle(Position const* pos) const { return GetAngle(*pos); }
|
||||
float GetAbsoluteAngle(Position const& pos) const { return GetAbsoluteAngle(pos.m_positionX, pos.m_positionY); }
|
||||
float GetAbsoluteAngle(Position const* pos) const { return GetAbsoluteAngle(*pos); }
|
||||
float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
|
||||
float GetAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
float GetRelativeAngle(float absAngle) const { return NormalizeOrientation(absAngle - m_orientation); }
|
||||
float GetRelativeAngle(float x, float y) const { return GetRelativeAngle(GetAngle(x, y)); }
|
||||
float GetRelativeAngle(Position const* pos) const { return GetRelativeAngle(GetAngle(pos)); }
|
||||
float ToRelativeAngle(float absAngle) const { return NormalizeOrientation(absAngle - m_orientation); }
|
||||
float GetRelativeAngle(float x, float y) const { return ToRelativeAngle(GetAbsoluteAngle(x, y)); }
|
||||
float GetRelativeAngle(Position const& pos) const { return ToRelativeAngle(GetAbsoluteAngle(pos)); }
|
||||
float GetRelativeAngle(Position const* pos) const { return ToRelativeAngle(GetAbsoluteAngle(pos)); }
|
||||
|
||||
void GetSinCos(float x, float y, float &vsin, float &vcos) const;
|
||||
|
||||
@@ -152,8 +152,8 @@ public:
|
||||
// dist2d < radius && abs(dz) < height
|
||||
bool IsWithinDoubleVerticalCylinder(Position const* center, float radius, float height) const;
|
||||
|
||||
bool HasInArc(float arcangle, Position const* pos, float border = 2.0f, Optional<float> orientation = {}) const;
|
||||
bool HasInLine(Position const* pos, float objSize, float width, Optional<float> orientation = {}) const;
|
||||
bool HasInArc(float arcangle, Position const* pos, float border = 2.0f) const;
|
||||
bool HasInLine(Position const* pos, float objSize, float width) const;
|
||||
std::string ToString() const;
|
||||
|
||||
// constrain arbitrary radian orientation to interval [0,2*PI)
|
||||
|
||||
@@ -121,7 +121,7 @@ void CinematicMgr::UpdateCinematicLocation(uint32 /*diff*/)
|
||||
lastPosition.Relocate(cam.locations);
|
||||
lastTimestamp = cam.timeStamp;
|
||||
}
|
||||
float angle = lastPosition.GetAngle(&nextPosition);
|
||||
float angle = lastPosition.GetAbsoluteAngle(&nextPosition);
|
||||
angle -= lastPosition.GetOrientation();
|
||||
if (angle < 0)
|
||||
angle += 2 * float(M_PI);
|
||||
|
||||
@@ -590,19 +590,6 @@ bool Unit::IsWithinBoundaryRadius(const Unit* obj) const
|
||||
return IsInDist(obj, objBoundaryRadius);
|
||||
}
|
||||
|
||||
void Unit::GetRandomContactPoint(Unit const* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
|
||||
{
|
||||
float combat_reach = GetCombatReach();
|
||||
if (combat_reach < 0.1f) // sometimes bugged for players
|
||||
combat_reach = DEFAULT_PLAYER_COMBAT_REACH;
|
||||
|
||||
uint32 attacker_number = uint32(getAttackers().size());
|
||||
if (attacker_number > 0)
|
||||
--attacker_number;
|
||||
GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin) * (float)rand_norm(),
|
||||
GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI/2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
|
||||
}
|
||||
|
||||
void Unit::SetVisibleAura(AuraApplication* aurApp)
|
||||
{
|
||||
m_visibleAuras.insert(aurApp);
|
||||
@@ -11727,7 +11714,7 @@ void Unit::JumpTo(WorldObject* obj, float speedZ, bool withOrientation)
|
||||
float x, y, z;
|
||||
obj->GetContactPoint(this, x, y, z);
|
||||
float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
|
||||
GetMotionMaster()->MoveJump(x, y, z, GetAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation);
|
||||
GetMotionMaster()->MoveJump(x, y, z, GetAbsoluteAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation);
|
||||
}
|
||||
|
||||
void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
|
||||
@@ -12302,7 +12289,7 @@ bool CharmInfo::IsReturning()
|
||||
void Unit::SetInFront(WorldObject const* target)
|
||||
{
|
||||
if (!HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
SetOrientation(GetAngle(target));
|
||||
SetOrientation(GetAbsoluteAngle(target));
|
||||
}
|
||||
|
||||
void Unit::SetFacingTo(float ori, bool force)
|
||||
@@ -12328,7 +12315,7 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force)
|
||||
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
|
||||
init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
|
||||
init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
|
||||
@@ -797,7 +797,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
float GetMeleeRange(Unit const* target) const;
|
||||
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK) const = 0;
|
||||
bool IsWithinBoundaryRadius(const Unit* obj) const;
|
||||
void GetRandomContactPoint(Unit const* target, float& x, float& y, float& z, float distance2dMin, float distance2dMax) const;
|
||||
uint32 m_extraAttacks;
|
||||
bool m_canDualWield;
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance)
|
||||
float distanceToTravel = _owner->GetExactDist2d(target) - distance;
|
||||
if (distanceToTravel > 0.0f)
|
||||
{
|
||||
float angle = _owner->GetAngle(target);
|
||||
float angle = _owner->GetAbsoluteAngle(target);
|
||||
float destx = _owner->GetPositionX() + distanceToTravel * std::cos(angle);
|
||||
float desty = _owner->GetPositionY() + distanceToTravel * std::sin(angle);
|
||||
MovePoint(id, destx, desty, target->GetPositionZ());
|
||||
@@ -432,7 +432,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
|
||||
float dist = 2 * moveTimeHalf * speedXY;
|
||||
float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
|
||||
|
||||
_owner->GetNearPoint(_owner, x, y, z, _owner->GetCombatReach(), dist, _owner->GetAngle(srcX, srcY) + float(M_PI));
|
||||
_owner->GetNearPoint(_owner, x, y, z, _owner->GetCombatReach(), dist, _owner->GetAbsoluteAngle(srcX, srcY) + float(M_PI));
|
||||
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
init.MoveTo(x, y, z);
|
||||
@@ -497,7 +497,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
|
||||
{
|
||||
float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f);
|
||||
Position const& pos = { x, y, z, 0.0f };
|
||||
float angle = pos.GetAngle(_owner->GetPositionX(), _owner->GetPositionY());
|
||||
float angle = pos.GetAbsoluteAngle(_owner->GetPositionX(), _owner->GetPositionY());
|
||||
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ void FleeingMovementGenerator<T>::GetPoint(T* owner, Position &position)
|
||||
{
|
||||
casterDistance = fleeTarget->GetDistance(owner);
|
||||
if (casterDistance > 0.2f)
|
||||
casterAngle = fleeTarget->GetAngle(owner);
|
||||
casterAngle = fleeTarget->GetAbsoluteAngle(owner);
|
||||
else
|
||||
casterAngle = frand(0.0f, 2.0f * float(M_PI));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ void TargetedMovementGenerator<T, D>::SetTargetLocation(T* owner, bool updateDes
|
||||
if (hoverDiff)
|
||||
size = size > hoverDiff ? std::sqrt(size * size - hoverDiff * hoverDiff) : 0.0f;
|
||||
|
||||
GetTarget()->GetNearPoint(owner, x, y, z, size, CONTACT_DISTANCE, GetTarget()->GetAngle(owner));
|
||||
GetTarget()->GetNearPoint(owner, x, y, z, size, CONTACT_DISTANCE, GetTarget()->GetAbsoluteAngle(owner));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace Movement
|
||||
|
||||
void MoveSplineInit::SetFacing(Unit const* target)
|
||||
{
|
||||
args.facing.angle = unit->GetAngle(target);
|
||||
args.facing.angle = unit->GetAbsoluteAngle(target);
|
||||
args.facing.target = target->GetGUID();
|
||||
args.facing.type = MONSTER_MOVE_FACING_TARGET;
|
||||
}
|
||||
|
||||
@@ -8342,15 +8342,15 @@ bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) const
|
||||
|
||||
WorldObjectSpellLineTargetCheck::WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster,
|
||||
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType)
|
||||
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _srcPosition(srcPosition), _dstPosition(dstPosition), _lineWidth(lineWidth) { }
|
||||
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _position(*srcPosition), _lineWidth(lineWidth)
|
||||
{
|
||||
if (dstPosition && *srcPosition != *dstPosition)
|
||||
_position.SetOrientation(srcPosition->GetAbsoluteAngle(dstPosition));
|
||||
}
|
||||
|
||||
bool WorldObjectSpellLineTargetCheck::operator()(WorldObject* target) const
|
||||
{
|
||||
float angle = _caster->GetOrientation();
|
||||
if (*_srcPosition != *_dstPosition)
|
||||
angle = _srcPosition->GetAngle(_dstPosition);
|
||||
|
||||
if (!_caster->HasInLine(target, target->GetCombatReach(), _lineWidth, angle))
|
||||
if (!_position.HasInLine(target, target->GetCombatReach(), _lineWidth))
|
||||
return false;
|
||||
|
||||
return WorldObjectSpellTargetCheck::operator ()(target);
|
||||
|
||||
@@ -1023,8 +1023,7 @@ namespace Trinity
|
||||
|
||||
struct TC_GAME_API WorldObjectSpellLineTargetCheck : public WorldObjectSpellAreaTargetCheck
|
||||
{
|
||||
Position const* _srcPosition;
|
||||
Position const* _dstPosition;
|
||||
Position _position;
|
||||
float _lineWidth;
|
||||
WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster,
|
||||
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType);
|
||||
|
||||
@@ -2221,7 +2221,7 @@ void Spell::EffectDistract()
|
||||
unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS);
|
||||
|
||||
unitTarget->StopMoving();
|
||||
unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget));
|
||||
unitTarget->SetFacingTo(unitTarget->GetAbsoluteAngle(destTarget));
|
||||
}
|
||||
|
||||
void Spell::EffectPickPocket()
|
||||
@@ -5072,7 +5072,7 @@ void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPr
|
||||
summon->SetFaction(unitCaster->GetFaction());
|
||||
|
||||
if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst())
|
||||
((Minion*)summon)->SetFollowAngle(unitCaster->GetAngle(summon));
|
||||
((Minion*)summon)->SetFollowAngle(unitCaster->GetAbsoluteAngle(summon));
|
||||
|
||||
if (summon->GetEntry() == 27893)
|
||||
{
|
||||
|
||||
@@ -468,7 +468,7 @@ public:
|
||||
float x, y, z;
|
||||
target->GetContactPoint(_player, x, y, z);
|
||||
|
||||
_player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
|
||||
_player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAbsoluteAngle(target), TELE_TO_GM_MODE);
|
||||
PhasingHandler::InheritPhaseShift(_player, target);
|
||||
_player->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
@@ -1733,7 +1733,7 @@ public:
|
||||
|
||||
Player* chr = handler->GetSession()->GetPlayer();
|
||||
|
||||
float followAngle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI);
|
||||
float followAngle = (creature->GetAbsoluteAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI);
|
||||
float followDist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f));
|
||||
uint32 groupAI = 0;
|
||||
sFormationMgr->AddFormationMember(lowguid, followAngle, followDist, leaderGUID, groupAI);
|
||||
|
||||
@@ -536,7 +536,7 @@ public:
|
||||
|
||||
SeenAtiesh = true;
|
||||
Talk(SAY_ATIESH);
|
||||
me->SetFacingTo(me->GetAngle(player));
|
||||
me->SetFacingTo(me->GetAbsoluteAngle(player));
|
||||
me->ClearUnitState(UNIT_STATE_MOVING);
|
||||
me->GetMotionMaster()->MoveDistract(7 * IN_MILLISECONDS);
|
||||
break;
|
||||
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
me->SetFacingTo(me->GetAngle(breathX, breathY));
|
||||
me->SetFacingTo(me->GetAbsoluteAngle(breathX, breathY));
|
||||
//DoTextEmote("takes a deep breath.", nullptr);
|
||||
events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
|
||||
break;
|
||||
|
||||
@@ -392,7 +392,7 @@ class npc_chained_spirit : public CreatureScript
|
||||
Position pos;
|
||||
if (Player* target = ObjectAccessor::GetPlayer(*me, _revivePlayerGUID))
|
||||
{
|
||||
target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 5.0f, target->GetAngle(me));
|
||||
target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 5.0f, target->GetAbsoluteAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_START_REVIVE, pos);
|
||||
}
|
||||
}
|
||||
@@ -597,8 +597,8 @@ class spell_mandokir_devastating_slam : public SpellScriptLoader
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
caster->AttackStop();
|
||||
caster->SetOrientation(caster->GetAngle(target));
|
||||
caster->SetFacingTo(caster->GetAngle(target));
|
||||
caster->SetOrientation(caster->GetAbsoluteAngle(target));
|
||||
caster->SetFacingTo(caster->GetAbsoluteAngle(target));
|
||||
|
||||
caster->CastSpell(caster, SPELL_DEVASTATING_SLAM, false);
|
||||
|
||||
|
||||
@@ -971,7 +971,7 @@ void hyjalAI::WaypointReached(uint32 waypointId, uint32 /*pathId*/)
|
||||
(*itr)->GetMotionMaster()->Initialize();
|
||||
float range = 10;
|
||||
if (me->GetEntry() == THRALL)range = 20;
|
||||
me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr)));
|
||||
me->GetNearPoint(me, x, y, z, range, 0, me->GetAbsoluteAngle((*itr)));
|
||||
(*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5, 5), y+irand(-5, 5), me->GetPositionZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
{
|
||||
//Face our target
|
||||
DarkGlareAngle = me->GetAngle(target);
|
||||
DarkGlareAngle = me->GetAbsoluteAngle(target);
|
||||
DarkGlareTickTimer = 1000;
|
||||
DarkGlareTick = 0;
|
||||
ClockWise = RAND(true, false);
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
break;
|
||||
case EVENT_RUN_AWAY:
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(me->GetAngle(CrashSite)) * 28.0f), me->GetPositionY() + (std::sin(me->GetAngle(CrashSite)) * 28.0f), me->GetPositionZ() + 1.0f);
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(me->GetAbsoluteAngle(CrashSite)) * 28.0f), me->GetPositionY() + (std::sin(me->GetAbsoluteAngle(CrashSite)) * 28.0f), me->GetPositionZ() + 1.0f);
|
||||
me->DespawnOrUnsummon(Seconds(4));
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -368,7 +368,7 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript
|
||||
if (!sphereTarget)
|
||||
return;
|
||||
|
||||
float angle = me->GetAngle(sphereTarget) + angleOffset;
|
||||
float angle = me->GetAbsoluteAngle(sphereTarget) + angleOffset;
|
||||
float x = me->GetPositionX() + distOffset * std::cos(angle);
|
||||
float y = me->GetPositionY() + distOffset * std::sin(angle);
|
||||
|
||||
|
||||
@@ -1030,7 +1030,7 @@ class npc_meteor_strike_initial : public CreatureScript
|
||||
Position const* ownerPos = halionAI->GetMeteorStrikePosition();
|
||||
float randomAdjustment = frand(static_cast<float>(M_PI / 5.0f), static_cast<float>(M_PI / 2.0f));
|
||||
float angle[4];
|
||||
angle[0] = me->GetAngle(ownerPos);
|
||||
angle[0] = me->GetAbsoluteAngle(ownerPos);
|
||||
angle[1] = angle[0] + randomAdjustment;
|
||||
angle[2] = angle[0] + static_cast<float>(M_PI);
|
||||
angle[3] = angle[2] + randomAdjustment;
|
||||
|
||||
@@ -2790,7 +2790,7 @@ class spell_hor_evasion : public SpellScriptLoader
|
||||
if (pos.IsInDist2d(&home, 15.0f))
|
||||
return;
|
||||
|
||||
float angle = pos.GetAngle(&home);
|
||||
float angle = pos.GetAbsoluteAngle(&home);
|
||||
float dist = GetEffectInfo().CalcRadius(GetCaster());
|
||||
target->MovePosition(pos, dist, angle);
|
||||
|
||||
|
||||
@@ -645,7 +645,7 @@ class boss_prince_keleseth_icc : public CreatureScript
|
||||
summons.Summon(summon);
|
||||
Position pos = me->GetPosition();
|
||||
float maxRange = me->GetDistance2d(summon);
|
||||
float angle = me->GetAngle(summon);
|
||||
float angle = me->GetAbsoluteAngle(summon);
|
||||
me->MovePositionToFirstCollision(pos, maxRange, angle);
|
||||
summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN);
|
||||
|
||||
@@ -378,7 +378,7 @@ class npc_coldflame : public CreatureScript
|
||||
|
||||
if (owner->HasAura(SPELL_BONE_STORM))
|
||||
{
|
||||
float ang = Position::NormalizeOrientation(pos.GetAngle(me));
|
||||
float ang = pos.GetAbsoluteAngle(me);
|
||||
me->SetOrientation(ang);
|
||||
owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetCombatReach(), ang);
|
||||
}
|
||||
@@ -391,7 +391,7 @@ class npc_coldflame : public CreatureScript
|
||||
return;
|
||||
}
|
||||
|
||||
float ang = Position::NormalizeOrientation(pos.GetAngle(target));
|
||||
float ang = pos.GetAbsoluteAngle(target);
|
||||
me->SetOrientation(ang);
|
||||
owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetCombatReach(), ang);
|
||||
}
|
||||
|
||||
@@ -1692,7 +1692,7 @@ class npc_strangulate_vehicle : public CreatureScript
|
||||
{
|
||||
if (me->GetExactDist(lichKing) > 10.0f)
|
||||
{
|
||||
Position pos = lichKing->GetNearPosition(float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAngle(me));
|
||||
Position pos = lichKing->GetNearPosition(float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAbsoluteAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(0, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1290,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI
|
||||
if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE)))
|
||||
{
|
||||
me->SetReactState(REACT_DEFENSIVE);
|
||||
FollowAngle = me->GetAngle(crok) + me->GetOrientation();
|
||||
FollowAngle = me->GetAbsoluteAngle(crok) + me->GetOrientation();
|
||||
FollowDist = me->GetDistance2d(crok);
|
||||
me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE);
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ public:
|
||||
{
|
||||
Position pos;
|
||||
pos.m_positionZ = alexstraszaBunny->GetPositionZ();
|
||||
alexstraszaBunny->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAngle(me));
|
||||
alexstraszaBunny->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAbsoluteAngle(me));
|
||||
me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos);
|
||||
me->SetImmuneToAll(false);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -845,7 +845,7 @@ public:
|
||||
Position randomPosOnRadius;
|
||||
// Hardcodded retail value, reason is Z getters can fail... (TO DO: Change to getter when height calculation works on 100%!)
|
||||
randomPosOnRadius.m_positionZ = 283.0521f;
|
||||
alexstraszaBunny->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAngle(me));
|
||||
alexstraszaBunny->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAbsoluteAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLY_OUT_OF_PLATFORM_P_TWO, randomPosOnRadius);
|
||||
_flyingOutOfPlatform = true;
|
||||
}
|
||||
@@ -1678,7 +1678,7 @@ class spell_malygos_random_portal : public SpellScriptLoader
|
||||
{
|
||||
Position pos;
|
||||
pos.m_positionZ = target->GetPositionZ();
|
||||
target->GetNearPoint2D(pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAngle(malygos));
|
||||
target->GetNearPoint2D(pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAbsoluteAngle(malygos));
|
||||
malygos->GetMotionMaster()->MovePoint(POINT_NEAR_RANDOM_PORTAL_P_NONE, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
|
||||
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
|
||||
float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
|
||||
float diff = std::fabs(orientation - angle);
|
||||
|
||||
if (diff > 1.0f)
|
||||
@@ -380,7 +380,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
|
||||
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
|
||||
float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
|
||||
float diff = std::fabs(orientation - angle);
|
||||
|
||||
if (diff > 1.0f)
|
||||
|
||||
@@ -750,7 +750,7 @@ class npc_frostbrood_skytalon : public CreatureScript
|
||||
{
|
||||
Position randomPosOnRadius;
|
||||
randomPosOnRadius.m_positionZ = (me->GetPositionZ() + 40.0f);
|
||||
me->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAngle(me));
|
||||
me->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAbsoluteAngle(me));
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLY_AWAY, randomPosOnRadius);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ struct boss_illidan_stormrage : public BossAI
|
||||
}
|
||||
case EVENT_FACE_MIDDLE:
|
||||
{
|
||||
float angle = me->GetAngle(IllidanMiddlePoint);
|
||||
float angle = me->GetAbsoluteAngle(IllidanMiddlePoint);
|
||||
me->SetFacingTo(angle);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class boss_warp_splinter : public CreatureScript
|
||||
|
||||
float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle);
|
||||
float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle);
|
||||
float O = - me->GetAngle(X, Y);
|
||||
float O = - me->GetAbsoluteAngle(X, Y);
|
||||
|
||||
if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000))
|
||||
ENSURE_AI(npc_warp_splinter_treant::npc_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID();
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
me->UseDoorOrButton();
|
||||
int Random = rand32() % (sizeof(NpcPrisonEntry) / sizeof(uint32));
|
||||
|
||||
if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player),
|
||||
if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player),
|
||||
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
|
||||
{
|
||||
if (!creature->IsHostileTo(player))
|
||||
@@ -366,7 +366,7 @@ public:
|
||||
me->UseDoorOrButton();
|
||||
int Random = rand32() % (sizeof(NpcStasisEntry) / sizeof(uint32));
|
||||
|
||||
player->SummonCreature(NpcStasisEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player),
|
||||
player->SummonCreature(NpcStasisEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player),
|
||||
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
|
||||
|
||||
return false;
|
||||
@@ -1250,8 +1250,8 @@ public:
|
||||
bool GossipHello(Player* player) override
|
||||
{
|
||||
player->SendLoot(me->GetGUID(), LOOT_CORPSE);
|
||||
me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX() + 1, me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
|
||||
me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX(), me->GetPositionY() + 1, me->GetPositionZ(), me->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
|
||||
me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX() + 1, me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
|
||||
me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX(), me->GetPositionY() + 1, me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2481,7 +2481,7 @@ class npc_train_wrecker : public CreatureScript
|
||||
_isSearching = false;
|
||||
_target = target->GetGUID();
|
||||
me->SetWalk(true);
|
||||
me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAngle(me)));
|
||||
me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAbsoluteAngle(me)));
|
||||
}
|
||||
else
|
||||
_timer = 3 * IN_MILLISECONDS;
|
||||
|
||||
Reference in New Issue
Block a user