Skip to content

Commit bbbd7b7

Browse files
author
Rochet2
committed
Merge TrinityCore 3.3.5 to ElunaTrinityWotlk [skip ci]
2 parents 36abf23 + 06dee8e commit bbbd7b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+532
-453
lines changed

dep/boost/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ if(WIN32)
2121
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" 0 ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} _BOOST_MSVC_TOOLSET_VERSION_MAJOR)
2222
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} -1 _BOOST_MSVC_TOOLSET_VERSION_MINOR)
2323

24-
set(BOOST_SEARCH_HINTS "${BOOST_ROOT}/lib${PLATFORM}-msvc-${_BOOST_MSVC_TOOLSET_VERSION_MAJOR}.${_BOOST_MSVC_TOOLSET_VERSION_MINOR}/cmake")
24+
while(_BOOST_MSVC_TOOLSET_VERSION_MINOR GREATER_EQUAL 0)
25+
list(APPEND BOOST_SEARCH_HINTS "${BOOST_ROOT}/lib${PLATFORM}-msvc-${_BOOST_MSVC_TOOLSET_VERSION_MAJOR}.${_BOOST_MSVC_TOOLSET_VERSION_MINOR}/cmake")
26+
math(EXPR _BOOST_MSVC_TOOLSET_VERSION_MINOR "${_BOOST_MSVC_TOOLSET_VERSION_MINOR} - 1" OUTPUT_FORMAT DECIMAL)
27+
endwhile()
2528

2629
unset(_BOOST_MSVC_TOOLSET_VERSION_LENGTH)
2730
unset(_BOOST_MSVC_TOOLSET_VERSION_MAJOR)
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
--
2+
DROP PROCEDURE IF EXISTS apply_if_exists_2023_04_10_00_world;
3+
4+
DELIMITER ;;
5+
CREATE PROCEDURE apply_if_exists_2023_04_10_00_world() BEGIN
6+
IF EXISTS (SELECT * FROM `information_schema`.`columns` WHERE `table_schema`=SCHEMA() AND `table_name`='script_waypoint') THEN
7+
DELETE FROM `waypoint_data` WHERE `id` & 2;
8+
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `delay`) SELECT ((s.`entry` << 3) | 2), s.`pointid`, s.`location_x`, s.`location_y`, s.`location_z`, s.`waittime` FROM `script_waypoint` s;
9+
10+
DROP TABLE IF EXISTS `script_waypoint`;
11+
END IF;
12+
END;;
13+
14+
DELIMITER ;
15+
CALL apply_if_exists_2023_04_10_00_world();
16+
17+
DROP PROCEDURE IF EXISTS apply_if_exists_2023_04_10_00_world;
18+
19+
-- Rage Winterchill
20+
SET @PATH_ID := 142138;
21+
DELETE FROM `waypoint_data` WHERE `id`=@PATH_ID;
22+
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
23+
(@PATH_ID, 0, 4896.08, -1576.35, 1333.65),
24+
(@PATH_ID, 1, 4898.68, -1615.02, 1329.48),
25+
(@PATH_ID, 2, 4907.12, -1667.08, 1321.00),
26+
(@PATH_ID, 3, 4963.18, -1699.35, 1340.51),
27+
(@PATH_ID, 4, 4989.16, -1716.67, 1335.74),
28+
(@PATH_ID, 5, 5026.27, -1736.89, 1323.02),
29+
(@PATH_ID, 6, 5037.77, -1770.56, 1324.36),
30+
(@PATH_ID, 7, 5067.23, -1789.95, 1321.17);
31+
32+
-- Kazrogal
33+
SET @PATH_ID := 143106;
34+
DELETE FROM `waypoint_data` WHERE `id`=@PATH_ID;
35+
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
36+
(@PATH_ID, 0, 5492.91, -2404.61, 1462.63),
37+
(@PATH_ID, 1, 5531.76, -2460.87, 1469.55),
38+
(@PATH_ID, 2, 5554.58, -2514.66, 1476.12),
39+
(@PATH_ID, 3, 5554.16, -2567.23, 1479.90),
40+
(@PATH_ID, 4, 5540.67, -2625.99, 1480.89),
41+
(@PATH_ID, 5, 5508.16, -2659.20, 1480.15),
42+
(@PATH_ID, 6, 5489.62, -2704.05, 1482.18),
43+
(@PATH_ID, 7, 5457.04, -2726.26, 1485.10);
44+
45+
-- Azgalor
46+
SET @PATH_ID := 142738;
47+
DELETE FROM `waypoint_data` WHERE `id`=@PATH_ID;
48+
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
49+
(@PATH_ID, 0, 5492.91, -2404.61, 1462.63),
50+
(@PATH_ID, 1, 5531.76, -2460.87, 1469.55),
51+
(@PATH_ID, 2, 5554.58, -2514.66, 1476.12),
52+
(@PATH_ID, 3, 5554.16, -2567.23, 1479.90),
53+
(@PATH_ID, 4, 5540.67, -2625.99, 1480.89),
54+
(@PATH_ID, 5, 5508.16, -2659.20, 1480.15),
55+
(@PATH_ID, 6, 5489.62, -2704.05, 1482.18),
56+
(@PATH_ID, 7, 5457.04, -2726.26, 1485.10);
57+
58+
-- Anetheron
59+
SET @PATH_ID := 142466;
60+
DELETE FROM `waypoint_data` WHERE `id`=@PATH_ID;
61+
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
62+
(@PATH_ID, 0, 4896.08, -1576.35, 1333.65),
63+
(@PATH_ID, 1, 4898.68, -1615.02, 1329.48),
64+
(@PATH_ID, 2, 4907.12, -1667.08, 1321.00),
65+
(@PATH_ID, 3, 4963.18, -1699.35, 1340.51),
66+
(@PATH_ID, 4, 4989.16, -1716.67, 1335.74),
67+
(@PATH_ID, 5, 5026.27, -1736.89, 1323.02),
68+
(@PATH_ID, 6, 5037.77, -1770.56, 1324.36),
69+
(@PATH_ID, 7, 5067.23, -1789.95, 1321.17);
70+
71+
-- ------------------------------------------------------------------------------------------------
72+
73+
SET @MOVE_TYPE_RUN := 1;
74+
SET @MOVE_TYPE_WALK := 0;
75+
76+
-- Thrall, old_hillsbrad.cpp
77+
SET @PATHID := 143010;
78+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` < 8;
79+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point` BETWEEN 8 AND 10;
80+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` BETWEEN 11 AND 29;
81+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point` = 30;
82+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` BETWEEN 31 AND 58;
83+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point`=59;
84+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` BETWEEN 60 AND 63;
85+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point` BETWEEN 64 AND 70;
86+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` BETWEEN 71 AND 80;
87+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point` BETWEEN 81 AND 83;
88+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` BETWEEN 84 AND 90;
89+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID AND `point` BETWEEN 91 AND 96;
90+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` >= 97;
91+
92+
-- Magwin, zone_azuremyst_isle.cpp
93+
SET @PATHID := 138498;
94+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_WALK WHERE `id`=@PATHID;
95+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` >= 28;
96+
97+
-- Brann Bronzebeard, halls_of_stone.cpp
98+
SET @PATHID := 224562;
99+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` >= 1;
100+
101+
-- Maghar Captive, zone_nagrand.cpp
102+
SET @PATHID := 145682;
103+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` >= 16;
104+
105+
-- Rin'ji, zone_hinterlands.cpp
106+
SET @PATHID := 62242;
107+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=@PATHID AND `point` >= 17;
108+
109+
-- ------------------------------------------------------------------------------------------------
110+
111+
-- Mograine, chapter5.cpp
112+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=233386;
113+
114+
-- Scarlet Trainee, boss_herod.cpp
115+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=52602;
116+
117+
-- Anetheron, boss_anetheron.cpp
118+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=142466;
119+
120+
-- Azgalor, boss_azgalor.cpp
121+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=142738;
122+
123+
-- Kazrogal, boss_kazrogal.cpp
124+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=143106;
125+
126+
-- Rage Winterchill, boss_rage_winterchill.cpp
127+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=142138;
128+
129+
-- Legoso, zone_bloodmyst_isle.cpp
130+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=143858;
131+
132+
-- Skeletal Gryphon, boss_black_knight.cpp
133+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=283930;
134+
135+
-- Crok Scourgebane, boss_sister_svalna.cpp
136+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=297034;
137+
138+
-- Mimirons Inferno, boss_flame_leviathan.cpp
139+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=266962;
140+
141+
-- Icefang, zone_storm_peaks.cpp
142+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=236818;
143+
144+
-- Taretha, old_hillsbrad.cpp
145+
UPDATE `waypoint_data` SET `move_type`=@MOVE_TYPE_RUN WHERE `id`=151098;

src/common/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum TimeConstants
3131
DAY = HOUR*24,
3232
WEEK = DAY*7,
3333
MONTH = DAY*30,
34-
YEAR = MONTH*12,
34+
YEAR = DAY*365,
3535
IN_MILLISECONDS = 1000
3636
};
3737

src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "ObjectAccessor.h"
2626
#include "Player.h"
2727
#include "ScriptSystem.h"
28+
#include "WaypointManager.h"
2829
#include "World.h"
2930

3031
enum Points
@@ -34,7 +35,7 @@ enum Points
3435
};
3536

3637
EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500ms), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE),
37-
_escortQuest(nullptr), _activeAttacker(true), _running(false), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true), _manualPath(false),
38+
_escortQuest(nullptr), _activeAttacker(true), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true),
3839
_hasImmuneToNPCFlags(false), _started(false), _ended(false), _resume(false)
3940
{
4041
}
@@ -130,7 +131,7 @@ void EscortAI::MovementInform(uint32 type, uint32 id)
130131
if (id == POINT_LAST_POINT)
131132
{
132133
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::MovementInform: returned to before combat position ({})", me->GetGUID().ToString());
133-
me->SetWalk(!_running);
134+
me->SetWalk(false);
134135
RemoveEscortState(STATE_ESCORT_RETURNING);
135136
}
136137
else if (id == POINT_HOME)
@@ -254,7 +255,12 @@ void EscortAI::UpdateEscortAI(uint32 /*diff*/)
254255
DoMeleeAttackIfReady();
255256
}
256257

257-
void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, Milliseconds waitTime/* = 0s*/)
258+
void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, bool run)
259+
{
260+
AddWaypoint(id, x, y, z, 0.0f, 0s, run);
261+
}
262+
263+
void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, Milliseconds waitTime/* = 0s*/, bool run /*= false*/)
258264
{
259265
Trinity::NormalizeMapCoord(x);
260266
Trinity::NormalizeMapCoord(y);
@@ -265,18 +271,38 @@ void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientati
265271
waypoint.y = y;
266272
waypoint.z = z;
267273
waypoint.orientation = orientation;
268-
waypoint.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
274+
waypoint.moveType = run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
269275
waypoint.delay = waitTime.count();
270276
waypoint.eventId = 0;
271277
waypoint.eventChance = 100;
272278
_path.nodes.push_back(std::move(waypoint));
279+
}
273280

274-
_manualPath = true;
281+
void EscortAI::ResetPath()
282+
{
283+
_path.nodes.clear();
284+
}
285+
286+
void EscortAI::LoadPath(uint32 pathId)
287+
{
288+
WaypointPath const* path = sWaypointMgr->GetPath(pathId);
289+
if (!path)
290+
{
291+
TC_LOG_ERROR("scripts.ai.escortai", "EscortAI::LoadPath: (script: {}) path {} is invalid ({})", me->GetScriptName(), pathId, me->GetGUID().ToString());
292+
return;
293+
}
294+
_path = *path;
275295
}
276296

277297
/// @todo get rid of this many variables passed in function.
278-
void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
298+
void EscortAI::Start(bool isActiveAttacker /* = true*/, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */)
279299
{
300+
if (_path.nodes.empty())
301+
{
302+
TC_LOG_ERROR("scripts.ai.escortai", "EscortAI::Start: (script: {}) path is empty ({})", me->GetScriptName(), me->GetGUID().ToString());
303+
return;
304+
}
305+
280306
// Queue respawn from the point it starts
281307
if (CreatureData const* cdata = me->GetCreatureData())
282308
{
@@ -296,11 +322,6 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */,
296322
return;
297323
}
298324

299-
_running = run;
300-
301-
if (!_manualPath && resetWaypoints)
302-
FillPointMovementListForCreature();
303-
304325
if (_path.nodes.empty())
305326
{
306327
TC_LOG_ERROR("scripts.ai.escortai", "EscortAI::Start: (script: {}) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: {}) ({})", me->GetScriptName(), quest ? quest->GetQuestId() : 0, me->GetGUID());
@@ -328,28 +349,13 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */,
328349
me->SetImmuneToNPC(false);
329350
}
330351

331-
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::Start: (script: {}) started with {} waypoints. ActiveAttacker = {}, Run = {}, Player = {} ({})",
332-
me->GetScriptName(), uint32(_path.nodes.size()), _activeAttacker, _running, _playerGUID.ToString(), me->GetGUID().ToString());
333-
334-
// set initial speed
335-
me->SetWalk(!_running);
352+
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::Start: (script: {}) started with {} waypoints. ActiveAttacker = {}, Player = {} ({})",
353+
me->GetScriptName(), uint32(_path.nodes.size()), _activeAttacker, _playerGUID.ToString(), me->GetGUID().ToString());
336354

337355
_started = false;
338356
AddEscortState(STATE_ESCORT_ESCORTING);
339357
}
340358

341-
void EscortAI::SetRun(bool on)
342-
{
343-
if (on == _running)
344-
return;
345-
346-
for (auto& node : _path.nodes)
347-
node.moveType = on ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
348-
349-
me->SetWalk(!on);
350-
_running = on;
351-
}
352-
353359
void EscortAI::SetEscortPaused(bool on)
354360
{
355361
if (!HasEscortState(STATE_ESCORT_ESCORTING))
@@ -436,20 +442,3 @@ bool EscortAI::IsPlayerOrGroupInRange()
436442

437443
return false;
438444
}
439-
440-
void EscortAI::FillPointMovementListForCreature()
441-
{
442-
WaypointPath const* path = sScriptSystemMgr->GetPath(me->GetEntry());
443-
if (!path)
444-
return;
445-
446-
for (WaypointNode const& value : path->nodes)
447-
{
448-
WaypointNode node = value;
449-
Trinity::NormalizeMapCoord(node.x);
450-
Trinity::NormalizeMapCoord(node.y);
451-
node.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
452-
453-
_path.nodes.push_back(std::move(node));
454-
}
455-
}

src/server/game/AI/ScriptedAI/ScriptedEscortAI.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ struct TC_GAME_API EscortAI : public ScriptedAI
4848
void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI()
4949

5050
virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
51-
void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, Milliseconds waitTime = 0s);
52-
void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
51+
void AddWaypoint(uint32 id, float x, float y, float z, bool run);
52+
void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, Milliseconds waitTime = 0s, bool run = false);
53+
void ResetPath();
54+
void LoadPath(uint32 pathId);
55+
void Start(bool isActiveAttacker = true, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false);
5356

54-
void SetRun(bool on = true);
5557
void SetEscortPaused(bool on);
5658
void SetPauseTimer(Milliseconds timer) { _pauseTimer = timer; }
5759
bool HasEscortState(uint32 escortState) { return (_escortState & escortState) != 0; }
@@ -70,7 +72,6 @@ struct TC_GAME_API EscortAI : public ScriptedAI
7072
private:
7173
bool AssistPlayerInCombatAgainst(Unit* who);
7274
bool IsPlayerOrGroupInRange();
73-
void FillPointMovementListForCreature();
7475

7576
void AddEscortState(uint32 escortState) { _escortState |= escortState; }
7677
void RemoveEscortState(uint32 escortState) { _escortState &= ~escortState; }
@@ -86,12 +87,10 @@ struct TC_GAME_API EscortAI : public ScriptedAI
8687
WaypointPath _path;
8788

8889
bool _activeAttacker; // obsolete, determined by faction.
89-
bool _running; // all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
9090
bool _instantRespawn; // if creature should respawn instantly after escort over (if not, database respawntime are used)
9191
bool _returnToStart; // if creature can walk same path (loop) without despawn. Not for regular escort quests.
9292
bool _despawnAtEnd;
9393
bool _despawnAtFar;
94-
bool _manualPath;
9594
bool _hasImmuneToNPCFlags;
9695
bool _started;
9796
bool _ended;

0 commit comments

Comments
 (0)