From 5b87f1fcdcce966e50f5eeb9af8a38586d36bec4 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Fri, 14 Aug 2009 05:32:39 +0200 Subject: [PATCH] Merge [SD2] r1245 Update escortAI MAX_PLAYER_DISTANCE from 50 to 66 yards - skip r1246 Not call JustDied() AI function when escortAI max range is over limit(not regular death). Some additional cleanup to apply code style. r1247 Implement automated FailQuest in escortAI (if npc has specific death events, call npc_escortAI::JustDied()). Clean up scripts related to it. Restore original faction at escortAI's JustRespawned() in case faction changed (normal case for escorts). Remove in scripts where defined. r1248 Add small delay before move to first point in escortAI. r1249 Add support for quest 898 r1250 Add support for quest 10451. Original patch by Lightguard --HG-- branch : trunk --- sql/FULL/world_script_waypoints.sql | 111 ++++++ sql/FULL/world_scripts_full.sql | 1 + sql/updates/5001_world_scripts.sql | 112 ++++++ .../scripts/scripts/npc/npc_escortAI.cpp | 77 +++-- .../scripts/scripts/npc/npc_escortAI.h | 4 +- .../arathi_highlands/arathi_highlands.cpp | 11 - .../zone/ashenvale_forest/ashenvale.cpp | 25 -- .../zone/azuremyst_isle/azuremyst_isle.cpp | 21 +- .../scripts/zone/barrens/the_barrens.cpp | 139 ++++++-- .../scripts/scripts/zone/feralas/feralas.cpp | 28 +- .../scripts/zone/ghostlands/ghostlands.cpp | 25 +- .../hellfire_peninsula/hellfire_peninsula.cpp | 25 +- .../shadowmoon_valley/shadowmoon_valley.cpp | 325 ++++++++---------- .../silverpine_forest/silverpine_forest.cpp | 5 - .../stonetalon_mountains.cpp | 17 - .../scripts/scripts/zone/tanaris/tanaris.cpp | 19 +- .../thousand_needles/thousand_needles.cpp | 19 +- .../scripts/zone/westfall/westfall.cpp | 26 +- .../scripts/zone/zangarmarsh/zangarmarsh.cpp | 16 - 19 files changed, 551 insertions(+), 455 deletions(-) create mode 100644 sql/updates/5001_world_scripts.sql diff --git a/sql/FULL/world_script_waypoints.sql b/sql/FULL/world_script_waypoints.sql index 07f6a020a3..3d705cd501 100644 --- a/sql/FULL/world_script_waypoints.sql +++ b/sql/FULL/world_script_waypoints.sql @@ -13,6 +13,117 @@ CREATE TABLE script_waypoint ( PRIMARY KEY (entry, pointid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +DELETE FROM script_waypoint WHERE entry=21027; +INSERT INTO script_waypoint VALUES +(21027, 0, -2714.697266, 1326.879395, 34.306953, 0, ''), +(21027, 1, -2666.364990, 1348.222656, 34.445557, 0, ''), +(21027, 2, -2693.789307, 1336.964966, 34.445557, 0, ''), +(21027, 3, -2715.495361, 1328.054443, 34.106014, 0, ''), +(21027, 4, -2742.530762, 1314.138550, 33.606144, 0, ''), +(21027, 5, -2745.077148, 1311.108765, 33.630898, 0, ''), +(21027, 6, -2749.855225, 1302.737915, 33.475632, 0, ''), +(21027, 7, -2753.639648, 1294.059448, 33.314930, 0, ''), +(21027, 8, -2756.796387, 1285.122192, 33.391262, 0, ''), +(21027, 9, -2750.042969, 1273.661987, 33.188259, 0, ''), +(21027, 10, -2740.378418, 1258.846680, 33.212521, 0, ''), +(21027, 11, -2733.629395, 1248.259766, 33.640598, 0, ''), +(21027, 12, -2727.212646, 1238.606445, 33.520847, 0, ''), +(21027, 13, -2726.377197, 1237.264526, 33.461823, 3000, 'SAY_WIL_PROGRESS1'), +(21027, 14, -2746.383301, 1266.390625, 33.191952, 2000, ''), +(21027, 15, -2746.383301, 1266.390625, 33.191952, 4000, 'SAY_WIL_FIND_EXIT'), +(21027, 16, -2758.927734, 1285.134155, 33.341728, 0, ''), +(21027, 17, -2761.845703, 1292.313599, 33.209042, 0, ''), +(21027, 18, -2758.871826, 1300.677612, 33.285332, 0, ''), +(21027, 19, -2753.928955, 1307.755859, 33.452457, 0, ''), +(21027, 20, -2738.612061, 1316.191284, 33.482975, 0, ''), +(21027, 21, -2727.897461, 1320.013916, 33.381111, 0, ''), +(21027, 22, -2709.458740, 1315.739990, 33.301838, 0, ''), +(21027, 23, -2704.658936, 1301.620361, 32.463303, 0, ''), +(21027, 24, -2704.120117, 1298.922607, 32.768162, 0, ''), +(21027, 25, -2691.798340, 1292.846436, 33.852642, 0, ''), +(21027, 26, -2682.879639, 1288.853882, 32.995399, 0, ''), +(21027, 27, -2661.869141, 1279.682495, 26.686783, 0, ''), +(21027, 28, -2648.943604, 1270.272827, 24.147522, 0, ''), +(21027, 29, -2642.506836, 1262.938721, 23.512444, 0, ''), +(21027, 30, -2636.984863, 1252.429077, 20.418257, 0, ''), +(21027, 31, -2648.113037, 1224.984863, 8.691818, 0, ''), +(21027, 32, -2658.393311, 1200.136719, 5.492243, 0, ''), +(21027, 33, -2668.504395, 1190.450562, 3.127407, 0, ''), +(21027, 34, -2685.930420, 1174.360840, 5.163924, 0, ''), +(21027, 35, -2701.613770, 1160.026367, 5.611311, 0, ''), +(21027, 36, -2714.659668, 1149.980347, 4.342373, 0, ''), +(21027, 37, -2721.443359, 1145.002808, 1.913474, 0, ''), +(21027, 38, -2733.962158, 1143.436279, 2.620415, 0, ''), +(21027, 39, -2757.876709, 1146.937500, 6.184002, 2000, 'SAY_WIL_JUST_AHEAD'), +(21027, 40, -2772.300537, 1166.052734, 6.331811, 0, ''), +(21027, 41, -2790.265381, 1189.941650, 5.207958, 0, ''), +(21027, 42, -2805.448975, 1208.663940, 5.557623, 0, ''), +(21027, 43, -2820.617676, 1225.870239, 6.266103, 0, ''), +(21027, 44, -2831.926758, 1237.725830, 5.808506, 0, ''), +(21027, 45, -2842.578369, 1252.869629, 6.807481, 0, ''), +(21027, 46, -2846.344971, 1258.727295, 7.386168, 0, ''), +(21027, 47, -2847.556396, 1266.771729, 8.208790, 0, ''), +(21027, 48, -2841.654541, 1285.809204, 7.933223, 0, ''), +(21027, 49, -2841.754883, 1289.832520, 6.990304, 0, ''), +(21027, 50, -2871.398438, 1302.348145, 6.807335, 7500, 'SAY_WIL_END'); + +DELETE FROM script_waypoint WHERE entry=3465; +INSERT INTO script_waypoint VALUES +(3465, 0, -2095.840820, -3650.001221, 61.716, 0, ''), +(3465, 1, -2100.193604, -3613.949219, 61.604, 0, ''), +(3465, 2, -2098.549561, -3601.557129, 59.154, 0, ''), +(3465, 3, -2093.796387, -3595.234375, 56.658, 0, ''), +(3465, 4, -2072.575928, -3578.827637, 48.844, 0, ''), +(3465, 5, -2023.858398, -3568.146240, 24.636, 0, ''), +(3465, 6, -2013.576416, -3571.499756, 22.203, 0, ''), +(3465, 7, -2009.813721, -3580.547852, 21.791, 0, ''), +(3465, 8, -2015.296021, -3597.387695, 21.760, 0, ''), +(3465, 9, -2020.677368, -3610.296143, 21.759, 0, ''), +(3465, 10, -2019.990845, -3640.155273, 21.759, 0, ''), +(3465, 11, -2016.110596, -3664.133301, 21.758, 0, ''), +(3465, 12, -1999.397095, -3679.435059, 21.316, 0, ''), +(3465, 13, -1987.455811, -3688.309326, 18.495, 0, ''), +(3465, 14, -1973.966553, -3687.666748, 14.996, 0, ''), +(3465, 15, -1949.163940, -3678.054932, 11.293, 0, ''), +(3465, 16, -1934.091187, -3682.859619, 9.897, 30000, 'SAY_GIL_AT_LAST'), +(3465, 17, -1935.383911, -3682.322021, 10.029, 1500, 'SAY_GIL_PROCEED'), +(3465, 18, -1879.039185, -3699.498047, 6.582, 7500, 'SAY_GIL_FREEBOOTERS'), +(3465, 19, -1852.728149, -3703.778809, 6.875, 0, ''), +(3465, 20, -1812.989990, -3718.500732, 10.572, 0, ''), +(3465, 21, -1788.171265, -3722.867188, 9.663, 0, ''), +(3465, 22, -1767.206665, -3739.923096, 10.082, 0, ''), +(3465, 23, -1750.194580, -3747.392090, 10.390, 0, ''), +(3465, 24, -1729.335571, -3776.665527, 11.779, 0, ''), +(3465, 25, -1715.997925, -3802.404541, 12.618, 0, ''), +(3465, 26, -1690.711548, -3829.262451, 13.905, 0, ''), +(3465, 27, -1674.700684, -3842.398682, 13.872, 0, ''), +(3465, 28, -1632.726318, -3846.109619, 14.401, 0, ''), +(3465, 29, -1592.734497, -3842.225342, 14.981, 0, ''), +(3465, 30, -1561.614746, -3839.320801, 19.118, 0, ''), +(3465, 31, -1544.567627, -3834.393311, 18.761, 0, ''), +(3465, 32, -1512.514404, -3831.715820, 22.914, 0, ''), +(3465, 33, -1486.889771, -3836.639893, 23.964, 0, ''), +(3465, 34, -1434.193604, -3852.702881, 18.843, 0, ''), +(3465, 35, -1405.794678, -3854.488037, 17.276, 0, ''), +(3465, 36, -1366.592041, -3852.383789, 19.273, 0, ''), +(3465, 37, -1337.360962, -3837.827148, 17.352, 2000, 'SAY_GIL_ALMOST'), +(3465, 38, -1299.744507, -3810.691406, 20.801, 0, ''), +(3465, 39, -1277.144409, -3782.785156, 25.918, 0, ''), +(3465, 40, -1263.686768, -3781.251953, 26.447, 0, ''), +(3465, 41, -1243.674438, -3786.328125, 25.281, 0, ''), +(3465, 42, -1221.875488, -3784.124512, 24.051, 0, ''), +(3465, 43, -1204.011230, -3775.943848, 24.437, 0, ''), +(3465, 44, -1181.706787, -3768.934082, 23.368, 0, ''), +(3465, 45, -1156.913818, -3751.559326, 21.074, 0, ''), +(3465, 46, -1138.830688, -3741.809326, 17.843, 0, ''), +(3465, 47, -1080.101196, -3738.780029, 19.805, 0, 'SAY_GIL_SWEET'), +(3465, 48, -1069.065186, -3735.006348, 19.302, 0, ''), +(3465, 49, -1061.941040, -3724.062256, 21.086, 0, ''), +(3465, 50, -1053.593262, -3697.608643, 27.320, 0, ''), +(3465, 51, -1044.110474, -3690.133301, 24.856, 0, ''), +(3465, 52, -1040.260986, -3690.739014, 25.342, 0, ''), +(3465, 53, -1028.146606, -3688.718750, 23.843, 7500, 'SAY_GIL_FREED'); + DELETE FROM script_waypoint WHERE entry=10646; INSERT INTO script_waypoint VALUES (10646, 0, -4792.401855, -2137.775146, 82.423, 0, ''), diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 57c392494c..26e51a5534 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -182,6 +182,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_draenei_survivor' WHERE `entry` /* BARRENS */ UPDATE `creature_template` SET `ScriptName`='npc_beaten_corpse' WHERE `entry`=10668; +UPDATE `creature_template` SET `ScriptName`='npc_gilthares' WHERE `entry`=3465; UPDATE `creature_template` SET `ScriptName`='npc_sputtervalve' WHERE `entry`=3442; UPDATE `creature_template` SET `ScriptName`='npc_taskmaster_fizzule' WHERE `entry`=7233; UPDATE `creature_template` SET `ScriptName`='npc_twiggy_flathead' WHERE `entry`=6248; diff --git a/sql/updates/5001_world_scripts.sql b/sql/updates/5001_world_scripts.sql new file mode 100644 index 0000000000..37a4a8620a --- /dev/null +++ b/sql/updates/5001_world_scripts.sql @@ -0,0 +1,112 @@ +UPDATE creature_template SET ScriptName='npc_gilthares' WHERE entry=3465; + +DELETE FROM script_waypoint WHERE entry=3465; +INSERT INTO script_waypoint VALUES +(3465, 0, -2095.840820, -3650.001221, 61.716, 0, ''), +(3465, 1, -2100.193604, -3613.949219, 61.604, 0, ''), +(3465, 2, -2098.549561, -3601.557129, 59.154, 0, ''), +(3465, 3, -2093.796387, -3595.234375, 56.658, 0, ''), +(3465, 4, -2072.575928, -3578.827637, 48.844, 0, ''), +(3465, 5, -2023.858398, -3568.146240, 24.636, 0, ''), +(3465, 6, -2013.576416, -3571.499756, 22.203, 0, ''), +(3465, 7, -2009.813721, -3580.547852, 21.791, 0, ''), +(3465, 8, -2015.296021, -3597.387695, 21.760, 0, ''), +(3465, 9, -2020.677368, -3610.296143, 21.759, 0, ''), +(3465, 10, -2019.990845, -3640.155273, 21.759, 0, ''), +(3465, 11, -2016.110596, -3664.133301, 21.758, 0, ''), +(3465, 12, -1999.397095, -3679.435059, 21.316, 0, ''), +(3465, 13, -1987.455811, -3688.309326, 18.495, 0, ''), +(3465, 14, -1973.966553, -3687.666748, 14.996, 0, ''), +(3465, 15, -1949.163940, -3678.054932, 11.293, 0, ''), +(3465, 16, -1934.091187, -3682.859619, 9.897, 30000, 'SAY_GIL_AT_LAST'), +(3465, 17, -1935.383911, -3682.322021, 10.029, 1500, 'SAY_GIL_PROCEED'), +(3465, 18, -1879.039185, -3699.498047, 6.582, 7500, 'SAY_GIL_FREEBOOTERS'), +(3465, 19, -1852.728149, -3703.778809, 6.875, 0, ''), +(3465, 20, -1812.989990, -3718.500732, 10.572, 0, ''), +(3465, 21, -1788.171265, -3722.867188, 9.663, 0, ''), +(3465, 22, -1767.206665, -3739.923096, 10.082, 0, ''), +(3465, 23, -1750.194580, -3747.392090, 10.390, 0, ''), +(3465, 24, -1729.335571, -3776.665527, 11.779, 0, ''), +(3465, 25, -1715.997925, -3802.404541, 12.618, 0, ''), +(3465, 26, -1690.711548, -3829.262451, 13.905, 0, ''), +(3465, 27, -1674.700684, -3842.398682, 13.872, 0, ''), +(3465, 28, -1632.726318, -3846.109619, 14.401, 0, ''), +(3465, 29, -1592.734497, -3842.225342, 14.981, 0, ''), +(3465, 30, -1561.614746, -3839.320801, 19.118, 0, ''), +(3465, 31, -1544.567627, -3834.393311, 18.761, 0, ''), +(3465, 32, -1512.514404, -3831.715820, 22.914, 0, ''), +(3465, 33, -1486.889771, -3836.639893, 23.964, 0, ''), +(3465, 34, -1434.193604, -3852.702881, 18.843, 0, ''), +(3465, 35, -1405.794678, -3854.488037, 17.276, 0, ''), +(3465, 36, -1366.592041, -3852.383789, 19.273, 0, ''), +(3465, 37, -1337.360962, -3837.827148, 17.352, 2000, 'SAY_GIL_ALMOST'), +(3465, 38, -1299.744507, -3810.691406, 20.801, 0, ''), +(3465, 39, -1277.144409, -3782.785156, 25.918, 0, ''), +(3465, 40, -1263.686768, -3781.251953, 26.447, 0, ''), +(3465, 41, -1243.674438, -3786.328125, 25.281, 0, ''), +(3465, 42, -1221.875488, -3784.124512, 24.051, 0, ''), +(3465, 43, -1204.011230, -3775.943848, 24.437, 0, ''), +(3465, 44, -1181.706787, -3768.934082, 23.368, 0, ''), +(3465, 45, -1156.913818, -3751.559326, 21.074, 0, ''), +(3465, 46, -1138.830688, -3741.809326, 17.843, 0, ''), +(3465, 47, -1080.101196, -3738.780029, 19.805, 0, 'SAY_GIL_SWEET'), +(3465, 48, -1069.065186, -3735.006348, 19.302, 0, ''), +(3465, 49, -1061.941040, -3724.062256, 21.086, 0, ''), +(3465, 50, -1053.593262, -3697.608643, 27.320, 0, ''), +(3465, 51, -1044.110474, -3690.133301, 24.856, 0, ''), +(3465, 52, -1040.260986, -3690.739014, 25.342, 0, ''), +(3465, 53, -1028.146606, -3688.718750, 23.843, 7500, 'SAY_GIL_FREED'); + +DELETE FROM script_waypoint WHERE entry=21027; +INSERT INTO script_waypoint VALUES +(21027, 0, -2714.697266, 1326.879395, 34.306953, 0, ''), +(21027, 1, -2666.364990, 1348.222656, 34.445557, 0, ''), +(21027, 2, -2693.789307, 1336.964966, 34.445557, 0, ''), +(21027, 3, -2715.495361, 1328.054443, 34.106014, 0, ''), +(21027, 4, -2742.530762, 1314.138550, 33.606144, 0, ''), +(21027, 5, -2745.077148, 1311.108765, 33.630898, 0, ''), +(21027, 6, -2749.855225, 1302.737915, 33.475632, 0, ''), +(21027, 7, -2753.639648, 1294.059448, 33.314930, 0, ''), +(21027, 8, -2756.796387, 1285.122192, 33.391262, 0, ''), +(21027, 9, -2750.042969, 1273.661987, 33.188259, 0, ''), +(21027, 10, -2740.378418, 1258.846680, 33.212521, 0, ''), +(21027, 11, -2733.629395, 1248.259766, 33.640598, 0, ''), +(21027, 12, -2727.212646, 1238.606445, 33.520847, 0, ''), +(21027, 13, -2726.377197, 1237.264526, 33.461823, 3000, 'SAY_WIL_PROGRESS1'), +(21027, 14, -2746.383301, 1266.390625, 33.191952, 2000, ''), +(21027, 15, -2746.383301, 1266.390625, 33.191952, 4000, 'SAY_WIL_FIND_EXIT'), +(21027, 16, -2758.927734, 1285.134155, 33.341728, 0, ''), +(21027, 17, -2761.845703, 1292.313599, 33.209042, 0, ''), +(21027, 18, -2758.871826, 1300.677612, 33.285332, 0, ''), +(21027, 19, -2753.928955, 1307.755859, 33.452457, 0, ''), +(21027, 20, -2738.612061, 1316.191284, 33.482975, 0, ''), +(21027, 21, -2727.897461, 1320.013916, 33.381111, 0, ''), +(21027, 22, -2709.458740, 1315.739990, 33.301838, 0, ''), +(21027, 23, -2704.658936, 1301.620361, 32.463303, 0, ''), +(21027, 24, -2704.120117, 1298.922607, 32.768162, 0, ''), +(21027, 25, -2691.798340, 1292.846436, 33.852642, 0, ''), +(21027, 26, -2682.879639, 1288.853882, 32.995399, 0, ''), +(21027, 27, -2661.869141, 1279.682495, 26.686783, 0, ''), +(21027, 28, -2648.943604, 1270.272827, 24.147522, 0, ''), +(21027, 29, -2642.506836, 1262.938721, 23.512444, 0, ''), +(21027, 30, -2636.984863, 1252.429077, 20.418257, 0, ''), +(21027, 31, -2648.113037, 1224.984863, 8.691818, 0, ''), +(21027, 32, -2658.393311, 1200.136719, 5.492243, 0, ''), +(21027, 33, -2668.504395, 1190.450562, 3.127407, 0, ''), +(21027, 34, -2685.930420, 1174.360840, 5.163924, 0, ''), +(21027, 35, -2701.613770, 1160.026367, 5.611311, 0, ''), +(21027, 36, -2714.659668, 1149.980347, 4.342373, 0, ''), +(21027, 37, -2721.443359, 1145.002808, 1.913474, 0, ''), +(21027, 38, -2733.962158, 1143.436279, 2.620415, 0, ''), +(21027, 39, -2757.876709, 1146.937500, 6.184002, 2000, 'SAY_WIL_JUST_AHEAD'), +(21027, 40, -2772.300537, 1166.052734, 6.331811, 0, ''), +(21027, 41, -2790.265381, 1189.941650, 5.207958, 0, ''), +(21027, 42, -2805.448975, 1208.663940, 5.557623, 0, ''), +(21027, 43, -2820.617676, 1225.870239, 6.266103, 0, ''), +(21027, 44, -2831.926758, 1237.725830, 5.808506, 0, ''), +(21027, 45, -2842.578369, 1252.869629, 6.807481, 0, ''), +(21027, 46, -2846.344971, 1258.727295, 7.386168, 0, ''), +(21027, 47, -2847.556396, 1266.771729, 8.208790, 0, ''), +(21027, 48, -2841.654541, 1285.809204, 7.933223, 0, ''), +(21027, 49, -2841.754883, 1289.832520, 6.990304, 0, ''), +(21027, 50, -2871.398438, 1302.348145, 6.807335, 7500, 'SAY_WIL_END'); diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp index 48991193e5..b04c349eb9 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp @@ -20,27 +20,53 @@ enum extern std::list PointMovementList; -void npc_escortAI::AttackStart(Unit *who) +void npc_escortAI::AttackStart(Unit* pWho) { - if (!who) + if (!pWho) return; - if (m_creature->Attack(who, true)) + if (m_creature->Attack(pWho, true)) { if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) m_creature->GetMotionMaster()->MovementExpired(); if (IsCombatMovement()) - m_creature->GetMotionMaster()->MoveChase(who); + m_creature->GetMotionMaster()->MoveChase(pWho); } } -void npc_escortAI::MoveInLineOfSight(Unit *who) +void npc_escortAI::MoveInLineOfSight(Unit* pWho) { if (IsBeingEscorted && !m_bIsActiveAttacker) return; - ScriptedAI::MoveInLineOfSight(who); + ScriptedAI::MoveInLineOfSight(pWho); +} + +void npc_escortAI::JustDied(Unit* pKiller) +{ + if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) + return; + + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + if (Player* pMember = pRef->getSource()) + { + if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } + } + else + { + if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } } void npc_escortAI::JustRespawned() @@ -51,7 +77,11 @@ void npc_escortAI::JustRespawned() if (!IsCombatMovement()) SetCombatMovement(true); - m_uiWPWaitTimer = 0; + //add a small delay before going to first waypoint, normal in near all cases + m_uiWPWaitTimer = 2500; + + if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) + me->RestoreFaction(); Reset(); } @@ -82,12 +112,12 @@ void npc_escortAI::EnterEvadeMode() Reset(); } -void npc_escortAI::UpdateAI(const uint32 diff) +void npc_escortAI::UpdateAI(const uint32 uiDiff) { //Waypoint Updating if (IsBeingEscorted && !m_creature->getVictim() && m_uiWPWaitTimer && !m_bIsReturning) { - if (m_uiWPWaitTimer <= diff) + if (m_uiWPWaitTimer <= uiDiff) { //End of the line if (CurrentWP == WaypointList.end()) @@ -133,13 +163,15 @@ void npc_escortAI::UpdateAI(const uint32 diff) debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); m_uiWPWaitTimer = 0; } - }else m_uiWPWaitTimer -= diff; + } + else + m_uiWPWaitTimer -= uiDiff; } //Check if player or any member of his group is within range if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) { - if (m_uiPlayerCheckTimer < diff) + if (m_uiPlayerCheckTimer < uiDiff) { bool bIsMaxRangeExceeded = true; @@ -167,9 +199,7 @@ void npc_escortAI::UpdateAI(const uint32 diff) if (DespawnAtFar && bIsMaxRangeExceeded) { - debug_log("TSCR: EscortAI Evaded back to spawn point because player/group was to far away or not found"); - - JustDied(m_creature); + debug_log("TSCR: EscortAI failed because player/group was to far away or not found"); if (m_bCanInstantRespawn) { @@ -183,20 +213,22 @@ void npc_escortAI::UpdateAI(const uint32 diff) } m_uiPlayerCheckTimer = 1000; - }else m_uiPlayerCheckTimer -= diff; + } + else + m_uiPlayerCheckTimer -= uiDiff; } if (CanMelee && UpdateVictim()) DoMeleeAttackIfReady(); } -void npc_escortAI::MovementInform(uint32 type, uint32 id) +void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) { - if (type != POINT_MOTION_TYPE || !IsBeingEscorted) + if (uiMoveType != POINT_MOTION_TYPE || !IsBeingEscorted) return; //Combat start position reached, continue waypoint movement - if (id == POINT_LAST_POINT) + if (uiPointId == POINT_LAST_POINT) { debug_log("TSCR: EscortAI has returned to original position before combat"); @@ -210,7 +242,7 @@ void npc_escortAI::MovementInform(uint32 type, uint32 id) if (!m_uiWPWaitTimer) m_uiWPWaitTimer = 1; } - else if (id == POINT_HOME) + else if (uiPointId == POINT_HOME) { debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); @@ -220,9 +252,9 @@ void npc_escortAI::MovementInform(uint32 type, uint32 id) else { //Make sure that we are still on the right waypoint - if (CurrentWP->id != id) + if (CurrentWP->id != uiPointId) { - debug_log("TSCR ERROR: EscortAI reached waypoint out of order %d, expected %d", id, CurrentWP->id); + debug_log("TSCR ERROR: EscortAI reached waypoint out of order %d, expected %d", uiPointId, CurrentWP->id); return; } @@ -352,8 +384,5 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, else m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - //Start WP - m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - debug_log("TSCR: EscortAI Next WP is: %d, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); IsBeingEscorted = true; } diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h index cda331e612..90a99152b6 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.h +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h @@ -31,7 +31,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI { public: explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), - IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(0), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false) {} + IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false) {} ~npc_escortAI() {} // Pure Virtual Functions @@ -42,6 +42,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI void MoveInLineOfSight(Unit* who); + void JustDied(Unit*); + void JustRespawned(); void ReturnToLastPoint(); diff --git a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp index 45261fb745..98d589ed00 100644 --- a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp @@ -88,7 +88,6 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI void Reset() { m_bCompleted = true; - m_creature->setFaction(35); } void EnterCombat(Unit* who) @@ -96,16 +95,6 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI DoScriptText(SAY_AGGRO, m_creature, NULL); } - void JustDied(Unit* killer) - { - if (PlayerGUID && !m_bCompleted) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->FailQuest(QUEST_SUNKEN_TREASURE); - } - } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp index 646192c983..3fd7d1ef79 100644 --- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp +++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp @@ -106,18 +106,6 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) - { - if (killer->GetEntry() == m_creature->GetEntry()) - return; - - if (PlayerGUID && !Completed) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_TOREK_ASSULT); - } - } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); @@ -212,9 +200,6 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI void Reset() { - if (!IsBeingEscorted) - m_creature->setFaction(1602); - GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20); if (Cage) Cage->SetGoState(GO_STATE_READY); @@ -225,16 +210,6 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->FailQuest(QUEST_FREEDOM_TO_RUUL); - } - } - void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp index 414a2468b5..8fc97d4022 100644 --- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp @@ -367,26 +367,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI DoScriptText(SAY_AGGRO, m_creature, who); } - void Reset() - { - if (!IsBeingEscorted) - m_creature->setFaction(80); - } - - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - pPlayer->FailQuest(QUEST_A_CRY_FOR_SAY_HELP); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void Reset() { } }; bool QuestAccept_npc_magwin(Player* pPlayer, Creature* pCreature, Quest const* quest) diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp index 4fc39d1dcd..0d6d176fd4 100644 --- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp +++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp @@ -17,12 +17,13 @@ /* ScriptData SDName: The_Barrens SD%Complete: 90 -SDComment: Quest support: 2458, 4921, 6981, 1719, 863 +SDComment: Quest support: 863, 898, 1719, 2458, 4921, 6981, SDCategory: Barrens EndScriptData */ /* ContentData npc_beaten_corpse +npc_gilthares npc_sputtervalve npc_taskmaster_fizzule npc_twiggy_flathead @@ -62,6 +63,111 @@ bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 return true; } +/*###### +# npc_gilthares +######*/ + +enum +{ + SAY_GIL_START = -1000370, + SAY_GIL_AT_LAST = -1000371, + SAY_GIL_PROCEED = -1000372, + SAY_GIL_FREEBOOTERS = -1000373, + SAY_GIL_AGGRO_1 = -1000374, + SAY_GIL_AGGRO_2 = -1000375, + SAY_GIL_AGGRO_3 = -1000376, + SAY_GIL_AGGRO_4 = -1000377, + SAY_GIL_ALMOST = -1000378, + SAY_GIL_SWEET = -1000379, + SAY_GIL_FREED = -1000380, + + QUEST_FREE_FROM_HOLD = 898, + AREA_MERCHANT_COAST = 391, + FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest +}; + +struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI +{ + npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 16: + DoScriptText(SAY_GIL_AT_LAST, m_creature, pPlayer); + break; + case 17: + DoScriptText(SAY_GIL_PROCEED, m_creature, pPlayer); + break; + case 18: + DoScriptText(SAY_GIL_FREEBOOTERS, m_creature, pPlayer); + break; + case 37: + DoScriptText(SAY_GIL_ALMOST, m_creature, pPlayer); + break; + case 47: + DoScriptText(SAY_GIL_SWEET, m_creature, pPlayer); + break; + case 53: + DoScriptText(SAY_GIL_FREED, m_creature, pPlayer); + pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, m_creature); + break; + } + } + + void Aggro(Unit* pWho) + { + //not always use + if (rand()%4) + return; + + //only aggro text if not player and only in this area + if (pWho->GetTypeId() != TYPEID_PLAYER && m_creature->GetAreaId() == AREA_MERCHANT_COAST) + { + //appears to be pretty much random (possible only if escorter not in combat with pWho yet?) + switch(rand()%4) + { + case 0: DoScriptText(SAY_GIL_AGGRO_1, m_creature, pWho); break; + case 1: DoScriptText(SAY_GIL_AGGRO_2, m_creature, pWho); break; + case 2: DoScriptText(SAY_GIL_AGGRO_3, m_creature, pWho); break; + case 3: DoScriptText(SAY_GIL_AGGRO_4, m_creature, pWho); break; + } + } + } +}; + +CreatureAI* GetAI_npc_gilthares(Creature* pCreature) +{ + npc_giltharesAI* pTempAI = new npc_giltharesAI(pCreature); + + pTempAI->FillPointMovementListForCreature(); + + return (CreatureAI*)pTempAI; +} + +bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) + { + pCreature->setFaction(FACTION_ESCORTEE); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + DoScriptText(SAY_GIL_START, pCreature, pPlayer); + + if (npc_giltharesAI* pEscortAI = CAST_AI(npc_giltharesAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return true; +} + /*###### ## npc_sputtervalve ######*/ @@ -424,12 +530,7 @@ enum struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { - npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) - { - uiNormFaction = c->getFaction(); - } - - uint32 uiNormFaction; + npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) { } bool Completed; @@ -475,28 +576,10 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI Completed = false; if (!IsBeingEscorted) { - m_creature->setFaction(uiNormFaction); if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) m_creature->SetStandState(UNIT_STAND_STATE_STAND); } } - - void EnterCombat(Unit* who){} - - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - pPlayer->FailQuest(QUEST_ESCAPE); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -560,6 +643,12 @@ void AddSC_the_barrens() newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse; newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_gilthares"; + newscript->GetAI = &GetAI_npc_gilthares; + newscript->pQuestAccept = &QuestAccept_npc_gilthares; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name="npc_sputtervalve"; newscript->pGossipHello = &GossipHello_npc_sputtervalve; diff --git a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp index 7383b2b23c..f0320a5e44 100644 --- a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp +++ b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp @@ -80,12 +80,7 @@ enum struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI { - npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) - { - normFaction = pCreature->getFaction(); - } - - uint32 normFaction; + npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } void WaypointReached(uint32 i) { @@ -127,10 +122,7 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI void Reset() { if (!IsBeingEscorted) - { - m_creature->setFaction(normFaction); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); - } } void EnterCombat(Unit* who) @@ -147,24 +139,6 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI { summoned->AI()->AttackStart(m_creature); } - - void JustDied(Unit* killer) - { - if (!IsBeingEscorted) - return; - - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - { - // If NPC dies, player fails the quest - if (pPlayer->GetQuestStatus(QUEST_RESCUE_OOX22FE) != QUEST_STATUS_COMPLETE) - pPlayer->FailQuest(QUEST_RESCUE_OOX22FE); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_oox22fe(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index f1cf968835..94c45af786 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -213,31 +213,10 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI } } - void EnterCombat(Unit* who) {} - void Reset() { - if (!IsBeingEscorted) - m_creature->setFaction(1602); - - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20); - if (Cage) - Cage->SetGoState(GO_STATE_READY); - } - - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_READY); } }; diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp index 5aaf6e342b..ec2f1c91f1 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp @@ -181,11 +181,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI } } - void Reset() - { - if (!IsBeingEscorted) - m_creature->setFaction(1604); - } + void Reset() { } void EnterCombat(Unit* who) { @@ -197,25 +193,6 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI { summoned->AI()->AttackStart(m_creature); } - - void JustDied(Unit* killer) - { - if (!IsBeingEscorted) - return; - - if (PlayerGUID) - { - // If NPC dies, player fails the quest - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - pPlayer->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_wounded_blood_elf(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp index 77d8b52cd1..04cc014086 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp @@ -855,211 +855,184 @@ bool QuestAccept_npc_overlord_morghor(Player* pPlayer, Creature* pCreature, cons # npc_earthmender_wilda ####*/ -#define SAY_START -1000223 -#define SAY_AGGRO1 -1000224 -#define SAY_AGGRO2 -1000225 -#define ASSASSIN_SAY_AGGRO1 -1000226 -#define ASSASSIN_SAY_AGGRO2 -1000227 -#define SAY_PROGRESS1 -1000228 -#define SAY_PROGRESS2 -1000229 -#define SAY_PROGRESS3 -1000230 -#define SAY_PROGRESS4 -1000231 -#define SAY_PROGRESS5 -1000232 -#define SAY_PROGRESS6 -1000233 -#define SAY_END -1000234 +enum +{ + SAY_WIL_START = -1000381, + SAY_WIL_AGGRO1 = -1000382, + SAY_WIL_AGGRO2 = -1000383, + SAY_WIL_PROGRESS1 = -1000384, + SAY_WIL_PROGRESS2 = -1000385, + SAY_WIL_FIND_EXIT = -1000386, + SAY_WIL_PROGRESS4 = -1000387, + SAY_WIL_PROGRESS5 = -1000388, + SAY_WIL_JUST_AHEAD = -1000389, + SAY_WIL_END = -1000390, -#define QUEST_ESCAPE_FROM_COILSKAR_CISTERN 10451 -#define NPC_COILSKAR_ASSASSIN 21044 + SPELL_CHAIN_LIGHTNING = 16006, + SPELL_EARTHBING_TOTEM = 15786, + SPELL_FROST_SHOCK = 12548, + SPELL_HEALING_WAVE = 12491, + + QUEST_ESCAPE_COILSCAR = 10451, + NPC_COILSKAR_ASSASSIN = 21044, + FACTION_EARTHEN = 1726 //guessed +}; struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI { - npc_earthmender_wildaAI(Creature *c) : npc_escortAI(c) {} + npc_earthmender_wildaAI(Creature* pCreature) : npc_escortAI(pCreature) { } - bool Completed; - - void EnterCombat(Unit *who) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN) - DoScriptText(SAY_AGGRO2, m_creature, pPlayer); - else DoScriptText(SAY_AGGRO1, m_creature, pPlayer); - } + uint32 m_uiHealingTimer; void Reset() { - m_creature->setFaction(1726); - Completed = false; + m_uiHealingTimer = 0; } - void WaypointReached(uint32 i) + void WaypointReached(uint32 uiPointId) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); if (!pPlayer) return; - switch(i) + switch(uiPointId) { - case 0: DoScriptText(SAY_START, m_creature, pPlayer); break; - case 13: DoScriptText(SAY_PROGRESS1, m_creature, pPlayer); - SummonAssassin(); - break; - case 14: SummonAssassin(); break; - case 15: DoScriptText(SAY_PROGRESS3, m_creature, pPlayer); break; - case 19: - switch(rand()%3) - { - case 0: DoScriptText(SAY_PROGRESS2, m_creature, pPlayer); break; - case 1: DoScriptText(SAY_PROGRESS4, m_creature, pPlayer); break; - case 2: DoScriptText(SAY_PROGRESS5, m_creature, pPlayer); break; - } - break; - case 20: SummonAssassin(); break; - case 26: - switch(rand()%3) - { - case 0: DoScriptText(SAY_PROGRESS2, m_creature, pPlayer); break; - case 1: DoScriptText(SAY_PROGRESS4, m_creature, pPlayer); break; - case 2: DoScriptText(SAY_PROGRESS5, m_creature, pPlayer); break; - } - break; - case 27: SummonAssassin(); break; - case 33: - switch(rand()%3) - { - case 0: DoScriptText(SAY_PROGRESS2, m_creature, pPlayer); break; - case 1: DoScriptText(SAY_PROGRESS4, m_creature, pPlayer); break; - case 2: DoScriptText(SAY_PROGRESS5, m_creature, pPlayer); break; - } - break; - case 34: SummonAssassin(); break; - case 37: - switch(rand()%3) - { - case 0: DoScriptText(SAY_PROGRESS2, m_creature, pPlayer); break; - case 1: DoScriptText(SAY_PROGRESS4, m_creature, pPlayer); break; - case 2: DoScriptText(SAY_PROGRESS5, m_creature, pPlayer); break; - } - break; - case 38: SummonAssassin(); break; - case 39: DoScriptText(SAY_PROGRESS6, m_creature, pPlayer); break; - case 43: - switch(rand()%3) - { - case 0: DoScriptText(SAY_PROGRESS2, m_creature, pPlayer); break; - case 1: DoScriptText(SAY_PROGRESS4, m_creature, pPlayer); break; - case 2: DoScriptText(SAY_PROGRESS5, m_creature, pPlayer); break; - } - break; - case 44: SummonAssassin(); break; - case 50: - DoScriptText(SAY_END, m_creature, pPlayer); - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_COILSKAR_CISTERN, m_creature); - Completed = true; - break; - } - } + case 13: + DoScriptText(SAY_WIL_PROGRESS1, m_creature, pPlayer); + DoSpawnAssassin(); + break; + case 14: + DoSpawnAssassin(); + break; + case 15: + DoScriptText(SAY_WIL_FIND_EXIT, m_creature, pPlayer); + break; + case 19: + DoRandomSay(); + break; + case 20: + DoSpawnAssassin(); + break; + case 26: + DoRandomSay(); + break; + case 27: + DoSpawnAssassin(); + break; + case 33: + DoRandomSay(); + break; + case 34: + DoSpawnAssassin(); + break; + case 37: + DoRandomSay(); + break; + case 38: + DoSpawnAssassin(); + break; + case 39: + DoScriptText(SAY_WIL_JUST_AHEAD, m_creature, pPlayer); + break; + case 43: + DoRandomSay(); + break; + case 44: + DoSpawnAssassin(); + break; + case 50: + DoScriptText(SAY_WIL_END, m_creature, pPlayer); - void SummonAssassin() - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature); + break; + } + } - Unit* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); - if (CoilskarAssassin) - { - switch(rand()%2) - { - case 0: DoScriptText(ASSASSIN_SAY_AGGRO1, CoilskarAssassin, pPlayer); break; - case 1: DoScriptText(ASSASSIN_SAY_AGGRO2, CoilskarAssassin, pPlayer); break; - } - CAST_CRE(CoilskarAssassin)->AI()->AttackStart(m_creature); - } - else error_log("TSCR ERROR: Coilskar Assassin couldn't be summmoned"); - } + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_COILSKAR_ASSASSIN) + pSummoned->AI()->AttackStart(m_creature); + } - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN); - } - } + //this is very unclear, random say without no real relevance to script/event + void DoRandomSay() + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_WIL_PROGRESS2, m_creature); break; + case 1: DoScriptText(SAY_WIL_PROGRESS4, m_creature); break; + case 2: DoScriptText(SAY_WIL_PROGRESS5, m_creature); break; + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void DoSpawnAssassin() + { + //unknown where they actually appear + float fX, fY, fZ; + m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 15.0f, fX, fY, fZ); + + m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, fX, fY, fZ, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } + + void Aggro(Unit* pWho) + { + //don't always use + if (rand()%5) + return; + + //only aggro text if not player + if (pWho->GetTypeId() != TYPEID_PLAYER) + { + //appears to be random + switch(rand()%4) + { + case 0: DoScriptText(SAY_WIL_AGGRO1, m_creature, pWho); break; + case 1: DoScriptText(SAY_WIL_AGGRO2, m_creature, pWho); break; + } + } + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //TODO: add more abilities + if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30) + { + if (m_uiHealingTimer < uiDiff) + { + DoCast(m_creature, SPELL_HEALING_WAVE); + m_uiHealingTimer = 15000; + } + else + m_uiHealingTimer -= uiDiff; + } + } }; -CreatureAI* GetAI_npc_earthmender_wildaAI(Creature* pCreature) +CreatureAI* GetAI_npc_earthmender_wilda(Creature* pCreature) { - npc_earthmender_wildaAI* earthmender_wildaAI = new npc_earthmender_wildaAI(pCreature); + npc_earthmender_wildaAI* pTempAI = new npc_earthmender_wildaAI(pCreature); - earthmender_wildaAI->AddWaypoint(0, -2637.466064, 1359.977905, 35.889114, 2000); // SAY_START - earthmender_wildaAI->AddWaypoint(1, -2666.364990, 1348.222656, 34.445557); - earthmender_wildaAI->AddWaypoint(2, -2693.789307, 1336.964966, 34.445557); - earthmender_wildaAI->AddWaypoint(3, -2715.495361, 1328.054443, 34.106014); - earthmender_wildaAI->AddWaypoint(4, -2742.530762, 1314.138550, 33.606144); - earthmender_wildaAI->AddWaypoint(5, -2745.077148, 1311.108765, 33.630898); - earthmender_wildaAI->AddWaypoint(6, -2749.855225, 1302.737915, 33.475632); - earthmender_wildaAI->AddWaypoint(7, -2753.639648, 1294.059448, 33.314930); - earthmender_wildaAI->AddWaypoint(8, -2756.796387, 1285.122192, 33.391262); - earthmender_wildaAI->AddWaypoint(9, -2750.042969, 1273.661987, 33.188259); - earthmender_wildaAI->AddWaypoint(10, -2740.378418, 1258.846680, 33.212521); - earthmender_wildaAI->AddWaypoint(11, -2733.629395, 1248.259766, 33.640598); - earthmender_wildaAI->AddWaypoint(12, -2727.212646, 1238.606445, 33.520847); - earthmender_wildaAI->AddWaypoint(13, -2726.377197, 1237.264526, 33.461823, 4000); // SAY_PROGRESS1 - earthmender_wildaAI->AddWaypoint(14, -2746.383301, 1266.390625, 33.191952, 2000); - earthmender_wildaAI->AddWaypoint(15, -2746.383301, 1266.390625, 33.191952, 4000); // SAY_PROGRESS3 - earthmender_wildaAI->AddWaypoint(16, -2758.927734, 1285.134155, 33.341728); - earthmender_wildaAI->AddWaypoint(17, -2761.845703, 1292.313599, 33.209042); - earthmender_wildaAI->AddWaypoint(18, -2758.871826, 1300.677612, 33.285332); - earthmender_wildaAI->AddWaypoint(19, -2758.871826, 1300.677612, 33.285332); - earthmender_wildaAI->AddWaypoint(20, -2753.928955, 1307.755859, 33.452457); - earthmender_wildaAI->AddWaypoint(20, -2738.612061, 1316.191284, 33.482975); - earthmender_wildaAI->AddWaypoint(21, -2727.897461, 1320.013916, 33.381111); - earthmender_wildaAI->AddWaypoint(22, -2709.458740, 1315.739990, 33.301838); - earthmender_wildaAI->AddWaypoint(23, -2704.658936, 1301.620361, 32.463303); - earthmender_wildaAI->AddWaypoint(24, -2704.120117, 1298.922607, 32.768162); - earthmender_wildaAI->AddWaypoint(25, -2691.798340, 1292.846436, 33.852642); - earthmender_wildaAI->AddWaypoint(26, -2682.879639, 1288.853882, 32.995399); - earthmender_wildaAI->AddWaypoint(27, -2661.869141, 1279.682495, 26.686783); - earthmender_wildaAI->AddWaypoint(28, -2648.943604, 1270.272827, 24.147522); - earthmender_wildaAI->AddWaypoint(29, -2642.506836, 1262.938721, 23.512444); - earthmender_wildaAI->AddWaypoint(20, -2636.984863, 1252.429077, 20.418257); - earthmender_wildaAI->AddWaypoint(31, -2648.113037, 1224.984863, 8.691818); - earthmender_wildaAI->AddWaypoint(32, -2658.393311, 1200.136719, 5.492243); - earthmender_wildaAI->AddWaypoint(33, -2668.504395, 1190.450562, 3.127407); - earthmender_wildaAI->AddWaypoint(34, -2685.930420, 1174.360840, 5.163924); - earthmender_wildaAI->AddWaypoint(35, -2701.613770, 1160.026367, 5.611311); - earthmender_wildaAI->AddWaypoint(36, -2714.659668, 1149.980347, 4.342373); - earthmender_wildaAI->AddWaypoint(37, -2721.443359, 1145.002808, 1.913474); - earthmender_wildaAI->AddWaypoint(38, -2733.962158, 1143.436279, 2.620415); - earthmender_wildaAI->AddWaypoint(39, -2757.876709, 1146.937500, 6.184002, 2000); // SAY_PROGRESS6 - earthmender_wildaAI->AddWaypoint(40, -2772.300537, 1166.052734, 6.331811); - earthmender_wildaAI->AddWaypoint(41, -2790.265381, 1189.941650, 5.207958); - earthmender_wildaAI->AddWaypoint(42, -2805.448975, 1208.663940, 5.557623); - earthmender_wildaAI->AddWaypoint(43, -2820.617676, 1225.870239, 6.266103); - earthmender_wildaAI->AddWaypoint(44, -2831.926758, 1237.725830, 5.808506); - earthmender_wildaAI->AddWaypoint(45, -2842.578369, 1252.869629, 6.807481); - earthmender_wildaAI->AddWaypoint(46, -2846.344971, 1258.727295, 7.386168); - earthmender_wildaAI->AddWaypoint(47, -2847.556396, 1266.771729, 8.208790); - earthmender_wildaAI->AddWaypoint(48, -2841.654541, 1285.809204, 7.933223); - earthmender_wildaAI->AddWaypoint(49, -2841.754883, 1289.832520, 6.990304); - earthmender_wildaAI->AddWaypoint(50, -2871.398438, 1302.348145, 6.807335, 8000); // SAY_END + pTempAI->FillPointMovementListForCreature(); - return earthmender_wildaAI; + return (CreatureAI*)pTempAI; } -bool QuestAccept_npc_earthmender_wilda(Player* pPlayer, Creature* creature, Quest const* quest) +bool QuestAccept_npc_earthmender_wilda(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (quest->GetQuestId() == QUEST_ESCAPE_FROM_COILSKAR_CISTERN) + if (pQuest->GetQuestId() == QUEST_ESCAPE_COILSCAR) { - creature->setFaction(113); - CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, pPlayer->GetGUID()); + DoScriptText(SAY_WIL_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_EARTHEN); + + if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wildaAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } return true; } diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp index aee7c19e8e..7a9ee81af0 100644 --- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp @@ -159,11 +159,6 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI case 1: DoScriptText(SAY_AGGRO_2, m_creature, who);break; } } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Quest const* quest) diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp index 3cb0ed0aba..92cf659853 100644 --- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp @@ -128,23 +128,6 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI } void Reset(){} - - void EnterCombat(Unit* who){} - - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->FailQuest(QUEST_PROTECT_KAYA); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_kaya_flathoof(Player* pPlayer, Creature* pCreature, Quest const* quest) diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index 6b19c68711..a44aa564c2 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -407,24 +407,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI { summoned->AI()->AttackStart(m_creature); } - - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(Q_OOX17); - } - } - - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; - } - }; +}; bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* quest) { diff --git a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp index 7ce66b2843..c0b4f80691 100644 --- a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp @@ -22,6 +22,7 @@ SDCategory: Thousand Needles EndScriptData */ /* ContentData +npc_lakota_windsong npc_swiftmountain npc_plucky EndContentData */ @@ -96,15 +97,6 @@ struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } - - void JustDied(Unit* pKiller) - { - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) - { - if (pPlayer->GetQuestStatus(QUEST_FREE_AT_LAST) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_FREE_AT_LAST); - } - } }; CreatureAI* GetAI_npc_lakota_windsong(Creature* pCreature) @@ -182,15 +174,6 @@ struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); } - - void JustDied(Unit* pKiller) - { - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) - { - if (pPlayer->GetQuestStatus(QUEST_HOMEWARD) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_HOMEWARD); - } - } }; CreatureAI* GetAI_npc_paoka_swiftmountain(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp index f2329271df..50a0a8564e 100644 --- a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp +++ b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp @@ -144,15 +144,6 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI pSummoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - { - if (pPlayer->GetQuestStatus(QUEST_TOME_VALOR) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_TOME_VALOR); - } - } - void Update(const uint32 diff) { npc_escortAI::UpdateAI(diff); @@ -241,22 +232,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI } } - void Reset() - {} - - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - pPlayer->FailQuest(QUEST_DEFIAS_BROTHERHOOD); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void Reset() {} }; bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest) diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp index ccc1914867..c297819764 100644 --- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp @@ -282,8 +282,6 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI void Reset() { } - void EnterCombat(Unit* who){} - void WaypointReached(uint32 i) { Player* pUnit = Unit::GetPlayer(PlayerGUID); @@ -317,20 +315,6 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI break; } } - - void JustDied(Unit* killer) - { - if (Player* pUnit = Unit::GetPlayer(PlayerGUID)) - { - if (pUnit->GetQuestStatus(QUEST_ESCAPE_FROM) == QUEST_STATUS_INCOMPLETE) - pUnit->FailQuest(QUEST_ESCAPE_FROM); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_kayra_longmane(Player* pPlayer, Creature* pCreature, Quest const* pQuest)