diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-05 14:29:12 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-05 14:29:12 +0200 |
commit | 7008ac98aa15c41d408874fa7761a4e01e24042c (patch) | |
tree | a13d1619ff3132558e6afaf14dce8016318d7efa | |
parent | a508ce1976caaf8ede6afcea7e8a857399f548ef (diff) | |
parent | 2042b095266cabd79b26d8325d4dee600260d4c9 (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
-rw-r--r-- | sql/updates/world/2014_07_04_00_world_playercreateinfo_skills.sql | 5 | ||||
-rw-r--r-- | sql/updates/world/2014_07_05_00_world_misc.sql | 7 | ||||
-rw-r--r-- | src/server/game/Movement/PathGenerator.cpp | 38 | ||||
-rw-r--r-- | src/server/game/Movement/PathGenerator.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 19 |
5 files changed, 66 insertions, 5 deletions
diff --git a/sql/updates/world/2014_07_04_00_world_playercreateinfo_skills.sql b/sql/updates/world/2014_07_04_00_world_playercreateinfo_skills.sql new file mode 100644 index 00000000000..b058e320790 --- /dev/null +++ b/sql/updates/world/2014_07_04_00_world_playercreateinfo_skills.sql @@ -0,0 +1,5 @@ +DELETE FROM `playercreateinfo_skills` WHERE `skill` IN (113,115,137); +INSERT INTO `playercreateinfo_skills` VALUES +(512,0,137,0,'Language: Thalassian'), +(8,0,113,0,'Language: Darnassian'), +(32,0,115,0,'Language: Taurahe'); diff --git a/sql/updates/world/2014_07_05_00_world_misc.sql b/sql/updates/world/2014_07_05_00_world_misc.sql new file mode 100644 index 00000000000..027a23802b6 --- /dev/null +++ b/sql/updates/world/2014_07_05_00_world_misc.sql @@ -0,0 +1,7 @@ +-- +DELETE FROM smart_scripts WHERE entryorguid in (25001,25002,24999) AND event_type=6; +UPDATE `smart_scripts` SET `id`=1 WHERE `entryorguid`=25001 AND `id`=0 AND `action_param1` =12744; +DELETE FROM smart_scripts WHERE entryorguid in (25001) AND `id`>0; + +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(25001,0,0,0,11,0,100,0,0,0,0,0,11,45227,0,0,0,0,0,1,0,0,0,0,0,0,0,'Abyssal Flamewalker - On spawn - Cast Abyssal Meteor Fall'); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 4de47036b59..aa6ed09ca06 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -883,3 +883,41 @@ float PathGenerator::Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) c { return (p1 - p2).squaredLength(); } + +void PathGenerator::ReducePathLenghtByDist(float dist) +{ + if (GetPathType() == PATHFIND_BLANK) + { + TC_LOG_ERROR("maps", "PathGenerator::ReducePathLenghtByDist called before path was built"); + return; + } + + if (_pathPoints.size() < 2) // path building failure + return; + + uint32 i = _pathPoints.size(); + G3D::Vector3 nextVec = _pathPoints[--i]; + while (i > 0) + { + G3D::Vector3 currVec = _pathPoints[--i]; + G3D::Vector3 diffVec = (nextVec - currVec); + float len = diffVec.length(); + if (len > dist) + { + float step = dist / len; + // same as nextVec + _pathPoints[i + 1] -= diffVec * step; + _pathPoints.resize(i + 2); + break; + } + else if (i == 0) // at second point + { + _pathPoints[1] = _pathPoints[0]; + _pathPoints.resize(2); + break; + } + + dist -= len; + nextVec = currVec; // we're going backwards + } +} diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h index 6e0d72ec8da..a9a13c37251 100644 --- a/src/server/game/Movement/PathGenerator.h +++ b/src/server/game/Movement/PathGenerator.h @@ -72,6 +72,8 @@ class PathGenerator PathType GetPathType() const { return _type; } + void ReducePathLenghtByDist(float dist); // path must be already built + private: dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]; // array of detour polygon references diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 7a4d4904cc1..4920e0c2254 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5106,15 +5106,24 @@ SpellCastResult Spell::CheckCast(bool strict) if (!target) return SPELL_FAILED_DONT_REPORT; - //target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - Position pos = target->GetFirstCollisionPosition(CONTACT_DISTANCE, target->GetRelativeAngle(m_caster)); + float objSize = target->GetObjectSize(); + float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict - m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f); - bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize(), false, true); + m_preGeneratedPath.SetPathLengthLimit(range); + // first try with raycast, if it fails fall back to normal path + bool result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize(), false, true); if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT) return SPELL_FAILED_OUT_OF_RANGE; else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH) - return SPELL_FAILED_NOPATH; + { + result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize(), false, false); + if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT) + return SPELL_FAILED_OUT_OF_RANGE; + else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH) + return SPELL_FAILED_NOPATH; + } + + m_preGeneratedPath.ReducePathLenghtByDist(objSize); // move back } break; } |