From 0d46b893fc72bb6483653ca06f21184a7949d051 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 13 Jul 2018 14:50:10 +0200 Subject: [PATCH] Core/Objects: *merged 3.3.5 renaming of GetObjectSize() to GetCombatReach() *made GetBoundaryRadius virtual and use it to determine the actual spell radius distance with it instead of using CombatReach --- src/server/game/Entities/Object/Object.cpp | 55 +++++++++---------- src/server/game/Entities/Object/Object.h | 11 ++-- src/server/game/Entities/Pet/Pet.cpp | 4 +- src/server/game/Entities/Unit/Unit.h | 4 +- src/server/game/Grids/Cells/CellImpl.h | 2 +- src/server/game/Movement/MotionMaster.cpp | 4 +- src/server/game/Spells/Spell.cpp | 18 +++--- src/server/game/Spells/SpellEffects.cpp | 12 ++-- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/scripts/Commands/cs_group.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 2 +- src/server/scripts/Commands/cs_npc.cpp | 2 +- .../MagistersTerrace/boss_selin_fireheart.cpp | 2 +- .../zone_the_scarlet_enclave.cpp | 2 +- .../HallsOfOrigination/boss_anraphet.cpp | 2 +- .../DraktharonKeep/boss_king_dred.cpp | 2 +- .../ForgeOfSouls/boss_bronjahm.cpp | 2 +- .../boss_deathbringer_saurfang.cpp | 2 +- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 6 +- src/server/scripts/Northrend/zone_zuldrak.cpp | 4 +- .../Outland/zone_shadowmoon_valley.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 2 +- src/server/scripts/World/item_scripts.cpp | 2 +- 23 files changed, 71 insertions(+), 75 deletions(-) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 727ca5c286..f2546973ed 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1330,14 +1330,14 @@ InstanceScript* WorldObject::GetInstanceScript() const float WorldObject::GetDistanceZ(const WorldObject* obj) const { float dz = std::fabs(GetPositionZ() - obj->GetPositionZ()); - float sizefactor = GetObjectSize() + obj->GetObjectSize(); + float sizefactor = GetCombatReach() + obj->GetCombatReach(); float dist = dz - sizefactor; return (dist > 0 ? dist : 0); } bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const { - float sizefactor = GetObjectSize() + obj->GetObjectSize(); + float sizefactor = GetCombatReach() + obj->GetCombatReach(); float maxdist = dist2compare + sizefactor; if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID().GetCounter() == GetTransport()->GetGUID().GetCounter()) @@ -1367,31 +1367,31 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool float WorldObject::GetDistance(const WorldObject* obj) const { - float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize(); + float d = GetExactDist(obj) - GetCombatReach() - obj->GetCombatReach(); return d > 0.0f ? d : 0.0f; } float WorldObject::GetDistance(const Position &pos) const { - float d = GetExactDist(&pos) - GetObjectSize(); + float d = GetExactDist(&pos) - GetCombatReach(); return d > 0.0f ? d : 0.0f; } float WorldObject::GetDistance(float x, float y, float z) const { - float d = GetExactDist(x, y, z) - GetObjectSize(); + float d = GetExactDist(x, y, z) - GetCombatReach(); return d > 0.0f ? d : 0.0f; } float WorldObject::GetDistance2d(const WorldObject* obj) const { - float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize(); + float d = GetExactDist2d(obj) - GetCombatReach() - obj->GetCombatReach(); return d > 0.0f ? d : 0.0f; } float WorldObject::GetDistance2d(float x, float y) const { - float d = GetExactDist2d(x, y) - GetObjectSize(); + float d = GetExactDist2d(x, y) - GetCombatReach(); return d > 0.0f ? d : 0.0f; } @@ -1409,24 +1409,24 @@ bool WorldObject::IsInMap(const WorldObject* obj) const return false; } -bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist) const +bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist, bool isInBoundaryRadius /*= false*/) const { - return IsInDist(x, y, z, dist + GetObjectSize()); + return IsInDist(x, y, z, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach()); } -bool WorldObject::IsWithinDist3d(const Position* pos, float dist) const +bool WorldObject::IsWithinDist3d(const Position* pos, float dist, bool isInBoundaryRadius /*= false*/) const { - return IsInDist(pos, dist + GetObjectSize()); + return IsInDist(pos, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach()); } -bool WorldObject::IsWithinDist2d(float x, float y, float dist) const +bool WorldObject::IsWithinDist2d(float x, float y, float dist, bool isInBoundaryRadius /*= false*/) const { - return IsInDist2d(x, y, dist + GetObjectSize()); + return IsInDist2d(x, y, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach()); } -bool WorldObject::IsWithinDist2d(const Position* pos, float dist) const +bool WorldObject::IsWithinDist2d(const Position* pos, float dist, bool isInBoundaryRadius /*= false*/) const { - return IsInDist2d(pos, dist + GetObjectSize()); + return IsInDist2d(pos, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach()); } bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D /*= true*/) const @@ -1443,7 +1443,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const { G3D::Vector3 vThis(GetPositionX(), GetPositionY(), GetPositionZ()); G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ()); - G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(GetPosition()), GetObjectSize()); + 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)); } @@ -1520,7 +1520,7 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan distsq += dz*dz; } - float sizefactor = GetObjectSize() + obj->GetObjectSize(); + float sizefactor = GetCombatReach() + obj->GetCombatReach(); // check only for real range if (minRange > 0.0f) @@ -1540,7 +1540,7 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange) float dy = GetPositionY() - y; float distsq = dx*dx + dy*dy; - float sizefactor = GetObjectSize(); + float sizefactor = GetCombatReach(); // check only for real range if (minRange > 0.0f) @@ -1561,7 +1561,7 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m float dz = GetPositionZ() - z; float distsq = dx*dx + dy*dy + dz*dz; - float sizefactor = GetObjectSize(); + float sizefactor = GetCombatReach(); // check only for real range if (minRange > 0.0f) @@ -1584,7 +1584,7 @@ bool WorldObject::IsInBetween(Position const& pos1, Position const& pos2, float return false; if (!size) - size = GetObjectSize() / 2; + size = GetCombatReach() / 2; float angle = pos1.GetAngle(pos2); @@ -2192,7 +2192,7 @@ TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, fl { if (!x && !y && !z) { - GetClosePoint(x, y, z, GetObjectSize()); + GetClosePoint(x, y, z, GetCombatReach()); ang = GetOrientation(); } @@ -2237,7 +2237,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float { if (!x && !y && !z) { - GetClosePoint(x, y, z, GetObjectSize()); + GetClosePoint(x, y, z, GetCombatReach()); ang = GetOrientation(); } @@ -2351,8 +2351,8 @@ void WorldObject::GetPlayerListInGrid(Container& playerContainer, float maxSearc void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const { - x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle); - y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle); + x = GetPositionX() + (GetCombatReach() + distance2d) * std::cos(absAngle); + y = GetPositionY() + (GetCombatReach() + distance2d) * std::sin(absAngle); Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); @@ -2424,12 +2424,7 @@ Position WorldObject::GetRandomNearPosition(float radius) void WorldObject::GetContactPoint(const WorldObject* 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->GetObjectSize(), distance2d, GetAngle(obj)); -} - -float WorldObject::GetObjectSize() const -{ - return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE; + GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2d, GetAngle(obj)); } void WorldObject::MovePosition(Position &pos, float dist, float angle) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 8432821e29..8f83160db7 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -284,7 +284,8 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation Position GetRandomNearPosition(float radius); void GetContactPoint(WorldObject const* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const; - float GetObjectSize() const; + virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit + virtual float GetBoundaryRadius() const { return 0.0f; } // overridden (only) in Unit void UpdateGroundPositionZ(float x, float y, float &z) const; void UpdateAllowedPositionZ(float x, float y, float &z) const; @@ -329,10 +330,10 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation bool IsSelfOrInSameMap(WorldObject const* obj) const; bool IsInMap(WorldObject const* obj) const; - bool IsWithinDist3d(float x, float y, float z, float dist) const; - bool IsWithinDist3d(Position const* pos, float dist) const; - bool IsWithinDist2d(float x, float y, float dist) const; - bool IsWithinDist2d(Position const* pos, float dist) const; + bool IsWithinDist3d(float x, float y, float z, float dist, bool isInBoundaryRadius = false) const; + bool IsWithinDist3d(Position const* pos, float dist, bool isInBoundaryRadius = false) const; + bool IsWithinDist2d(float x, float y, float dist, bool isInBoundaryRadius = false) const; + bool IsWithinDist2d(Position const* pos, float dist, bool isInBoundaryRadius = false) const; // use only if you will sure about placing both object at same map bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const; bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 3257a14f21..c9b1564fac 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -175,7 +175,7 @@ bool Pet::LoadPetData(Player* owner, uint32 petEntry, uint32 petnumber, bool cur if (IsCritter()) { float px, py, pz; - owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + owner->GetClosePoint(px, py, pz, GetCombatReach(), PET_FOLLOW_DIST, GetFollowAngle()); Relocate(px, py, pz, owner->GetOrientation()); if (!IsPositionValid()) @@ -232,7 +232,7 @@ bool Pet::LoadPetData(Player* owner, uint32 petEntry, uint32 petnumber, bool cur // Set pet's position after setting level, its size depends on it float px, py, pz; - owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + owner->GetClosePoint(px, py, pz, GetCombatReach(), PET_FOLLOW_DIST, GetFollowAngle()); Relocate(px, py, pz, owner->GetOrientation()); if (!IsPositionValid()) { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 821ae0581d..b0af9c8ebb 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1005,8 +1005,8 @@ class TC_GAME_API Unit : public WorldObject bool haveOffhandWeapon() const; bool CanDualWield() const { return m_canDualWield; } virtual void SetCanDualWield(bool value) { m_canDualWield = value; } - float GetCombatReach() const { return m_floatValues[UNIT_FIELD_COMBATREACH]; } - float GetBoundaryRadius() const { return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } + float GetCombatReach() const override { return m_floatValues[UNIT_FIELD_COMBATREACH]; } + float GetBoundaryRadius() const override { return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } bool IsWithinCombatRange(Unit const* obj, float dist2compare) const; bool IsWithinMeleeRange(Unit const* obj) const; bool IsWithinBoundaryRadius(const Unit* obj) const; diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h index 5d8f960e38..1143cd5ee6 100644 --- a/src/server/game/Grids/Cells/CellImpl.h +++ b/src/server/game/Grids/Cells/CellImpl.h @@ -65,7 +65,7 @@ inline void Cell::Visit(CellCoord const& standing_cell, TypeContainerVisitor diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index a1640997a2..1e8c8f2174 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -429,7 +429,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->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + float(M_PI)); + _owner->GetNearPoint(_owner, x, y, z, _owner->GetCombatReach(), dist, _owner->GetAngle(srcX, srcY) + float(M_PI)); Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); @@ -450,7 +450,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; - _owner->GetClosePoint(x, y, z, _owner->GetObjectSize(), dist, angle); + _owner->GetClosePoint(x, y, z, _owner->GetCombatReach(), dist, angle); MoveJump(x, y, z, 0.0f, speedXY, speedZ); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6969a707c8..077a1943f9 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1357,7 +1357,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici { float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); float angle = targetType.CalcDirectionAngle(); - float objSize = m_caster->GetObjectSize(); + float objSize = m_caster->GetCombatReach(); switch (targetType.GetTarget()) { @@ -1412,7 +1412,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici default: { float angle = targetType.CalcDirectionAngle(); - float objSize = target->GetObjectSize(); + float objSize = target->GetCombatReach(); float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); if (dist < objSize) dist = objSize; @@ -1627,7 +1627,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex) } } - const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3) + const float size = std::max((*itr)->GetCombatReach() * 0.7f, 1.0f); // 1/sqrt(3) /// @todo all calculation should be based on src instead of m_caster const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ; @@ -1704,7 +1704,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex) if (itr != targets.end()) { float distSq = (*itr)->GetExactDistSq(x, y, z); - float sizeSq = (*itr)->GetObjectSize(); + float sizeSq = (*itr)->GetCombatReach(); sizeSq *= sizeSq; DEBUG_TRAJ(TC_LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) if (distSq > sizeSq) @@ -5500,13 +5500,13 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (!target->IsWithinLOSInMap(m_caster)) //Do full LoS/Path check. Don't exclude m2 return SPELL_FAILED_LINE_OF_SIGHT; - float objSize = target->GetObjectSize(); + float objSize = target->GetCombatReach(); float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict m_preGeneratedPath = Trinity::make_unique(m_caster); m_preGeneratedPath->SetPathLengthLimit(range); // first try with raycast, if it fails fall back to normal path - float targetObjectSize = std::min(target->GetObjectSize(), 4.0f); + float targetObjectSize = std::min(target->GetCombatReach(), 4.0f); bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, true); if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT) return SPELL_FAILED_OUT_OF_RANGE; @@ -7952,7 +7952,7 @@ WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Po bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) { - if (!target->IsWithinDist3d(_position, _range) && !(target->ToGameObject() && target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range))) + if (!target->IsWithinDist3d(_position, _range, true) && !(target->ToGameObject() && target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range))) return false; return WorldObjectSpellTargetCheck::operator ()(target); } @@ -7970,7 +7970,7 @@ bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target) } else if (_spellInfo->HasAttribute(SPELL_ATTR0_CU_CONE_LINE)) { - if (!_caster->HasInLine(target, _caster->GetObjectSize() + target->GetObjectSize())) + if (!_caster->HasInLine(target, _caster->GetCombatReach() + target->GetCombatReach())) return false; } else @@ -7990,7 +7990,7 @@ WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Po bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) { // return all targets on missile trajectory (0 - size of a missile) - if (!_caster->HasInLine(target, target->GetObjectSize())) + if (!_caster->HasInLine(target, target->GetCombatReach())) return false; return WorldObjectSpellAreaTargetCheck::operator ()(target); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b0da0250df..3779bed6a8 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2400,7 +2400,7 @@ void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex effIndex) float dis = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); float fx, fy, fz; - m_caster->GetClosePoint(fx, fy, fz, unitTarget->GetObjectSize(), dis); + m_caster->GetClosePoint(fx, fy, fz, unitTarget->GetCombatReach(), dis); unitTarget->NearTeleportTo(fx, fy, fz, -m_caster->GetOrientation(), unitTarget == m_caster); } @@ -2768,7 +2768,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) //OldSummon->GetMap()->Remove(OldSummon->ToCreature(), false); float px, py, pz; - owner->GetClosePoint(px, py, pz, OldSummon->GetObjectSize()); + owner->GetClosePoint(px, py, pz, OldSummon->GetCombatReach()); OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation()); //OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation()); @@ -2794,7 +2794,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) } float x, y, z; - owner->GetClosePoint(x, y, z, owner->GetObjectSize()); + owner->GetClosePoint(x, y, z, owner->GetCombatReach()); Pet* pet = owner->SummonPet(petentry, x, y, z, owner->GetOrientation(), petType, 0); if (!pet) return; @@ -4455,7 +4455,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) if (!m_preGeneratedPath) { //unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); + Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetCombatReach(), unitTarget->GetRelativeAngle(m_caster)); m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed); } else @@ -4694,7 +4694,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) // Reposition the pet's corpse before reviving so as not to grab aggro // We can use a different, more accurate version of GetClosePoint() since we have a pet float x, y, z; // Will be used later to reposition the pet if we have one - player->GetClosePoint(x, y, z, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); + player->GetClosePoint(x, y, z, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle()); pet->NearTeleportTo(x, y, z, player->GetOrientation()); pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords. } @@ -5291,7 +5291,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) // relocate float px, py, pz; - unitTarget->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); + unitTarget->GetClosePoint(px, py, pz, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle()); pet->Relocate(px, py, pz, unitTarget->GetOrientation()); // add to world diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index d13c0274b2..3cc737a56d 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -953,7 +953,7 @@ public: uint32 entry = (uint32)atoi(e); float x, y, z, o = handler->GetSession()->GetPlayer()->GetOrientation(); - handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, handler->GetSession()->GetPlayer()->GetObjectSize()); + handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, handler->GetSession()->GetPlayer()->GetCombatReach()); if (!i) return handler->GetSession()->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr; diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 2db1852668..83b5885437 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -154,7 +154,7 @@ public: // before GM float x, y, z; - gmPlayer->GetClosePoint(x, y, z, player->GetObjectSize()); + gmPlayer->GetClosePoint(x, y, z, player->GetCombatReach()); player->TeleportTo(gmPlayer->GetMapId(), x, y, z, player->GetOrientation()); } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5cd625d8b6..95a834bf34 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -581,7 +581,7 @@ public: // before GM float x, y, z; - _player->GetClosePoint(x, y, z, target->GetObjectSize()); + _player->GetClosePoint(x, y, z, target->GetCombatReach()); target->TeleportTo(_player->GetMapId(), x, y, z, target->GetOrientation()); PhasingHandler::InheritPhaseShift(target, handler->GetSession()->GetPlayer()); target->UpdateObjectVisibility(); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 7bdd337fc5..5afcc9ee76 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1426,7 +1426,7 @@ public: // place pet before player float x, y, z; - player->GetClosePoint (x, y, z, creatureTarget->GetObjectSize(), CONTACT_DISTANCE); + player->GetClosePoint (x, y, z, creatureTarget->GetCombatReach(), CONTACT_DISTANCE); pet->Relocate(x, y, z, float(M_PI) - player->GetOrientation()); // set pet to defensive mode by default (some classes can't control controlled pets in fact). diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 5f7d90c68f..a8f9c0e94c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -114,7 +114,7 @@ class boss_selin_fireheart : public CreatureScript CrystalGUID = crystal->GetGUID(); float x, y, z; - crystal->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); + crystal->GetClosePoint(x, y, z, me->GetCombatReach(), CONTACT_DISTANCE); events.SetPhase(PHASE_DRAIN); me->SetWalk(false); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index b9728f6777..469a7f9028 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -101,7 +101,7 @@ public: FlyBackTimer = 500; break; case 1: - player->GetClosePoint(x, y, z, me->GetObjectSize()); + player->GetClosePoint(x, y, z, me->GetCombatReach()); z += 2.5f; x -= 2.0f; y -= 1.5f; diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp index 46876848af..08f0e1c6d9 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp @@ -868,7 +868,7 @@ public: /// TODO: Remove this once we find a general rule for WorldObject::MovePosition (this spell shouldn't take the Z change into consideration) Unit* caster = GetCaster(); float angle = float(rand_norm()) * static_cast(2 * M_PI); - uint32 dist = caster->GetObjectSize() + GetSpellInfo()->Effects[EFFECT_0].CalcRadius(caster) * (float)rand_norm(); + uint32 dist = caster->GetCombatReach() + GetSpellInfo()->Effects[EFFECT_0].CalcRadius(caster) * (float)rand_norm(); float x = caster->GetPositionX() + dist * std::cos(angle); float y = caster->GetPositionY() + dist * std::sin(angle); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp index 8704aaf6c5..f583e42454 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_king_dred.cpp @@ -145,7 +145,7 @@ class boss_king_dred : public CreatureScript DoCastVictim(SPELL_RAPTOR_CALL); float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 10.0f); + me->GetClosePoint(x, y, z, me->GetCombatReach() / 3, 10.0f); me->SummonCreature(RAND(NPC_DRAKKARI_GUTRIPPER, NPC_DRAKKARI_SCYTHECLAW), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000); events.ScheduleEvent(EVENT_RAPTOR_CALL, urand(20000, 25000)); break; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index d8d31986cc..f21c97fb7d 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -131,7 +131,7 @@ class boss_bronjahm : public CreatureScript { summons.Summon(summon); summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MoveFollow(me, me->GetObjectSize(), 0.0f); + summon->GetMotionMaster()->MoveFollow(me, me->GetCombatReach(), 0.0f); summon->CastSpell(summon, SPELL_PURPLE_BANISH_VISUAL, true); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 460b458bf4..d69f0e09cd 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -807,7 +807,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) { float x, y, z; - deathbringer->GetClosePoint(x, y, z, deathbringer->GetObjectSize()); + deathbringer->GetClosePoint(x, y, z, deathbringer->GetCombatReach()); me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_CORPSE, x, y, z); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 3bbec36a1c..eef3247738 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -381,7 +381,7 @@ class npc_coldflame : public CreatureScript { float ang = Position::NormalizeOrientation(pos.GetAngle(me)); me->SetOrientation(ang); - owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetObjectSize(), ang); + owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetCombatReach(), ang); } else { @@ -394,7 +394,7 @@ class npc_coldflame : public CreatureScript float ang = Position::NormalizeOrientation(pos.GetAngle(target)); me->SetOrientation(ang); - owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetObjectSize(), ang); + owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetCombatReach(), ang); } me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation()); @@ -512,7 +512,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader { targets.clear(); // select any unit but not the tank (by owners threatlist) - Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -GetCaster()->GetObjectSize(), true, -SPELL_IMPALED); + Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -GetCaster()->GetCombatReach(), true, -SPELL_IMPALED); if (!target) target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // or the tank if its solo if (!target) diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index c5cc6d0ba7..8acc98f24e 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -58,7 +58,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); + me->GetClosePoint(x, y, z, me->GetCombatReach() / 3, 0.1f); if (Creature* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { @@ -183,7 +183,7 @@ public: void Reset() override { float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 25.0f); + me->GetClosePoint(x, y, z, me->GetCombatReach() / 3, 25.0f); me->GetMotionMaster()->MovePoint(0, x, y, z); } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 7e34fc1646..3caf2cd338 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -525,7 +525,7 @@ public: Tapped = true; float x, y, z; - caster->GetClosePoint(x, y, z, me->GetObjectSize()); + caster->GetClosePoint(x, y, z, me->GetCombatReach()); me->SetWalk(false); me->GetMotionMaster()->MovePoint(1, x, y, z); diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 5c6ee7a0a0..9ba5fb3d12 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -475,7 +475,7 @@ class go_shrine_of_the_birds : public GameObjectScript uint32 BirdEntry = 0; float fX, fY, fZ; - me->GetClosePoint(fX, fY, fZ, me->GetObjectSize(), INTERACTION_DISTANCE); + me->GetClosePoint(fX, fY, fZ, me->GetCombatReach(), INTERACTION_DISTANCE); switch (me->GetEntry()) { diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 9da73e7be1..c8f44184f7 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -244,7 +244,7 @@ public: return true; float x, y, z; - go->GetClosePoint(x, y, z, go->GetObjectSize() / 3, 7.0f); + go->GetClosePoint(x, y, z, go->GetCombatReach() / 3, 7.0f); go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, QuaternionData(), 1); if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) {