diff options
31 files changed, 2021 insertions, 597 deletions
diff --git a/sql/FULL/world_script_waypoints.sql b/sql/FULL/world_script_waypoints.sql index 86aee4a71ac..940ef9920ce 100644 --- a/sql/FULL/world_script_waypoints.sql +++ b/sql/FULL/world_script_waypoints.sql @@ -13,6 +13,318 @@ 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 = 20415; +INSERT INTO script_waypoint VALUES +(20415 ,0, 2488.77, 2184.89, 104.64, 0, ''), +(20415 ,1, 2478.72, 2184.77, 98.58, 0, ''), +(20415 ,2, 2473.52, 2184.71, 99.00, 0, ''), +(20415 ,3, 2453.15, 2184.96, 97.09,4000, ''), +(20415 ,4, 2424.18, 2184.15, 94.11, 0, ''), +(20415 ,5, 2413.18, 2184.15, 93.42, 0, ''), +(20415 ,6, 2402.02, 2183.90, 87.59, 0, ''), +(20415 ,7, 2333.31, 2181.63, 90.03,4000, ''), +(20415 ,8, 2308.73, 2184.34, 92.04, 0, ''), +(20415 ,9, 2303.10, 2196.89, 94.94, 0, ''), +(20415 ,10, 2304.58, 2272.23, 96.67, 0, ''), +(20415 ,11, 2297.09, 2271.40, 95.16, 0, ''), +(20415 ,12, 2297.68, 2266.79, 95.07,4000, ''), +(20415 ,13, 2297.67, 2266.76, 95.07,4000, ''); + +DELETE FROM script_waypoint WHERE entry = 18760; +INSERT INTO script_waypoint VALUES +(18760 ,0, -2265.21, 3091.14, 13.91, 0, ''), +(18760 ,1, -2266.80, 3091.33, 13.82, 1000, ''), +(18760 ,2, -2268.20, 3091.14, 13.82, 7000, 'progress1'), +(18760 ,3, -2278.32, 3098.98, 13.82, 0, ''), +(18760 ,4, -2294.82, 3110.59, 13.82, 0, ''), +(18760 ,5, -2300.71, 3114.60, 13.82, 20000, 'progress2'), +(18760 ,6, -2300.71, 3114.60, 13.82, 3000, 'progress3'), +(18760 ,7, -2307.36, 3122.76, 13.79, 0, ''), +(18760 ,8, -2312.83, 3130.55, 12.04, 0, ''), +(18760 ,9, -2345.02, 3151.00, 8.38, 0, ''), +(18760 ,10, -2351.97, 3157.61, 6.27, 0, ''), +(18760 ,11, -2360.35, 3171.48, 3.31, 0, ''), +(18760 ,12, -2371.44, 3185.41, 0.89, 0, ''), +(18760 ,13, -2371.21, 3197.92, -0.96, 0, ''), +(18760 ,14, -2380.35, 3210.45, -1.08, 0, ''), +(18760 ,15, -2384.74, 3221.25, -1.17, 0, ''), +(18760 ,16, -2386.15, 3233.39, -1.29, 0, ''), +(18760 ,17, -2383.45, 3247.79, -1.32, 0, ''), +(18760 ,18, -2367.50, 3265.64, -1.33, 0, ''), +(18760 ,19, -2354.90, 3273.30, -1.50, 0, ''), +(18760 ,20, -2348.88, 3280.58, -0.09, 0, ''), +(18760 ,21, -2349.06, 3295.86, -0.95, 0, ''), +(18760 ,22, -2350.43, 3328.27, -2.10, 0, ''), +(18760 ,23, -2346.76, 3356.27, -2.82, 0, ''), +(18760 ,24, -2340.56, 3370.68, -4.02, 0, ''), +(18760 ,25, -2318.84, 3384.60, -7.61, 0, ''), +(18760 ,26, -2313.99, 3398.61, -10.40, 0, ''), +(18760 ,27, -2320.85, 3414.49, -11.49, 0, ''), +(18760 ,28, -2338.26, 3426.06, -11.46, 0, ''), +(18760 ,29, -2342.67, 3439.44, -11.32, 12000, 'progress4'), +(18760 ,30, -2342.67, 3439.44, -11.32, 7000, 'emote bye'), +(18760 ,31, -2342.67, 3439.44, -11.32, 5000, 'cat form'), +(18760 ,32, -2344.60, 3461.27, -10.44, 0, ''), +(18760 ,33, -2396.81, 3517.17, -3.55, 0, ''), +(18760 ,34, -2439.23, 3523.00, -1.05, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 9623; +INSERT INTO script_waypoint VALUES +(9623 ,1, -6380.38, -1965.14, -258.292, 5000, ''), +(9623 ,2, -6383.06, -1962.9, -258.936, 0, ''), +(9623 ,3, -6391.09, -1956.13, -260.291, 0, ''), +(9623 ,4, -6395.29, -1933.58, -262.949, 0, ''), +(9623 ,5, -6396.58, -1919.93, -263.838, 0, ''), +(9623 ,6, -6389.01, -1912.64, -260.689, 0, ''), +(9623 ,7, -6369.19, -1892.87, -255.924, 0, ''), +(9623 ,8, -6373.77, -1879.36, -259.268, 0, ''), +(9623 ,9, -6377.55, -1869.56, -260.503, 0, ''), +(9623 ,10, -6376.58, -1860.79, -260.026, 0, ''), +(9623 ,11, -6373.13, -1847.22, -259.249, 0, ''), +(9623 ,12, -6370.54, -1837.04, -260.007, 0, ''), +(9623 ,13, -6372.52, -1829.16, -260.071, 0, ''), +(9623 ,14, -6377.13, -1815.94, -262.632, 0, ''), +(9623 ,15, -6380.27, -1806.95, -265.53, 0, ''), +(9623 ,16, -6386.04, -1790.43, -268.546, 0, ''), +(9623 ,17, -6386.72, -1776.29, -269.851, 0, ''), +(9623 ,18, -6385.92, -1762.31, -271.494, 0, ''), +(9623 ,19, -6384.69, -1744.86, -272.196, 0, ''), +(9623 ,20, -6383.8, -1732.66, -272.222, 0, ''), +(9623 ,21, -6382.66, -1716.96, -272.235, 0, ''), +(9623 ,22, -6381.5, -1703.01, -272.964, 0, ''), +(9623 ,23, -6379.96, -1685.58, -272.842, 0, ''), +(9623 ,24, -6379.34, -1678.61, -272.34, 0, ''), +(9623 ,25, -6364.45, -1636.27, -271.065, 0, ''), +(9623 ,26, -6371.85, -1626.36, -272.188, 0, ''), +(9623 ,27, -6383.5, -1629.01, -272.206, 0, ''), +(9623 ,28, -6388.09, -1635.37, -272.105, 5000, ''), +(9623 ,29, -6375.42, -1637.33, -272.193, 0, ''), +(9623 ,30, -6365.46, -1617.25, -272.141, 0, ''), +(9623 ,31, -6353.79, -1603.48, -271.932, 0, ''), +(9623 ,32, -6340.24, -1592.41, -269.435, 0, ''), +(9623 ,33, -6329.45, -1566.89, -269.895, 0, ''), +(9623 ,34, -6312.2, -1499.06, -269.507, 0, ''), +(9623 ,35, -6304.55, -1468.5, -269.431, 0, ''), +(9623 ,36, -6310.36, -1440.94, -268.427, 0, ''), +(9623 ,37, -6321, -1418.91, -266.525, 0, ''), +(9623 ,38, -6358.76, -1389.97, -267.522, 0, ''), +(9623 ,39, -6378.65, -1375.67, -271.749, 0, ''), +(9623 ,40, -6387.22, -1360.95, -272.109, 0, ''), +(9623 ,41, -6406.95, -1323.87, -271.586, 0, ''), +(9623 ,42, -6405, -1311.92, -271.906, 0, ''), +(9623 ,43, -6395.56, -1303.62, -271.902, 0, ''), +(9623 ,44, -6375.97, -1296.08, -271.865, 0, ''), +(9623 ,45, -6364.39, -1281.23, -269.012, 0, ''), +(9623 ,46, -6353.71, -1263.19, -267.95, 0, ''), +(9623 ,47, -6340.09, -1248.65, -267.441, 0, ''), +(9623 ,48, -6338.21, -1237.11, -267.844, 0, ''), +(9623 ,49, -6336.6, -1219.69, -269.196, 0, ''), +(9623 ,50, -6334.44, -1202.33, -271.527, 0, ''), +(9623 ,51, -6329.56, -1189.82, -270.947, 0, ''), +(9623 ,52, -6324.66, -1179.46, -270.103, 0, ''), +(9623 ,53, -6315.08, -1176.74, -269.735, 0, ''), +(9623 ,54, -6308.49, -1179.12, -269.57, 0, ''), +(9623 ,55, -6302.43, -1181.32, -269.328, 5000, ''), +(9623 ,56, -6298.87, -1185.79, -269.278, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 4508; +INSERT INTO script_waypoint VALUES +(4508 ,0, 2194.38, 1791.65, 65.48, 5000, ''), +(4508 ,1, 2188.56, 1805.87, 64.45, 0, ''), +(4508 ,2, 2187, 1843.49, 59.33, 0, ''), +(4508 ,3, 2163.27, 1851.67, 56.73, 5000, ''), +(4508 ,4, 2137.66, 1843.98, 48.08, 5000, ''), +(4508 ,5, 2140.22, 1845.02, 48.32, 0, ''), +(4508 ,6, 2131.5, 1804.29, 46.85, 0, ''), +(4508 ,7, 2096.18, 1789.03, 51.13, 0, ''), +(4508 ,8, 2074.46, 1780.09, 55.64, 3000, ''), +(4508 ,9, 2055.12, 1768.67, 58.46, 5000, ''), +(4508 ,10, 2037.83, 1748.62, 60.27, 0, ''), +(4508 ,11, 2037.51, 1728.94, 60.85, 0, ''), +(4508 ,12, 2044.7, 1711.71, 59.71, 0, ''), +(4508 ,13, 2067.66, 1701.84, 57.77, 3000, ''), +(4508 ,14, 2078.91, 1704.54, 56.77, 3000, ''), +(4508 ,15, 2097.65, 1715.24, 54.74, 0, ''), +(4508 ,16, 2106.44, 1720.98, 54.41, 0, ''), +(4508 ,17, 2123.96, 1732.56, 52.27, 0, ''), +(4508 ,18, 2153.82, 1728.73, 51.92, 0, ''), +(4508 ,19, 2163.49, 1706.33, 54.42, 0, ''), +(4508 ,20, 2158.75, 1695.98, 55.70, 0, ''), +(4508 ,21, 2142.6, 1680.72, 58.24, 0, ''), +(4508 ,22, 2118.31, 1671.54, 59.21, 0, ''), +(4508 ,23, 2086.02, 1672.04, 61.24, 0, ''), +(4508 ,24, 2068.81, 1658.93, 61.24, 0, ''), +(4508 ,25, 2062.82, 1633.31, 64.35, 3000, ''), +(4508 ,26, 2063.05, 1589.16, 63.26, 0, ''), +(4508 ,27, 2063.67, 1577.22, 65.89, 0, ''), +(4508 ,28, 2057.94, 1560.68, 68.40, 0, ''), +(4508 ,29, 2052.56, 1548.05, 73.35, 0, ''), +(4508 ,30, 2045.22, 1543.4, 76.65, 0, ''), +(4508 ,31, 2034.35, 1543.01, 79.70, 0, ''), +(4508 ,32, 2029.95, 1542.94, 80.79, 0, ''), +(4508 ,33, 2021.34, 1538.67, 80.8, 0, ''), +(4508 ,34, 2012.45, 1549.48, 79.93, 0, ''), +(4508 ,35, 2008.05, 1554.92, 80.44, 0, ''), +(4508 ,36, 2006.54, 1562.72, 81.11, 0, ''), +(4508 ,37, 2003.8, 1576.43, 81.57, 0, ''), +(4508 ,38, 2000.57, 1590.06, 80.62, 0, ''), +(4508 ,39, 1998.96, 1596.87, 80.22, 0, ''), +(4508 ,40, 1991.19, 1600.82, 79.39, 0, ''), +(4508 ,41, 1980.71, 1601.44, 79.77, 3000, ''), +(4508 ,42, 1967.22, 1600.18, 80.62, 3000, ''), +(4508 ,43, 1956.43, 1596.97, 81.75, 3000, ''), +(4508 ,44, 1954.87, 1592.02, 82.18, 0, ''), +(4508 ,45, 1948.35, 1571.35, 80.96, 30000, ''), +(4508 ,46, 1947.02, 1566.42, 81.80, 30000, ''); + +DELETE FROM script_waypoint WHERE entry = 7784; +INSERT INTO script_waypoint VALUES +(7784 ,0, -8843.73, -4374.44, 43.71, 0, ''), +(7784 ,1, -8834.68, -4373.88, 45.71, 0, ''), +(7784 ,2, -8832.93, -4373.85, 45.67, 0, ''), +(7784 ,3, -8829.21, -4373.72, 44.14, 0, ''), +(7784 ,4, -8825.10, -4373.56, 41.44, 0, ''), +(7784 ,5, -8818.88, -4372.75, 36.43, 0, ''), +(7784 ,6, -8803.37, -4369.68, 30.06, 0, ''), +(7784 ,7, -8786.68, -4366.18, 23.91, 0, ''), +(7784 ,8, -8764.97, -4366.94, 25.23, 0, ''), +(7784 ,9, -8745.49, -4363.16, 22.80, 0, ''), +(7784 ,10, -8724.13, -4353.55, 20.72, 0, ''), +(7784 ,11, -8706.77, -4346.14, 16.12, 0, ''), +(7784 ,12, -8688.27, -4372.85, 13.64, 0, ''), +(7784 ,13, -8668.76, -4380.38, 11.69, 0, ''), +(7784 ,14, -8645.19, -4388.62, 12.56, 0, ''), +(7784 ,15, -8614.73, -4398.60, 9.86, 0, ''), +(7784 ,16, -8560.33, -4411.27, 13.17, 0, ''), +(7784 ,17, -8536.45, -4416.49, 11.84, 0, ''), +(7784 ,18, -8503.48, -4423.70, 13.59, 0, ''), +(7784 ,19, -8471.91, -4430.60, 9.56, 0, ''), +(7784 ,20, -8441.36, -4435.31, 9.40, 0, ''), +(7784 ,21, -8403.41, -4441.16, 11.83, 0, ''), +(7784 ,22, -8371.24, -4446.13, 9.47, 0, ''), +(7784 ,23, -8353.96, -4448.79, 10.10, 0, 'Scorpid'), +(7784 ,24, -8336.40, -4446.39, 8.98, 0, ''), +(7784 ,25, -8303.78, -4441.96, 11.89, 0, ''), +(7784 ,26, -8272.20, -4433.31, 9.60, 0, ''), +(7784 ,27, -8224.76, -4419.39, 13.03, 0, ''), +(7784 ,28, -8193.31, -4406.04, 10.17, 0, ''), +(7784 ,29, -8155.65, -4397.74, 8.99, 0, ''), +(7784 ,30, -8129.25, -4394.57, 10.92, 0, ''), +(7784 ,31, -8104.86, -4399.03, 8.93, 0, ''), +(7784 ,32, -8063.15, -4423.40, 10.07, 0, ''), +(7784 ,33, -8032.15, -4443.47, 9.97, 0, ''), +(7784 ,34, -8015.39, -4454.33, 9.39, 0, ''), +(7784 ,35, -7981.64, -4482.44, 10.32, 0, ''), +(7784 ,36, -7958.83, -4503.98, 9.69, 0, ''), +(7784 ,37, -7932.45, -4528.91, 10.08, 0, ''), +(7784 ,38, -7904.09, -4566.67, 12.59, 0, ''), +(7784 ,39, -7883.33, -4593.91, 12.15, 0, ''), +(7784 ,40, -7862.83, -4624.53, 10.21, 0, ''), +(7784 ,41, -7840.79, -4654.26, 9.45, 0, ''), +(7784 ,42, -7826.17, -4673.99, 10.61, 0, ''), +(7784 ,43, -7807.86, -4698.69, 11.24, 0, ''), +(7784 ,44, -7793.88, -4717.55, 10.48, 0, ''), +(7784 ,45, -7778.68, -4738.05, 8.89, 0, ''), +(7784 ,46, -7746.42, -4780.39, 9.84, 0, ''), +(7784 ,47, -7724.11, -4772.75, 10.28, 0, ''), +(7784 ,48, -7697.98, -4763.80, 9.52, 0, ''), +(7784 ,49, -7665.33, -4752.62, 10.56, 0, ''), +(7784 ,50, -7641.47, -4750.33, 8.94, 0, ''), +(7784 ,51, -7620.08, -4753.96, 8.93, 0, ''), +(7784 ,52, -7603.15, -4757.53, 9.06, 0, ''), +(7784 ,53, -7579.43, -4767.07, 8.93, 0, ''), +(7784 ,54, -7558.51, -4779.01, 9.64, 0, ''), +(7784 ,55, -7536.40, -4789.32, 8.92, 0, ''), +(7784 ,56, -7512.07, -4793.50, 9.35, 0, 'Wastewander'), +(7784 ,57, -7490.79, -4788.80, 10.53, 0, ''), +(7784 ,58, -7469.10, -4785.11, 10.42, 0, ''), +(7784 ,59, -7453.18, -4782.41, 9.15, 0, ''), +(7784 ,60, -7426.27, -4777.83, 9.54, 0, ''), +(7784 ,61, -7393.84, -4770.19, 12.57, 0, ''), +(7784 ,62, -7367.25, -4764.17, 11.92, 0, ''), +(7784 ,63, -7341.00, -4752.11, 10.17, 0, ''), +(7784 ,64, -7321.62, -4744.97, 11.58, 0, ''), +(7784 ,65, -7302.35, -4744.35, 11.97, 0, ''), +(7784 ,66, -7281.00, -4743.66, 11.21, 0, ''), +(7784 ,67, -7258.33, -4742.93, 9.64, 0, ''), +(7784 ,68, -7236.70, -4742.24, 10.16, 0, ''), +(7784 ,69, -7217.52, -4743.87, 10.79, 0, ''), +(7784 ,70, -7201.86, -4746.32, 9.58, 0, ''), +(7784 ,71, -7182.01, -4749.41, 9.09, 0, ''), +(7784 ,72, -7159.61, -4752.90, 9.52, 0, ''), +(7784 ,73, -7139.58, -4756.02, 9.53, 0, ''), +(7784 ,74, -7122.60, -4754.91, 9.66, 0, ''), +(7784 ,75, -7101.06, -4753.87, 8.92, 0, ''), +(7784 ,76, -7082.79, -4752.99, 9.97, 0, ''), +(7784 ,77, -7061.81, -4751.98, 9.26, 0, ''), +(7784 ,78, -7035.12, -4754.39, 9.19, 0, ''), +(7784 ,79, -7013.90, -4758.64, 10.28, 0, ''), +(7784 ,80, -7001.71, -4769.73, 10.59, 0, ''), +(7784 ,81, -6984.95, -4788.61, 9.30, 0, ''), +(7784 ,82, -6970.41, -4788.77, 9.42, 0, ''), +(7784 ,83, -6957.16, -4788.92, 6.26, 0, ''), +(7784 ,84, -6951.29, -4802.73, 4.45, 0, ''), +(7784 ,85, -6944.81, -4816.58, 1.60, 0, ''), +(7784 ,86, -6942.06, -4839.40, 0.66, 5000, ''); + +DELETE FROM script_waypoint WHERE entry = 1978; +INSERT INTO script_waypoint VALUES +(1978, 0, 1406.32, 1083.10, 52.55, 0, ''), +(1978, 1, 1400.49, 1080.42, 52.50, 0, 'first say'), +(1978, 2, 1388.48, 1083.10, 52.52, 0, ''), +(1978, 3, 1370.16, 1084.02, 52.30, 0, ''), +(1978, 4, 1359.02, 1080.85, 52.46, 0, ''), +(1978, 5, 1341.43, 1087.39, 52.69, 0, ''), +(1978, 6, 1321.93, 1090.51, 50.66, 0, ''), +(1978, 7, 1312.98, 1095.91, 47.49, 0, ''), +(1978, 8, 1301.09, 1102.94, 47.76, 0, ''), +(1978, 9, 1297.73, 1106.35, 50.18, 0, ''), +(1978, 10, 1295.49, 1124.32, 50.49, 0, ''), +(1978, 11, 1294.84, 1137.25, 51.75, 0, ''), +(1978, 12, 1292.89, 1158.99, 52.65, 0, ''), +(1978, 13, 1290.75, 1168.67, 52.56, 1000, 'complete quest and say last'), +(1978, 14, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 15, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 16, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 17, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 18, 1290.72, 1207.44, 52.69, 0, ''), +(1978, 19, 1297.50, 1207.18, 53.74, 0, ''), +(1978, 20, 1301.32, 1220.90, 53.74, 0, ''), +(1978, 21, 1298.55, 1220.43, 53.74, 0, ''), +(1978, 22, 1297.59, 1211.23, 58.47, 0, ''), +(1978, 23, 1305.01, 1206.10, 58.51, 0, ''), +(1978, 24, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 25, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 26, 1310.51, 1207.36, 58.51, 2000, ''); + +DELETE FROM script_waypoint WHERE entry=3439; +INSERT INTO script_waypoint VALUES +(3439, 0, 1105.090332, -3101.254150, 82.706, 1000, 'SAY_STARTUP1'), +(3439, 1, 1103.204468, -3104.345215, 83.113, 1000, ''), +(3439, 2, 1107.815186, -3106.495361, 82.739, 1000, ''), +(3439, 3, 1104.733276, -3100.830811, 82.747, 1000, ''), +(3439, 4, 1103.242554, -3106.270020, 83.133, 1000, ''), +(3439, 5, 1112.807373, -3106.285400, 82.320, 1000, ''), +(3439, 6, 1112.826782, -3108.908691, 82.377, 1000, ''), +(3439, 7, 1108.053955, -3115.156738, 82.894, 0, ''), +(3439, 8, 1108.355591, -3104.365234, 82.377, 5000, ''), +(3439, 9, 1100.306763, -3097.539063, 83.150, 0, 'SAY_STARTUP2'), +(3439, 10, 1100.562378, -3082.721924, 82.768, 0, ''), +(3439, 11, 1097.512939, -3069.226563, 82.206, 0, ''), +(3439, 12, 1092.964966, -3053.114746, 82.351, 0, ''), +(3439, 13, 1094.010986, -3036.958496, 82.888, 0, ''), +(3439, 14, 1095.623901, -3025.760254, 83.392, 0, ''), +(3439, 15, 1107.656494, -3013.530518, 85.653, 0, ''), +(3439, 16, 1119.647705, -3006.928223, 87.019, 0, ''), +(3439, 17, 1129.991211, -3002.410645, 91.232, 7000, 'SAY_MERCENARY'), +(3439, 18, 1133.328735, -2997.710693, 91.675, 1000, 'SAY_PROGRESS_1'), +(3439, 19, 1131.799316, -2987.948242, 91.976, 1000, ''), +(3439, 20, 1122.028687, -2993.397461, 91.536, 0, ''), +(3439, 21, 1116.614868, -2981.916748, 92.103, 0, ''), +(3439, 22, 1102.239136, -2994.245117, 92.074, 0, ''), +(3439, 23, 1096.366211, -2978.306885, 91.873, 0, ''), +(3439, 24, 1091.971558, -2985.919189, 91.730, 40000, 'SAY_PROGRESS_2'); + DELETE FROM script_waypoint WHERE entry=7806; INSERT INTO script_waypoint VALUES (7806, 0, 495.404358, -3478.350830, 114.837, 0, ''), diff --git a/sql/updates/5105_world_scripts.sql b/sql/updates/5105_world_scripts.sql new file mode 100644 index 00000000000..33a32fcc254 --- /dev/null +++ b/sql/updates/5105_world_scripts.sql @@ -0,0 +1,311 @@ +DELETE FROM script_waypoint WHERE entry=3439; +INSERT INTO script_waypoint VALUES +(3439, 0, 1105.090332, -3101.254150, 82.706, 1000, 'SAY_STARTUP1'), +(3439, 1, 1103.204468, -3104.345215, 83.113, 1000, ''), +(3439, 2, 1107.815186, -3106.495361, 82.739, 1000, ''), +(3439, 3, 1104.733276, -3100.830811, 82.747, 1000, ''), +(3439, 4, 1103.242554, -3106.270020, 83.133, 1000, ''), +(3439, 5, 1112.807373, -3106.285400, 82.320, 1000, ''), +(3439, 6, 1112.826782, -3108.908691, 82.377, 1000, ''), +(3439, 7, 1108.053955, -3115.156738, 82.894, 0, ''), +(3439, 8, 1108.355591, -3104.365234, 82.377, 5000, ''), +(3439, 9, 1100.306763, -3097.539063, 83.150, 0, 'SAY_STARTUP2'), +(3439, 10, 1100.562378, -3082.721924, 82.768, 0, ''), +(3439, 11, 1097.512939, -3069.226563, 82.206, 0, ''), +(3439, 12, 1092.964966, -3053.114746, 82.351, 0, ''), +(3439, 13, 1094.010986, -3036.958496, 82.888, 0, ''), +(3439, 14, 1095.623901, -3025.760254, 83.392, 0, ''), +(3439, 15, 1107.656494, -3013.530518, 85.653, 0, ''), +(3439, 16, 1119.647705, -3006.928223, 87.019, 0, ''), +(3439, 17, 1129.991211, -3002.410645, 91.232, 7000, 'SAY_MERCENARY'), +(3439, 18, 1133.328735, -2997.710693, 91.675, 1000, 'SAY_PROGRESS_1'), +(3439, 19, 1131.799316, -2987.948242, 91.976, 1000, ''), +(3439, 20, 1122.028687, -2993.397461, 91.536, 0, ''), +(3439, 21, 1116.614868, -2981.916748, 92.103, 0, ''), +(3439, 22, 1102.239136, -2994.245117, 92.074, 0, ''), +(3439, 23, 1096.366211, -2978.306885, 91.873, 0, ''), +(3439, 24, 1091.971558, -2985.919189, 91.730, 40000, 'SAY_PROGRESS_2'); + +DELETE FROM script_waypoint WHERE entry = 1978; +INSERT INTO script_waypoint VALUES +(1978, 0, 1406.32, 1083.10, 52.55, 0, ''), +(1978, 1, 1400.49, 1080.42, 52.50, 0, 'first say'), +(1978, 2, 1388.48, 1083.10, 52.52, 0, ''), +(1978, 3, 1370.16, 1084.02, 52.30, 0, ''), +(1978, 4, 1359.02, 1080.85, 52.46, 0, ''), +(1978, 5, 1341.43, 1087.39, 52.69, 0, ''), +(1978, 6, 1321.93, 1090.51, 50.66, 0, ''), +(1978, 7, 1312.98, 1095.91, 47.49, 0, ''), +(1978, 8, 1301.09, 1102.94, 47.76, 0, ''), +(1978, 9, 1297.73, 1106.35, 50.18, 0, ''), +(1978, 10, 1295.49, 1124.32, 50.49, 0, ''), +(1978, 11, 1294.84, 1137.25, 51.75, 0, ''), +(1978, 12, 1292.89, 1158.99, 52.65, 0, ''), +(1978, 13, 1290.75, 1168.67, 52.56, 1000, 'complete quest and say last'), +(1978, 14, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 15, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 16, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 17, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 18, 1290.72, 1207.44, 52.69, 0, ''), +(1978, 19, 1297.50, 1207.18, 53.74, 0, ''), +(1978, 20, 1301.32, 1220.90, 53.74, 0, ''), +(1978, 21, 1298.55, 1220.43, 53.74, 0, ''), +(1978, 22, 1297.59, 1211.23, 58.47, 0, ''), +(1978, 23, 1305.01, 1206.10, 58.51, 0, ''), +(1978, 24, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 25, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 26, 1310.51, 1207.36, 58.51, 2000, ''); + +DELETE FROM script_waypoint WHERE entry = 7784; +INSERT INTO script_waypoint VALUES +(7784 ,0, -8843.73, -4374.44, 43.71, 0, ''), +(7784 ,1, -8834.68, -4373.88, 45.71, 0, ''), +(7784 ,2, -8832.93, -4373.85, 45.67, 0, ''), +(7784 ,3, -8829.21, -4373.72, 44.14, 0, ''), +(7784 ,4, -8825.10, -4373.56, 41.44, 0, ''), +(7784 ,5, -8818.88, -4372.75, 36.43, 0, ''), +(7784 ,6, -8803.37, -4369.68, 30.06, 0, ''), +(7784 ,7, -8786.68, -4366.18, 23.91, 0, ''), +(7784 ,8, -8764.97, -4366.94, 25.23, 0, ''), +(7784 ,9, -8745.49, -4363.16, 22.80, 0, ''), +(7784 ,10, -8724.13, -4353.55, 20.72, 0, ''), +(7784 ,11, -8706.77, -4346.14, 16.12, 0, ''), +(7784 ,12, -8688.27, -4372.85, 13.64, 0, ''), +(7784 ,13, -8668.76, -4380.38, 11.69, 0, ''), +(7784 ,14, -8645.19, -4388.62, 12.56, 0, ''), +(7784 ,15, -8614.73, -4398.60, 9.86, 0, ''), +(7784 ,16, -8560.33, -4411.27, 13.17, 0, ''), +(7784 ,17, -8536.45, -4416.49, 11.84, 0, ''), +(7784 ,18, -8503.48, -4423.70, 13.59, 0, ''), +(7784 ,19, -8471.91, -4430.60, 9.56, 0, ''), +(7784 ,20, -8441.36, -4435.31, 9.40, 0, ''), +(7784 ,21, -8403.41, -4441.16, 11.83, 0, ''), +(7784 ,22, -8371.24, -4446.13, 9.47, 0, ''), +(7784 ,23, -8353.96, -4448.79, 10.10, 0, 'Scorpid'), +(7784 ,24, -8336.40, -4446.39, 8.98, 0, ''), +(7784 ,25, -8303.78, -4441.96, 11.89, 0, ''), +(7784 ,26, -8272.20, -4433.31, 9.60, 0, ''), +(7784 ,27, -8224.76, -4419.39, 13.03, 0, ''), +(7784 ,28, -8193.31, -4406.04, 10.17, 0, ''), +(7784 ,29, -8155.65, -4397.74, 8.99, 0, ''), +(7784 ,30, -8129.25, -4394.57, 10.92, 0, ''), +(7784 ,31, -8104.86, -4399.03, 8.93, 0, ''), +(7784 ,32, -8063.15, -4423.40, 10.07, 0, ''), +(7784 ,33, -8032.15, -4443.47, 9.97, 0, ''), +(7784 ,34, -8015.39, -4454.33, 9.39, 0, ''), +(7784 ,35, -7981.64, -4482.44, 10.32, 0, ''), +(7784 ,36, -7958.83, -4503.98, 9.69, 0, ''), +(7784 ,37, -7932.45, -4528.91, 10.08, 0, ''), +(7784 ,38, -7904.09, -4566.67, 12.59, 0, ''), +(7784 ,39, -7883.33, -4593.91, 12.15, 0, ''), +(7784 ,40, -7862.83, -4624.53, 10.21, 0, ''), +(7784 ,41, -7840.79, -4654.26, 9.45, 0, ''), +(7784 ,42, -7826.17, -4673.99, 10.61, 0, ''), +(7784 ,43, -7807.86, -4698.69, 11.24, 0, ''), +(7784 ,44, -7793.88, -4717.55, 10.48, 0, ''), +(7784 ,45, -7778.68, -4738.05, 8.89, 0, ''), +(7784 ,46, -7746.42, -4780.39, 9.84, 0, ''), +(7784 ,47, -7724.11, -4772.75, 10.28, 0, ''), +(7784 ,48, -7697.98, -4763.80, 9.52, 0, ''), +(7784 ,49, -7665.33, -4752.62, 10.56, 0, ''), +(7784 ,50, -7641.47, -4750.33, 8.94, 0, ''), +(7784 ,51, -7620.08, -4753.96, 8.93, 0, ''), +(7784 ,52, -7603.15, -4757.53, 9.06, 0, ''), +(7784 ,53, -7579.43, -4767.07, 8.93, 0, ''), +(7784 ,54, -7558.51, -4779.01, 9.64, 0, ''), +(7784 ,55, -7536.40, -4789.32, 8.92, 0, ''), +(7784 ,56, -7512.07, -4793.50, 9.35, 0, 'Wastewander'), +(7784 ,57, -7490.79, -4788.80, 10.53, 0, ''), +(7784 ,58, -7469.10, -4785.11, 10.42, 0, ''), +(7784 ,59, -7453.18, -4782.41, 9.15, 0, ''), +(7784 ,60, -7426.27, -4777.83, 9.54, 0, ''), +(7784 ,61, -7393.84, -4770.19, 12.57, 0, ''), +(7784 ,62, -7367.25, -4764.17, 11.92, 0, ''), +(7784 ,63, -7341.00, -4752.11, 10.17, 0, ''), +(7784 ,64, -7321.62, -4744.97, 11.58, 0, ''), +(7784 ,65, -7302.35, -4744.35, 11.97, 0, ''), +(7784 ,66, -7281.00, -4743.66, 11.21, 0, ''), +(7784 ,67, -7258.33, -4742.93, 9.64, 0, ''), +(7784 ,68, -7236.70, -4742.24, 10.16, 0, ''), +(7784 ,69, -7217.52, -4743.87, 10.79, 0, ''), +(7784 ,70, -7201.86, -4746.32, 9.58, 0, ''), +(7784 ,71, -7182.01, -4749.41, 9.09, 0, ''), +(7784 ,72, -7159.61, -4752.90, 9.52, 0, ''), +(7784 ,73, -7139.58, -4756.02, 9.53, 0, ''), +(7784 ,74, -7122.60, -4754.91, 9.66, 0, ''), +(7784 ,75, -7101.06, -4753.87, 8.92, 0, ''), +(7784 ,76, -7082.79, -4752.99, 9.97, 0, ''), +(7784 ,77, -7061.81, -4751.98, 9.26, 0, ''), +(7784 ,78, -7035.12, -4754.39, 9.19, 0, ''), +(7784 ,79, -7013.90, -4758.64, 10.28, 0, ''), +(7784 ,80, -7001.71, -4769.73, 10.59, 0, ''), +(7784 ,81, -6984.95, -4788.61, 9.30, 0, ''), +(7784 ,82, -6970.41, -4788.77, 9.42, 0, ''), +(7784 ,83, -6957.16, -4788.92, 6.26, 0, ''), +(7784 ,84, -6951.29, -4802.73, 4.45, 0, ''), +(7784 ,85, -6944.81, -4816.58, 1.60, 0, ''), +(7784 ,86, -6942.06, -4839.40, 0.66, 5000, ''); + +DELETE FROM script_waypoint WHERE entry = 4508; +INSERT INTO script_waypoint VALUES +(4508 ,0, 2194.38, 1791.65, 65.48, 5000, ''), +(4508 ,1, 2188.56, 1805.87, 64.45, 0, ''), +(4508 ,2, 2187, 1843.49, 59.33, 0, ''), +(4508 ,3, 2163.27, 1851.67, 56.73, 5000, ''), +(4508 ,4, 2137.66, 1843.98, 48.08, 5000, ''), +(4508 ,5, 2140.22, 1845.02, 48.32, 0, ''), +(4508 ,6, 2131.5, 1804.29, 46.85, 0, ''), +(4508 ,7, 2096.18, 1789.03, 51.13, 0, ''), +(4508 ,8, 2074.46, 1780.09, 55.64, 3000, ''), +(4508 ,9, 2055.12, 1768.67, 58.46, 5000, ''), +(4508 ,10, 2037.83, 1748.62, 60.27, 0, ''), +(4508 ,11, 2037.51, 1728.94, 60.85, 0, ''), +(4508 ,12, 2044.7, 1711.71, 59.71, 0, ''), +(4508 ,13, 2067.66, 1701.84, 57.77, 3000, ''), +(4508 ,14, 2078.91, 1704.54, 56.77, 3000, ''), +(4508 ,15, 2097.65, 1715.24, 54.74, 0, ''), +(4508 ,16, 2106.44, 1720.98, 54.41, 0, ''), +(4508 ,17, 2123.96, 1732.56, 52.27, 0, ''), +(4508 ,18, 2153.82, 1728.73, 51.92, 0, ''), +(4508 ,19, 2163.49, 1706.33, 54.42, 0, ''), +(4508 ,20, 2158.75, 1695.98, 55.70, 0, ''), +(4508 ,21, 2142.6, 1680.72, 58.24, 0, ''), +(4508 ,22, 2118.31, 1671.54, 59.21, 0, ''), +(4508 ,23, 2086.02, 1672.04, 61.24, 0, ''), +(4508 ,24, 2068.81, 1658.93, 61.24, 0, ''), +(4508 ,25, 2062.82, 1633.31, 64.35, 3000, ''), +(4508 ,26, 2063.05, 1589.16, 63.26, 0, ''), +(4508 ,27, 2063.67, 1577.22, 65.89, 0, ''), +(4508 ,28, 2057.94, 1560.68, 68.40, 0, ''), +(4508 ,29, 2052.56, 1548.05, 73.35, 0, ''), +(4508 ,30, 2045.22, 1543.4, 76.65, 0, ''), +(4508 ,31, 2034.35, 1543.01, 79.70, 0, ''), +(4508 ,32, 2029.95, 1542.94, 80.79, 0, ''), +(4508 ,33, 2021.34, 1538.67, 80.8, 0, ''), +(4508 ,34, 2012.45, 1549.48, 79.93, 0, ''), +(4508 ,35, 2008.05, 1554.92, 80.44, 0, ''), +(4508 ,36, 2006.54, 1562.72, 81.11, 0, ''), +(4508 ,37, 2003.8, 1576.43, 81.57, 0, ''), +(4508 ,38, 2000.57, 1590.06, 80.62, 0, ''), +(4508 ,39, 1998.96, 1596.87, 80.22, 0, ''), +(4508 ,40, 1991.19, 1600.82, 79.39, 0, ''), +(4508 ,41, 1980.71, 1601.44, 79.77, 3000, ''), +(4508 ,42, 1967.22, 1600.18, 80.62, 3000, ''), +(4508 ,43, 1956.43, 1596.97, 81.75, 3000, ''), +(4508 ,44, 1954.87, 1592.02, 82.18, 0, ''), +(4508 ,45, 1948.35, 1571.35, 80.96, 30000, ''), +(4508 ,46, 1947.02, 1566.42, 81.80, 30000, ''); + +DELETE FROM script_waypoint WHERE entry = 9623; +INSERT INTO script_waypoint VALUES +(9623 ,1, -6380.38, -1965.14, -258.292, 5000, ''), +(9623 ,2, -6383.06, -1962.9, -258.936, 0, ''), +(9623 ,3, -6391.09, -1956.13, -260.291, 0, ''), +(9623 ,4, -6395.29, -1933.58, -262.949, 0, ''), +(9623 ,5, -6396.58, -1919.93, -263.838, 0, ''), +(9623 ,6, -6389.01, -1912.64, -260.689, 0, ''), +(9623 ,7, -6369.19, -1892.87, -255.924, 0, ''), +(9623 ,8, -6373.77, -1879.36, -259.268, 0, ''), +(9623 ,9, -6377.55, -1869.56, -260.503, 0, ''), +(9623 ,10, -6376.58, -1860.79, -260.026, 0, ''), +(9623 ,11, -6373.13, -1847.22, -259.249, 0, ''), +(9623 ,12, -6370.54, -1837.04, -260.007, 0, ''), +(9623 ,13, -6372.52, -1829.16, -260.071, 0, ''), +(9623 ,14, -6377.13, -1815.94, -262.632, 0, ''), +(9623 ,15, -6380.27, -1806.95, -265.53, 0, ''), +(9623 ,16, -6386.04, -1790.43, -268.546, 0, ''), +(9623 ,17, -6386.72, -1776.29, -269.851, 0, ''), +(9623 ,18, -6385.92, -1762.31, -271.494, 0, ''), +(9623 ,19, -6384.69, -1744.86, -272.196, 0, ''), +(9623 ,20, -6383.8, -1732.66, -272.222, 0, ''), +(9623 ,21, -6382.66, -1716.96, -272.235, 0, ''), +(9623 ,22, -6381.5, -1703.01, -272.964, 0, ''), +(9623 ,23, -6379.96, -1685.58, -272.842, 0, ''), +(9623 ,24, -6379.34, -1678.61, -272.34, 0, ''), +(9623 ,25, -6364.45, -1636.27, -271.065, 0, ''), +(9623 ,26, -6371.85, -1626.36, -272.188, 0, ''), +(9623 ,27, -6383.5, -1629.01, -272.206, 0, ''), +(9623 ,28, -6388.09, -1635.37, -272.105, 5000, ''), +(9623 ,29, -6375.42, -1637.33, -272.193, 0, ''), +(9623 ,30, -6365.46, -1617.25, -272.141, 0, ''), +(9623 ,31, -6353.79, -1603.48, -271.932, 0, ''), +(9623 ,32, -6340.24, -1592.41, -269.435, 0, ''), +(9623 ,33, -6329.45, -1566.89, -269.895, 0, ''), +(9623 ,34, -6312.2, -1499.06, -269.507, 0, ''), +(9623 ,35, -6304.55, -1468.5, -269.431, 0, ''), +(9623 ,36, -6310.36, -1440.94, -268.427, 0, ''), +(9623 ,37, -6321, -1418.91, -266.525, 0, ''), +(9623 ,38, -6358.76, -1389.97, -267.522, 0, ''), +(9623 ,39, -6378.65, -1375.67, -271.749, 0, ''), +(9623 ,40, -6387.22, -1360.95, -272.109, 0, ''), +(9623 ,41, -6406.95, -1323.87, -271.586, 0, ''), +(9623 ,42, -6405, -1311.92, -271.906, 0, ''), +(9623 ,43, -6395.56, -1303.62, -271.902, 0, ''), +(9623 ,44, -6375.97, -1296.08, -271.865, 0, ''), +(9623 ,45, -6364.39, -1281.23, -269.012, 0, ''), +(9623 ,46, -6353.71, -1263.19, -267.95, 0, ''), +(9623 ,47, -6340.09, -1248.65, -267.441, 0, ''), +(9623 ,48, -6338.21, -1237.11, -267.844, 0, ''), +(9623 ,49, -6336.6, -1219.69, -269.196, 0, ''), +(9623 ,50, -6334.44, -1202.33, -271.527, 0, ''), +(9623 ,51, -6329.56, -1189.82, -270.947, 0, ''), +(9623 ,52, -6324.66, -1179.46, -270.103, 0, ''), +(9623 ,53, -6315.08, -1176.74, -269.735, 0, ''), +(9623 ,54, -6308.49, -1179.12, -269.57, 0, ''), +(9623 ,55, -6302.43, -1181.32, -269.328, 5000, ''), +(9623 ,56, -6298.87, -1185.79, -269.278, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 18760; +INSERT INTO script_waypoint VALUES +(18760 ,0, -2265.21, 3091.14, 13.91, 0, ''), +(18760 ,1, -2266.80, 3091.33, 13.82, 1000, ''), +(18760 ,2, -2268.20, 3091.14, 13.82, 7000, 'progress1'), +(18760 ,3, -2278.32, 3098.98, 13.82, 0, ''), +(18760 ,4, -2294.82, 3110.59, 13.82, 0, ''), +(18760 ,5, -2300.71, 3114.60, 13.82, 20000, 'progress2'), +(18760 ,6, -2300.71, 3114.60, 13.82, 3000, 'progress3'), +(18760 ,7, -2307.36, 3122.76, 13.79, 0, ''), +(18760 ,8, -2312.83, 3130.55, 12.04, 0, ''), +(18760 ,9, -2345.02, 3151.00, 8.38, 0, ''), +(18760 ,10, -2351.97, 3157.61, 6.27, 0, ''), +(18760 ,11, -2360.35, 3171.48, 3.31, 0, ''), +(18760 ,12, -2371.44, 3185.41, 0.89, 0, ''), +(18760 ,13, -2371.21, 3197.92, -0.96, 0, ''), +(18760 ,14, -2380.35, 3210.45, -1.08, 0, ''), +(18760 ,15, -2384.74, 3221.25, -1.17, 0, ''), +(18760 ,16, -2386.15, 3233.39, -1.29, 0, ''), +(18760 ,17, -2383.45, 3247.79, -1.32, 0, ''), +(18760 ,18, -2367.50, 3265.64, -1.33, 0, ''), +(18760 ,19, -2354.90, 3273.30, -1.50, 0, ''), +(18760 ,20, -2348.88, 3280.58, -0.09, 0, ''), +(18760 ,21, -2349.06, 3295.86, -0.95, 0, ''), +(18760 ,22, -2350.43, 3328.27, -2.10, 0, ''), +(18760 ,23, -2346.76, 3356.27, -2.82, 0, ''), +(18760 ,24, -2340.56, 3370.68, -4.02, 0, ''), +(18760 ,25, -2318.84, 3384.60, -7.61, 0, ''), +(18760 ,26, -2313.99, 3398.61, -10.40, 0, ''), +(18760 ,27, -2320.85, 3414.49, -11.49, 0, ''), +(18760 ,28, -2338.26, 3426.06, -11.46, 0, ''), +(18760 ,29, -2342.67, 3439.44, -11.32, 12000, 'progress4'), +(18760 ,30, -2342.67, 3439.44, -11.32, 7000, 'emote bye'), +(18760 ,31, -2342.67, 3439.44, -11.32, 5000, 'cat form'), +(18760 ,32, -2344.60, 3461.27, -10.44, 0, ''), +(18760 ,33, -2396.81, 3517.17, -3.55, 0, ''), +(18760 ,34, -2439.23, 3523.00, -1.05, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 20415; +INSERT INTO script_waypoint VALUES +(20415 ,0, 2488.77, 2184.89, 104.64, 0, ''), +(20415 ,1, 2478.72, 2184.77, 98.58, 0, ''), +(20415 ,2, 2473.52, 2184.71, 99.00, 0, ''), +(20415 ,3, 2453.15, 2184.96, 97.09,4000, ''), +(20415 ,4, 2424.18, 2184.15, 94.11, 0, ''), +(20415 ,5, 2413.18, 2184.15, 93.42, 0, ''), +(20415 ,6, 2402.02, 2183.90, 87.59, 0, ''), +(20415 ,7, 2333.31, 2181.63, 90.03,4000, ''), +(20415 ,8, 2308.73, 2184.34, 92.04, 0, ''), +(20415 ,9, 2303.10, 2196.89, 94.94, 0, ''), +(20415 ,10, 2304.58, 2272.23, 96.67, 0, ''), +(20415 ,11, 2297.09, 2271.40, 95.16, 0, ''), +(20415 ,12, 2297.68, 2266.79, 95.07,4000, ''), +(20415 ,13, 2297.67, 2266.76, 95.07,4000, ''); diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 37c8c31981b..34b4efcbe60 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -22,7 +22,7 @@ enum npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), IsBeingEscorted(false), IsOnHold(false), - PlayerGUID(0), + m_uiPlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), @@ -63,10 +63,10 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho) void npc_escortAI::JustDied(Unit* pKiller) { - if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) + if (!IsBeingEscorted || !m_uiPlayerGUID || !m_pQuestForEscort) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -132,7 +132,7 @@ void npc_escortAI::EnterEvadeMode() bool npc_escortAI::IsPlayerOrGroupInRange() { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -216,7 +216,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } //Check if player or any member of his group is within range - if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) + if (IsBeingEscorted && m_uiPlayerGUID && !m_creature->getVictim() && !m_bIsReturning) { if (m_uiPlayerCheckTimer < uiDiff) { @@ -404,7 +404,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, m_bIsActiveAttacker = bIsActiveAttacker; m_bIsRunning = bRun; - PlayerGUID = uiPlayerGUID; + m_uiPlayerGUID = uiPlayerGUID; m_pQuestForEscort = pQuest; m_bCanInstantRespawn = bInstantRespawn; @@ -423,7 +423,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, //disable npcflags m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, PlayerGUID); + debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); CurrentWP = WaypointList.begin(); diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 243e64d6d21..60e555dcfd4 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -58,6 +58,11 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool IsPlayerOrGroupInRange(); + Player* GetPlayerForEscort() + { + return Unit::GetPlayer(m_uiPlayerGUID); + } + void FillPointMovementListForCreature(); void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); @@ -76,15 +81,15 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool GetIsBeingEscorted() { return IsBeingEscorted; }//used in EnterEvadeMode override void SetReturning(bool returning) { m_bIsReturning = returning; }//used in EnterEvadeMode override void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } - uint64 GetEventStarterGUID() { return PlayerGUID; } + uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } // EscortAI variables protected: - uint64 PlayerGUID; bool IsBeingEscorted; bool IsOnHold; private: + uint64 m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; float MaxPlayerDistance; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp index c5325da12d3..e9169ae60f6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp @@ -55,7 +55,10 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; switch(uiPointId) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp index 929fea7f41a..f63baa7a18f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp @@ -52,7 +52,7 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI // Pure Virtual Functions void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -65,21 +65,14 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI } } - void EnterCombat(Unit* who) { } - void Reset() { - m_creature->setFaction(35); + me->RestoreFaction(); } void JustDied(Unit* killer) { - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp index 42122c1f002..849ed2e029a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp @@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp index 6b661dad5ef..f8ae2bc66ff 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp @@ -67,7 +67,7 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI break; case 64: DoScriptText(SAY_OOX_COMPLETE, m_creature); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, m_creature); break; } @@ -247,7 +247,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -283,7 +283,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI { m_uiPostEventTimer = 3000; - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Unit* pPlayer = GetPlayerForEscort()) { switch(m_uiPostEventCount) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 26b70f01cc1..a9f379b3819 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -17,8 +17,11 @@ */ #include "precompiled.h" +#include "Vehicle.h" +#include "ObjectMgr.h" #include "escort_ai.h" +#define GCD_CAST 1 /*###### ## npc_a_special_surprise @@ -477,6 +480,1067 @@ CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature) return new npc_a_special_surpriseAI(pCreature); } +/*###### +## npc_koltira_deathweaver +######*/ + +enum eKoltira +{ + SAY_BREAKOUT1 = -1609079, + SAY_BREAKOUT2 = -1609080, + SAY_BREAKOUT3 = -1609081, + SAY_BREAKOUT4 = -1609082, + SAY_BREAKOUT5 = -1609083, + SAY_BREAKOUT6 = -1609084, + SAY_BREAKOUT7 = -1609085, + SAY_BREAKOUT8 = -1609086, + SAY_BREAKOUT9 = -1609087, + SAY_BREAKOUT10 = -1609088, + + SPELL_KOLTIRA_TRANSFORM = 52899, + SPELL_ANTI_MAGIC_ZONE = 52894, + + QUEST_BREAKOUT = 12727, + + NPC_CRIMSON_ACOLYTE = 29007, + NPC_HIGH_INQUISITOR_VALROTH = 29001, + NPC_KOLTIRA_ALT = 28447, + + //not sure about this id + //NPC_DEATH_KNIGHT_MOUNT = 29201, + MODEL_DEATH_KNIGHT_MOUNT = 25278 +}; + +struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI +{ + npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) { } + + uint32 m_uiWave; + uint32 m_uiWave_Timer; + uint64 m_uiValrothGUID; + + void Reset() + { + if (!IsBeingEscorted) + { + m_uiWave = 0; + m_uiWave_Timer = 3000; + m_uiValrothGUID = 0; + } + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + DoScriptText(SAY_BREAKOUT1, m_creature); + break; + case 1: + m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case 2: + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + //m_creature->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not + DoCast(m_creature, SPELL_KOLTIRA_TRANSFORM); + break; + case 3: + IsOnHold = true; + m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_BREAKOUT2, m_creature); + DoCast(m_creature, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up + break; + case 4: + SetRun(true); + break; + case 9: + m_creature->Mount(MODEL_DEATH_KNIGHT_MOUNT); + break; + case 10: + m_creature->Unmount(); + break; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (Player* pPlayer = GetPlayerForEscort()) + { + pSummoned->AI()->AttackStart(pPlayer); + pSummoned->AddThreat(m_creature, 0.0f); + } + + if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) + m_uiValrothGUID = pSummoned->GetGUID(); + } + + void SummonAcolyte(uint32 uiAmount) + { + for(uint32 i = 0; i < uiAmount; ++i) + m_creature->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (IsOnHold) + { + if (m_uiWave_Timer < uiDiff) + { + switch(m_uiWave) + { + case 0: + DoScriptText(SAY_BREAKOUT3, m_creature); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 1: + DoScriptText(SAY_BREAKOUT4, m_creature); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 2: + DoScriptText(SAY_BREAKOUT5, m_creature); + SummonAcolyte(4); + m_uiWave_Timer = 20000; + break; + case 3: + DoScriptText(SAY_BREAKOUT6, m_creature); + m_creature->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + m_uiWave_Timer = 1000; + break; + case 4: + { + Unit* pTemp = Unit::GetUnit(*m_creature, m_uiValrothGUID); + + if (!pTemp || !pTemp->isAlive()) + { + DoScriptText(SAY_BREAKOUT8, m_creature); + m_uiWave_Timer = 5000; + } + else + { + m_uiWave_Timer = 2500; + return; //return, we don't want m_uiWave to increment now + } + break; + } + case 5: + DoScriptText(SAY_BREAKOUT9, m_creature); + m_creature->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); + m_uiWave_Timer = 2500; + break; + case 6: + DoScriptText(SAY_BREAKOUT10, m_creature); + IsOnHold = false; + break; + } + + ++m_uiWave; + } + else + m_uiWave_Timer -= uiDiff; + } + } +}; + +CreatureAI* GetAI_npc_koltira_deathweaver(Creature* pCreature) +{ + return new npc_koltira_deathweaverAI(pCreature); +} + +bool QuestAccept_npc_koltira_deathweaver(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_BREAKOUT) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaverAI,pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + } + return true; +} + +/*###### +##Quest 12848 +######*/ + +enum +{ + SPELL_SOUL_PRISON_CHAIN_SELF = 54612, + SPELL_SOUL_PRISON_CHAIN = 54613, + SPELL_DK_INITIATE_VISUAL = 51519, + + SPELL_ICY_TOUCH = 52372, + SPELL_PLAGUE_STRIKE = 52373, + SPELL_BLOOD_STRIKE = 52374, + SPELL_DEATH_COIL = 52375 +}; + +#define EVENT_ICY_TOUCH 1 +#define EVENT_PLAGUE_STRIKE 2 +#define EVENT_BLOOD_STRIKE 3 +#define EVENT_DEATH_COIL 4 + +int32 say_event_start[8] = +{ + -1609000,-1609001,-1609002,-1609003, + -1609004,-1609005,-1609006,-1609007 +}; + +int32 say_event_attack[9] = +{ + -1609008,-1609009,-1609010,-1609011,-1609012, + -1609013,-1609014,-1609015,-1609016 +}; + +uint32 acherus_soul_prison[12] = +{ + 191577, + 191580, + 191581, + 191582, + 191583, + 191584, + 191585, + 191586, + 191587, + 191588, + 191589, + 191590 +}; + +uint32 acherus_unworthy_initiate[5] = +{ + 29519, + 29520, + 29565, + 29566, + 29567 +}; + +enum UnworthyInitiatePhase +{ + PHASE_CHAINED, + PHASE_TO_EQUIP, + PHASE_EQUIPING, + PHASE_TO_ATTACK, + PHASE_ATTACKING, +}; + +struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI +{ + npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) + { + me->SetReactState(REACT_PASSIVE); + if (!me->GetEquipmentId()) + if (const CreatureInfo *info = GetCreatureInfo(28406)) + if (info->equipmentId) + const_cast<CreatureInfo*>(me->GetCreatureInfo())->equipmentId = info->equipmentId; + } + + bool event_startet; + uint64 event_starter; + UnworthyInitiatePhase phase; + uint32 wait_timer; + float targ_x,targ_y,targ_z; + uint64 anchorGUID; + + EventMap events; + + void Reset() + { + anchorGUID = 0; + phase = PHASE_CHAINED; + events.Reset(); + m_creature->setFaction(7); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); + me->LoadEquipment(0, true); + event_startet = false; + } + + void EnterCombat(Unit *who) + { + events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); + events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) + { + wait_timer = 5000; + m_creature->CastSpell(m_creature,SPELL_DK_INITIATE_VISUAL,true); + + if (Unit* starter = Unit::GetUnit((*m_creature),event_starter)) + DoScriptText(say_event_attack[rand()%9],m_creature,starter); + + phase = PHASE_TO_ATTACK; + } + } + + void EventStart(Creature* anchor, Player* target) + { + wait_timer = 5000; + phase = PHASE_TO_EQUIP; + + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); + m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); + + float z; + anchor->GetContactPoint(me, targ_x, targ_y, z, 1.0f); + + event_starter = target->GetGUID(); + DoScriptText(say_event_start[rand()%8], m_creature, target); + } + + void UpdateAI(const uint32 diff); +}; + +CreatureAI* GetAI_npc_unworthy_initiate(Creature* pCreature) +{ + return new npc_unworthy_initiateAI(pCreature); +} + +struct TRINITY_DLL_DECL npc_unworthy_initiate_anchorAI : public PassiveAI +{ + npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} + + uint64 prisonerGUID; + + void SetGUID(const uint64 &guid, int32 id) + { + if (!prisonerGUID) + prisonerGUID = guid; + } + + uint64 GetGUID(int32 id) { return prisonerGUID; } +}; + +void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) +{ + switch(phase) + { + case PHASE_CHAINED: + if (!anchorGUID) + { + float x, y, z; + float dist = 99.0f; + GameObject *prison = NULL; + + for(uint8 i = 0; i < 12; ++i) + { + if (GameObject* temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30)) + { + if (dist == 99.0f || m_creature->IsWithinDist(temp_prison, dist, false)) + { + temp_prison->GetPosition(x, y, z); + dist = m_creature->GetDistance2d(temp_prison); + prison = temp_prison; + } + } + } + + if (!prison) + return; + + if (Creature* trigger = me->FindNearestCreature(29521, 30)) + { + prison->ResetDoorOrButton(); + trigger->AI()->SetGUID(m_creature->GetGUID()); + trigger->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); + anchorGUID = trigger->GetGUID(); + } + } + return; + case PHASE_TO_EQUIP: + if (wait_timer) + { + if (wait_timer < diff) + { + m_creature->GetMotionMaster()->MovePoint(1,targ_x,targ_y,m_creature->GetPositionZ()); + phase = PHASE_EQUIPING; + wait_timer = 0; + }else wait_timer -= diff; + } + return; + case PHASE_TO_ATTACK: + if (wait_timer) + { + if (wait_timer < diff) + { + m_creature->setFaction(14); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + phase = PHASE_ATTACKING; + + if (Unit* target = Unit::GetUnit((*m_creature),event_starter)) + m_creature->AI()->AttackStart(target); + wait_timer = 0; + }else wait_timer -= diff; + } + return; + case PHASE_ATTACKING: + if (!UpdateVictim()) + return; + + events.Update(diff); + + while(uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ICY_TOUCH: + DoCast(m_creature->getVictim(), SPELL_ICY_TOUCH); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); + break; + case EVENT_PLAGUE_STRIKE: + DoCast(m_creature->getVictim(), SPELL_PLAGUE_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); + break; + case EVENT_BLOOD_STRIKE: + DoCast(m_creature->getVictim(), SPELL_BLOOD_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); + break; + case EVENT_DEATH_COIL: + DoCast(m_creature->getVictim(), SPELL_DEATH_COIL); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + break; + } + } + + DoMeleeAttackIfReady(); + return; + } +} + +CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature* pCreature) +{ + return new npc_unworthy_initiate_anchorAI(pCreature); +} + +bool GOHello_go_acherus_soul_prison(Player* pPlayer, GameObject* pGo) +{ + if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) + if (uint64 prisonerGUID = anchor->AI()->GetGUID()) + if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) + CAST_AI(npc_unworthy_initiateAI, (prisoner->AI()))->EventStart(anchor, pPlayer); + + return false; +} + +/*###### +## npc_death_knight_initiate +######*/ + +#define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!" + +enum +{ + SAY_DUEL_A = -1609080, + SAY_DUEL_B = -1609081, + SAY_DUEL_C = -1609082, + SAY_DUEL_D = -1609083, + SAY_DUEL_E = -1609084, + SAY_DUEL_F = -1609085, + SAY_DUEL_G = -1609086, + SAY_DUEL_H = -1609087, + SAY_DUEL_I = -1609088, + + SPELL_DUEL = 52996, + SPELL_DUEL_TRIGGERED = 52990, + SPELL_DUEL_VICTORY = 52994, + SPELL_DUEL_FLAG = 52991, + + QUEST_DEATH_CHALLENGE = 12733, + FACTION_HOSTILE = 2068 +}; + +int32 m_auiRandomSay[] = +{ + SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I +}; + +struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public SpellAI +{ + npc_death_knight_initiateAI(Creature* pCreature) : SpellAI(pCreature) + { + m_bIsDuelInProgress = false; + } + + bool lose; + uint64 m_uiDuelerGUID; + uint32 m_uiDuelTimer; + bool m_bIsDuelInProgress; + + void Reset() + { + lose = false; + me->RestoreFaction(); + SpellAI::Reset(); + + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + + m_uiDuelerGUID = 0; + m_uiDuelTimer = 5000; + m_bIsDuelInProgress = false; + } + + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + { + if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL_TRIGGERED) + { + m_uiDuelerGUID = pCaster->GetGUID(); + m_bIsDuelInProgress = true; + } + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) + { + if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help + uiDamage = 0; + else if (uiDamage >= m_creature->GetHealth()) + { + uiDamage = 0; + + if (!lose) + { + pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); + pDoneBy->AttackStop(); + me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); + lose = true; + me->CastSpell(me, 7267, true); + me->RestoreFaction(); + } + } + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (m_bIsDuelInProgress) + { + if (m_uiDuelTimer < uiDiff) + { + m_creature->setFaction(FACTION_HOSTILE); + + if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiDuelerGUID)) + AttackStart(pUnit); + } + else + m_uiDuelTimer -= uiDiff; + } + return; + } + + if (m_bIsDuelInProgress) + { + if (lose) + { + if (!me->HasAura(7267)) + EnterEvadeMode(); + return; + } + else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER + && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) + { + me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg + me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); + EnterEvadeMode(); + return; + } + } + + // TODO: spells + + SpellAI::UpdateAI(uiDiff); + } +}; + +CreatureAI* GetAI_npc_death_knight_initiate(Creature* pCreature) +{ + return new npc_death_knight_initiateAI(pCreature); +} + +bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) +{ + if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) + { + if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) + return true; + + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(),pCreature->GetGUID()); + } + return true; +} + +bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; + + if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) + { + if (pInitiateAI->m_bIsDuelInProgress) + return true; + } + + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + + int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); + DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); + + pCreature->CastSpell(pPlayer, SPELL_DUEL, false); + pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); + } + return true; +} + +/*###### +## npc_dark_rider_of_acherus +######*/ + +#define DESPAWN_HORSE 52267 + +struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI +{ + npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} + + uint32 PhaseTimer; + uint32 Phase; + bool Intro; + Unit *Target; + + void Reset() + { + PhaseTimer = 4000; + Phase = 0; + Intro = false; + Target = NULL; + } + + void UpdateAI(const uint32 diff) + { + if (!Intro) + return; + + if (PhaseTimer < diff) + { + switch(Phase) + { + case 0: + m_creature->MonsterSay("The realm of shadows awaits...", LANG_UNIVERSAL, 0); + PhaseTimer = 5000; + Phase = 1; + break; + case 1: + DoCast(Target, DESPAWN_HORSE, true); + PhaseTimer = 3000; + Phase = 2; + break; + case 2: + m_creature->SetVisibility(VISIBILITY_OFF); + PhaseTimer = 2000; + Phase = 3; + break; + case 3: + m_creature->ForcedDespawn(); + break; + default: + break; + } + }else PhaseTimer -= diff; + + } + + void InitDespawnHorse(Unit *who) + { + if (!who) + return; + + Target = who; + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + m_creature->SetSpeed(MOVE_RUN, 0.4f); + m_creature->GetMotionMaster()->MoveChase(Target); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Target->GetGUID()); + Intro = true; + } + +}; + +CreatureAI* GetAI_npc_dark_rider_of_acherus(Creature* pCreature) +{ + return new npc_dark_rider_of_acherusAI(pCreature); +} + +/*###### +## npc_salanar_the_horseman +######*/ + +enum +{ + REALM_OF_SHADOWS = 52693, + DELIVER_STOLEN_HORSE = 52264, + CALL_DARK_RIDER = 52266 +}; + +struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI +{ + npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == DELIVER_STOLEN_HORSE) + { + if (caster->GetTypeId() == TYPEID_UNIT && CAST_CRE(caster)->isVehicle()) + { + if (Unit *charmer = caster->GetCharmer()) + { + charmer->ExitVehicle(); + caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + caster->setFaction(35); + DoCast(caster, CALL_DARK_RIDER, true); + if (Creature* Dark_Rider = m_creature->FindNearestCreature(28654, 15)) + CAST_AI(npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); + } + } + } + } + + void MoveInLineOfSight(Unit *who) + { + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetTypeId() == TYPEID_UNIT && CAST_CRE(who)->isVehicle() && me->IsWithinDistInMap(who, 10.0f)) + { + if (Unit *charmer = who->GetCharmer()) + { + if (charmer->GetTypeId() == TYPEID_PLAYER) + { + switch(me->GetEntry()) + { + // for quest Into the Realm of Shadows(12687) + case 28788: + if (CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) + { + if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) + charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); + CAST_PLR(charmer)->GroupEventHappens(12687, me); + } + break; + default: + return; + } + CAST_PLR(charmer)->ExitVehicle(); + CAST_CRE(who)->Respawn(true); + } + } + } + } +}; + +CreatureAI* GetAI_npc_salanar_the_horseman(Creature* pCreature) +{ + return new npc_salanar_the_horsemanAI(pCreature); +} + +/*###### +## npc_ros_dark_rider +######*/ + +struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI +{ + npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} + + void EnterCombat(Unit *who) + { + me->ExitVehicle(); + } + + void Reset() + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + deathcharger->RestoreFaction(); + deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (!me->m_Vehicle && deathcharger->isVehicle() && CAST_VEH(deathcharger)->HasEmptySeat(0)) + me->EnterVehicle(CAST_VEH(deathcharger)); + } + + void JustDied(Unit *killer) + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->isVehicle()) + { + deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + deathcharger->setFaction(2096); + } + } +}; + +CreatureAI* GetAI_npc_ros_dark_rider(Creature* pCreature) +{ + return new npc_ros_dark_riderAI(pCreature); +} + +// correct way: 52312 52314 52555 ... +struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI +{ + npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} + + void MoveInLineOfSight(Unit *who) + { + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetEntry() == 28845 && me->IsWithinDistInMap(who, 10.0f)) + { + if (Unit *owner = who->GetOwner()) + { + if (owner->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) + { + CAST_CRE(who)->CastSpell(owner, 52517, true); + CAST_CRE(who)->ForcedDespawn(); + } + } + } + } + } +}; + +CreatureAI* GetAI_npc_dkc1_gothik(Creature* pCreature) +{ + return new npc_dkc1_gothikAI(pCreature); +} + + +/*#### +## npc_scarlet_miner_cart +####*/ + +#define SPELL_CART_CHECK 54173 +#define SPELL_CART_DRAG 52465 + +struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI +{ + npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + me->SetDisplayId(me->GetCreatureInfo()->DisplayID_A[0]); // H0 is horse + } + + uint64 minerGUID; + + void SetGUID(const uint64 &guid, int32 id) + { + minerGUID = guid; + } + + void DoAction(const int32 param) + { + if(Creature *miner = Unit::GetCreature(*me, minerGUID)) + { + // very bad visual effect + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); + me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); + me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + } + } + + void PassengerLeft(Unit *who, int8 seatId) + { + if(Creature *miner = Unit::GetCreature(*me, minerGUID)) + miner->DisappearAndDie(); + } +}; + +CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) +{ + return new npc_scarlet_miner_cartAI(_Creature); +} + +/*#### +## npc_scarlet_miner +####*/ + +struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI +{ + npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) + { + me->SetReactState(REACT_PASSIVE); + } + + uint32 IntroTimer; + uint32 IntroPhase; + uint64 carGUID; + + void Reset() + { + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; + } + + void InitWaypoint() + { + AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); + AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); + AddWaypoint(3, 2306.561279, -5901.738281, 91.792419 ); + AddWaypoint(4, 2300.098389, -5912.618652, 86.014885 ); + AddWaypoint(5, 2294.142090, -5927.274414, 75.316849 ); + AddWaypoint(6, 2286.984375, -5944.955566, 63.714966 ); + AddWaypoint(7, 2280.001709, -5961.186035, 54.228283 ); + AddWaypoint(8, 2259.389648, -5974.197754, 42.359348 ); + AddWaypoint(9, 2242.882812, -5984.642578, 32.827850 ); + AddWaypoint(10, 2217.265625, -6028.959473, 7.675705 ); + AddWaypoint(11, 2202.595947, -6061.325684, 5.882018 ); + AddWaypoint(12, 2188.974609, -6080.866699, 3.370027 ); + + if(rand()%2) + { + AddWaypoint(13, 2176.483887, -6110.407227, 1.855181 ); + AddWaypoint(14, 2172.516602, -6146.752441, 1.074235 ); + AddWaypoint(15, 2138.918457, -6158.920898, 1.342926 ); + AddWaypoint(16, 2129.866699, -6174.107910, 4.380779 ); + AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); + } + else + { + AddWaypoint(13, 2184.190186, -6166.447266, 0.968877 ); + AddWaypoint(14, 2234.265625, -6163.741211, 0.916021 ); + AddWaypoint(15, 2268.071777, -6158.750977, 1.822252 ); + AddWaypoint(16, 2270.028320, -6176.505859, 6.340538 ); + AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); + } + } + + void InitCartQuest(Player *who) + { + carGUID = who->m_Vehicle->GetGUID(); + InitWaypoint(); + Start(false, false, who->GetGUID()); + SetDespawnAtFar(false); + } + + void WaypointReached(uint32 i) + { + switch (i) + { + case 1: + if(Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + } + me->MonsterSay("Where'd this come from? I better get this down to the ships before the foreman sees it!",LANG_UNIVERSAL,NULL); + SetRun(true); + IntroTimer = 4000; + IntroPhase = 1; + break; + case 17: + if(Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->SendMonsterStop(); + //this make player fall under ground, dunno why + //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->RemoveAura(SPELL_CART_DRAG); + } + me->MonsterSay("Now I can have a rest!",LANG_UNIVERSAL,NULL); + break; + default: + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (IntroPhase) + { + if (IntroTimer < diff) + { + if (IntroPhase == 1) + { + if(Creature *car = Unit::GetCreature(*me, carGUID)) + DoCast(car, SPELL_CART_DRAG); + IntroTimer = 800; + IntroPhase = 2; + } + else + { + if(Creature *car = Unit::GetCreature(*me, carGUID)) + car->AI()->DoAction(); + IntroPhase = 0; + } + }else IntroTimer-=diff; + } + npc_escortAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_scarlet_miner(Creature *_Creature) +{ + return new npc_scarlet_minerAI(_Creature); +} + +/*###### +## go_inconspicuous_mine_car +######*/ + +#define SPELL_CART_SUMM 52463 + +bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* pGO) +{ + if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) + { + // Hack Why Trinity Dont Support Custom Summon Location + if(Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) + { + pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); + if(Vehicle *car = pPlayer->m_Vehicle) + { + if(car->GetEntry() == 28817) + { + car->AI()->SetGUID(miner->GetGUID()); + CAST_AI(npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); + }else error_log("TSCR: GOHello_go_inconspicuous_mine_car vehicle entry is not correct."); + }else error_log("TSCR: GOHello_go_inconspicuous_mine_car player is not on the vehicle."); + }else error_log("TSCR: GOHello_go_inconspicuous_mine_car Scarlet Miner cant be found by script."); + } + return true; +} + +// npc 28912 quest 17217 boss 29001 mob 29007 go 191092 /*#### ## npc_valkyr_battle_maiden @@ -570,6 +1634,76 @@ void AddSC_the_scarlet_enclave() newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; newscript->RegisterSelf(); + // 12848 The Endless Hunger + newscript = new Script; + newscript->Name="npc_unworthy_initiate"; + newscript->GetAI = &GetAI_npc_unworthy_initiate; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_unworthy_initiate_anchor"; + newscript->GetAI = &GetAI_npc_unworthy_initiate_anchor; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_acherus_soul_prison"; + newscript->pGOHello = &GOHello_go_acherus_soul_prison; + newscript->RegisterSelf(); + + // Death's Challenge + newscript = new Script; + newscript->Name="npc_death_knight_initiate"; + newscript->GetAI = &GetAI_npc_death_knight_initiate; + newscript->pGossipHello = &GossipHello_npc_death_knight_initiate; + newscript->pGossipSelect = &GossipSelect_npc_death_knight_initiate; + newscript->RegisterSelf(); + + // 12680 Grand Theft Palomino + newscript = new Script; + newscript->Name="npc_salanar_the_horseman"; + newscript->GetAI = &GetAI_npc_salanar_the_horseman; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_dark_rider_of_acherus"; + newscript->GetAI = &GetAI_npc_dark_rider_of_acherus; + newscript->RegisterSelf(); + + // 12687 Into the Realm of Shadows + newscript = new Script; + newscript->Name="npc_ros_dark_rider"; + newscript->GetAI = &GetAI_npc_ros_dark_rider; + newscript->RegisterSelf(); + + // 12698 The Gift That Keeps On Giving + newscript = new Script; + newscript->Name="npc_dkc1_gothik"; + newscript->GetAI = &GetAI_npc_dkc1_gothik; + newscript->RegisterSelf(); + + // Massacre At Light's Point + newscript = new Script; + newscript->Name="npc_scarlet_miner"; + newscript->GetAI = &GetAI_npc_scarlet_miner; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_scarlet_miner_cart"; + newscript->GetAI = &GetAI_npc_scarlet_miner_cart; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_inconspicuous_mine_car"; + newscript->pGOHello = &GOHello_go_inconspicuous_mine_car; + newscript->RegisterSelf(); + + // 12727 Bloody Breakout + newscript = new Script; + newscript->Name = "npc_koltira_deathweaver"; + newscript->GetAI = &GetAI_npc_koltira_deathweaver; + newscript->pQuestAccept = &QuestAccept_npc_koltira_deathweaver; + newscript->RegisterSelf(); + // A Special Suprise newscript = new Script; newscript->Name = "npc_a_special_surprise"; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp index 07b1979f87f..409d6702d2b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp @@ -119,7 +119,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -176,37 +176,7 @@ bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Q CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) { - npc_deathstalker_erlandAI* deathstalker_erlandAI = new npc_deathstalker_erlandAI(pCreature); - - deathstalker_erlandAI->AddWaypoint(0, 1406.32, 1083.10, 52.55); - deathstalker_erlandAI->AddWaypoint(1, 1400.49, 1080.42, 52.50); //first say - deathstalker_erlandAI->AddWaypoint(2, 1388.48, 1083.10, 52.52); - deathstalker_erlandAI->AddWaypoint(3, 1370.16, 1084.02, 52.30); - deathstalker_erlandAI->AddWaypoint(4, 1359.02, 1080.85, 52.46); - deathstalker_erlandAI->AddWaypoint(5, 1341.43, 1087.39, 52.69); - deathstalker_erlandAI->AddWaypoint(6, 1321.93, 1090.51, 50.66); - deathstalker_erlandAI->AddWaypoint(7, 1312.98, 1095.91, 47.49); - deathstalker_erlandAI->AddWaypoint(8, 1301.09, 1102.94, 47.76); - deathstalker_erlandAI->AddWaypoint(9, 1297.73, 1106.35, 50.18); - deathstalker_erlandAI->AddWaypoint(10, 1295.49, 1124.32, 50.49); - deathstalker_erlandAI->AddWaypoint(11, 1294.84, 1137.25, 51.75); - deathstalker_erlandAI->AddWaypoint(12, 1292.89, 1158.99, 52.65); - deathstalker_erlandAI->AddWaypoint(13, 1290.75, 1168.67, 52.56, 1000); //complete quest and say last - deathstalker_erlandAI->AddWaypoint(14, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(15, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(16, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(17, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(18, 1290.72, 1207.44, 52.69); - deathstalker_erlandAI->AddWaypoint(19, 1297.50, 1207.18, 53.74); - deathstalker_erlandAI->AddWaypoint(20, 1301.32, 1220.90, 53.74); - deathstalker_erlandAI->AddWaypoint(21, 1298.55, 1220.43, 53.74); - deathstalker_erlandAI->AddWaypoint(22, 1297.59, 1211.23, 58.47); - deathstalker_erlandAI->AddWaypoint(23, 1305.01, 1206.10, 58.51); - deathstalker_erlandAI->AddWaypoint(24, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(25, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(26, 1310.51, 1207.36, 58.51, 2000); - - return deathstalker_erlandAI; + return new npc_deathstalker_erlandAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp index d6cbea99fb5..0799f745a70 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp @@ -73,7 +73,7 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI void WaypointReached(uint32 uiPoint) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -197,7 +197,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp index 4a9d944cb3e..3568c7e555b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void Aggro(Unit* pWho) { - Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (IsBeingEscorted && !m_bFriendSummoned && pPlayer) { @@ -83,7 +83,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pSummoned->AI()->AttackStart(pPlayer); } @@ -102,7 +102,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI { if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) { - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index e603d3ce79c..4fdc1b7e1ad 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -76,12 +76,12 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI m_creature->SummonCreature(NPC_FELBOAR, m_creature->GetPositionX()+5.0f, m_creature->GetPositionY()+7.0f, m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); break; case 4: - if (Unit* pTmpPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { //pTmpPlayer is the target of the text - DoScriptText(SAY_WP_3, m_creature, pTmpPlayer); + DoScriptText(SAY_WP_3, m_creature, pPlayer); //pTmpPlayer is the source of the text - DoScriptText(SAY_WP_4, pTmpPlayer); + DoScriptText(SAY_WP_4, pPlayer); } break; } @@ -91,8 +91,8 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit* pTemp = Unit::GetUnit(*m_creature, PlayerGUID)) - DoScriptText(SAY_AGGRO1, m_creature, pTemp); + if (Player* pPlayer = GetPlayerForEscort()) + DoScriptText(SAY_AGGRO1, m_creature, pPlayer); } else DoScriptText(SAY_AGGRO2, m_creature); @@ -108,15 +108,15 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { // not a likely case, code here for the sake of example if (pKiller == m_creature) { - DoScriptText(SAY_DEATH_1, m_creature, pTemp); + DoScriptText(SAY_DEATH_1, m_creature, pPlayer); } else - DoScriptText(SAY_DEATH_2, m_creature, pTemp); + DoScriptText(SAY_DEATH_2, m_creature, pPlayer); } } else diff --git a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp index 88572bf3463..7bb193b98be 100644 --- a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp @@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -81,8 +81,8 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI case 20: DoScriptText(SAY_WIN, m_creature, pPlayer); Completed = true; - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_TOREK_ASSULT,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TOREK_ASSULT, m_creature); break; case 21: DoScriptText(SAY_END, m_creature, pPlayer); @@ -160,7 +160,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -185,8 +185,8 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI break; case 21:{ - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_FREEDOM_TO_RUUL,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp index 0e21a4b310d..f881715ca64 100644 --- a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp @@ -338,7 +338,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 7c0290fe565..d8471deb96b 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -329,14 +329,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI case 106: { - if (!PlayerGUID) - break; - //trigger taretha to run down outside - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) { - if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID))) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, PlayerGUID); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); } //kill credit Creature for quest diff --git a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp index 6c2520cd8b5..8ff16a53832 100644 --- a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp @@ -62,7 +62,7 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -136,11 +136,6 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI //unsure if it should be any //pSummoned->AI()->AttackStart(m_creature); } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/kalimdor/feralas.cpp b/src/bindings/scripts/scripts/kalimdor/feralas.cpp index 08c00a9a5a7..99090b06039 100644 --- a/src/bindings/scripts/scripts/kalimdor/feralas.cpp +++ b/src/bindings/scripts/scripts/kalimdor/feralas.cpp @@ -111,7 +111,7 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI case 37: DoScriptText(SAY_END,m_creature); // Award quest credit - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, m_creature); } diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp index 5c51e64f5a2..b24a51cb3cb 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -114,16 +114,8 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); } }; @@ -181,57 +173,7 @@ CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) CreatureAI* GetAI_npc_willix(Creature* pCreature) { - npc_willixAI* thisAI = new npc_willixAI(pCreature); - - thisAI->AddWaypoint(0, 2194.38, 1791.65, 65.48, 5000); - thisAI->AddWaypoint(1, 2188.56, 1805.87, 64.45); - thisAI->AddWaypoint(2, 2187, 1843.49, 59.33); - thisAI->AddWaypoint(3, 2163.27, 1851.67, 56.73, 5000); - thisAI->AddWaypoint(4, 2137.66, 1843.98, 48.08, 5000); - thisAI->AddWaypoint(5, 2140.22, 1845.02, 48.32); - thisAI->AddWaypoint(6, 2131.5, 1804.29, 46.85); - thisAI->AddWaypoint(7, 2096.18, 1789.03, 51.13); - thisAI->AddWaypoint(8, 2074.46, 1780.09, 55.64, 3000); - thisAI->AddWaypoint(9, 2055.12, 1768.67, 58.46, 5000); - thisAI->AddWaypoint(10, 2037.83, 1748.62, 60.27); - thisAI->AddWaypoint(11, 2037.51, 1728.94, 60.85); - thisAI->AddWaypoint(12, 2044.7, 1711.71, 59.71); - thisAI->AddWaypoint(13, 2067.66, 1701.84, 57.77, 3000); - thisAI->AddWaypoint(14, 2078.91, 1704.54, 56.77, 3000); - thisAI->AddWaypoint(15, 2097.65, 1715.24, 54.74); - thisAI->AddWaypoint(16, 2106.44, 1720.98, 54.41); - thisAI->AddWaypoint(17, 2123.96, 1732.56, 52.27); - thisAI->AddWaypoint(18, 2153.82, 1728.73, 51.92); - thisAI->AddWaypoint(19, 2163.49, 1706.33, 54.42); - thisAI->AddWaypoint(20, 2158.75, 1695.98, 55.70); - thisAI->AddWaypoint(21, 2142.6, 1680.72, 58.24); - thisAI->AddWaypoint(22, 2118.31, 1671.54, 59.21); - thisAI->AddWaypoint(23, 2086.02, 1672.04, 61.24); - thisAI->AddWaypoint(24, 2068.81, 1658.93, 61.24); - thisAI->AddWaypoint(25, 2062.82, 1633.31, 64.35, 3000); - thisAI->AddWaypoint(26, 2063.05, 1589.16, 63.26); - thisAI->AddWaypoint(27, 2063.67, 1577.22, 65.89); - thisAI->AddWaypoint(28, 2057.94, 1560.68, 68.40); - thisAI->AddWaypoint(29, 2052.56, 1548.05, 73.35); - thisAI->AddWaypoint(30, 2045.22, 1543.4, 76.65); - thisAI->AddWaypoint(31, 2034.35, 1543.01, 79.70); - thisAI->AddWaypoint(32, 2029.95, 1542.94, 80.79); - thisAI->AddWaypoint(33, 2021.34, 1538.67, 80.8); - thisAI->AddWaypoint(34, 2012.45, 1549.48, 79.93); - thisAI->AddWaypoint(35, 2008.05, 1554.92, 80.44); - thisAI->AddWaypoint(36, 2006.54, 1562.72, 81.11); - thisAI->AddWaypoint(37, 2003.8, 1576.43, 81.57); - thisAI->AddWaypoint(38, 2000.57, 1590.06, 80.62); - thisAI->AddWaypoint(39, 1998.96, 1596.87, 80.22); - thisAI->AddWaypoint(40, 1991.19, 1600.82, 79.39); - thisAI->AddWaypoint(41, 1980.71, 1601.44, 79.77, 3000); - thisAI->AddWaypoint(42, 1967.22, 1600.18, 80.62, 3000); - thisAI->AddWaypoint(43, 1956.43, 1596.97, 81.75, 3000); - thisAI->AddWaypoint(44, 1954.87, 1592.02, 82.18); - thisAI->AddWaypoint(45, 1948.35, 1571.35, 80.96, 30000); - thisAI->AddWaypoint(46, 1947.02, 1566.42, 81.80, 30000); - - return thisAI; + return new npc_willixAI(pCreature); } void AddSC_razorfen_kraul() diff --git a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp index 2b927af4852..272cef3d33b 100644 --- a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp @@ -101,7 +101,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -116,8 +116,8 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI break; case 18: m_creature->SetInFront(pPlayer); DoScriptText(SAY_END, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp index 9745fce9966..813e178b6f0 100644 --- a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp +++ b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player *pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -357,7 +357,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -424,97 +424,7 @@ bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_OOX17(Creature* pCreature) { - npc_OOX17AI* OOX17AI = new npc_OOX17AI(pCreature); - - OOX17AI->AddWaypoint(0, -8843.73, -4374.44, 43.71); - OOX17AI->AddWaypoint(1, -8834.68, -4373.88, 45.71); - OOX17AI->AddWaypoint(2, -8832.93, -4373.85, 45.67); - OOX17AI->AddWaypoint(3, -8829.21, -4373.72, 44.14); - OOX17AI->AddWaypoint(4, -8825.10, -4373.56, 41.44); - OOX17AI->AddWaypoint(5, -8818.88, -4372.75, 36.43); - OOX17AI->AddWaypoint(6, -8803.37, -4369.68, 30.06); - OOX17AI->AddWaypoint(7, -8786.68, -4366.18, 23.91); - OOX17AI->AddWaypoint(8, -8764.97, -4366.94, 25.23); - OOX17AI->AddWaypoint(9, -8745.49, -4363.16, 22.80); - OOX17AI->AddWaypoint(10, -8724.13, -4353.55, 20.72); - OOX17AI->AddWaypoint(11, -8706.77, -4346.14, 16.12); - OOX17AI->AddWaypoint(12, -8688.27, -4372.85, 13.64); - OOX17AI->AddWaypoint(13, -8668.76, -4380.38, 11.69); - OOX17AI->AddWaypoint(14, -8645.19, -4388.62, 12.56); - OOX17AI->AddWaypoint(15, -8614.73, -4398.60, 9.86); - OOX17AI->AddWaypoint(16, -8560.33, -4411.27, 13.17); - OOX17AI->AddWaypoint(17, -8536.45, -4416.49, 11.84); - OOX17AI->AddWaypoint(18, -8503.48, -4423.70, 13.59); - OOX17AI->AddWaypoint(19, -8471.91, -4430.60, 9.56); - OOX17AI->AddWaypoint(20, -8441.36, -4435.31, 9.40); - OOX17AI->AddWaypoint(21, -8403.41, -4441.16, 11.83); - OOX17AI->AddWaypoint(22, -8371.24, -4446.13, 9.47); - OOX17AI->AddWaypoint(23, -8353.96, -4448.79, 10.10); //Scorpid - OOX17AI->AddWaypoint(24, -8336.40, -4446.39, 8.98); - OOX17AI->AddWaypoint(25, -8303.78, -4441.96, 11.89); - OOX17AI->AddWaypoint(26, -8272.20, -4433.31, 9.60); - OOX17AI->AddWaypoint(27, -8224.76, -4419.39, 13.03); - OOX17AI->AddWaypoint(28, -8193.31, -4406.04, 10.17); - OOX17AI->AddWaypoint(29, -8155.65, -4397.74, 8.99); - OOX17AI->AddWaypoint(30, -8129.25, -4394.57, 10.92); - OOX17AI->AddWaypoint(31, -8104.86, -4399.03, 8.93); - OOX17AI->AddWaypoint(32, -8063.15, -4423.40, 10.07); - OOX17AI->AddWaypoint(33, -8032.15, -4443.47, 9.97); - OOX17AI->AddWaypoint(34, -8015.39, -4454.33, 9.39); - OOX17AI->AddWaypoint(35, -7981.64, -4482.44, 10.32); - OOX17AI->AddWaypoint(36, -7958.83, -4503.98, 9.69); - OOX17AI->AddWaypoint(37, -7932.45, -4528.91, 10.08); - OOX17AI->AddWaypoint(38, -7904.09, -4566.67, 12.59); - OOX17AI->AddWaypoint(39, -7883.33, -4593.91, 12.15); - OOX17AI->AddWaypoint(40, -7862.83, -4624.53, 10.21); - OOX17AI->AddWaypoint(41, -7840.79, -4654.26, 9.45); - OOX17AI->AddWaypoint(42, -7826.17, -4673.99, 10.61); - OOX17AI->AddWaypoint(43, -7807.86, -4698.69, 11.24); - OOX17AI->AddWaypoint(44, -7793.88, -4717.55, 10.48); - OOX17AI->AddWaypoint(45, -7778.68, -4738.05, 8.89); - OOX17AI->AddWaypoint(46, -7746.42, -4780.39, 9.84); - OOX17AI->AddWaypoint(47, -7724.11, -4772.75, 10.28); - OOX17AI->AddWaypoint(48, -7697.98, -4763.80, 9.52); - OOX17AI->AddWaypoint(49, -7665.33, -4752.62, 10.56); - OOX17AI->AddWaypoint(50, -7641.47, -4750.33, 8.94); - OOX17AI->AddWaypoint(51, -7620.08, -4753.96, 8.93); - OOX17AI->AddWaypoint(52, -7603.15, -4757.53, 9.06); - OOX17AI->AddWaypoint(53, -7579.43, -4767.07, 8.93); - OOX17AI->AddWaypoint(54, -7558.51, -4779.01, 9.64); - OOX17AI->AddWaypoint(55, -7536.40, -4789.32, 8.92); - OOX17AI->AddWaypoint(56, -7512.07, -4793.50, 9.35); //Wastewander - OOX17AI->AddWaypoint(57, -7490.79, -4788.80, 10.53); - OOX17AI->AddWaypoint(58, -7469.10, -4785.11, 10.42); - OOX17AI->AddWaypoint(59, -7453.18, -4782.41, 9.15); - OOX17AI->AddWaypoint(60, -7426.27, -4777.83, 9.54); - OOX17AI->AddWaypoint(61, -7393.84, -4770.19, 12.57); - OOX17AI->AddWaypoint(62, -7367.25, -4764.17, 11.92); - OOX17AI->AddWaypoint(63, -7341.00, -4752.11, 10.17); - OOX17AI->AddWaypoint(64, -7321.62, -4744.97, 11.58); - OOX17AI->AddWaypoint(65, -7302.35, -4744.35, 11.97); - OOX17AI->AddWaypoint(66, -7281.00, -4743.66, 11.21); - OOX17AI->AddWaypoint(67, -7258.33, -4742.93, 9.64); - OOX17AI->AddWaypoint(68, -7236.70, -4742.24, 10.16); - OOX17AI->AddWaypoint(69, -7217.52, -4743.87, 10.79); - OOX17AI->AddWaypoint(70, -7201.86, -4746.32, 9.58); - OOX17AI->AddWaypoint(71, -7182.01, -4749.41, 9.09); - OOX17AI->AddWaypoint(72, -7159.61, -4752.90, 9.52); - OOX17AI->AddWaypoint(73, -7139.58, -4756.02, 9.53); - OOX17AI->AddWaypoint(74, -7122.60, -4754.91, 9.66); - OOX17AI->AddWaypoint(75, -7101.06, -4753.87, 8.92); - OOX17AI->AddWaypoint(76, -7082.79, -4752.99, 9.97); - OOX17AI->AddWaypoint(77, -7061.81, -4751.98, 9.26); - OOX17AI->AddWaypoint(78, -7035.12, -4754.39, 9.19); - OOX17AI->AddWaypoint(79, -7013.90, -4758.64, 10.28); - OOX17AI->AddWaypoint(80, -7001.71, -4769.73, 10.59); - OOX17AI->AddWaypoint(81, -6984.95, -4788.61, 9.30); - OOX17AI->AddWaypoint(82, -6970.41, -4788.77, 9.42); - OOX17AI->AddWaypoint(83, -6957.16, -4788.92, 6.26); - OOX17AI->AddWaypoint(84, -6951.29, -4802.73, 4.45); - OOX17AI->AddWaypoint(85, -6944.81, -4816.58, 1.60); - OOX17AI->AddWaypoint(86, -6942.06, -4839.40, 0.66,5000); - - return OOX17AI; + return new npc_OOX17AI(pCreature); } /*#### @@ -631,8 +541,7 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustRespawned() { - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) - m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); + me->RestoreFaction(); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_creature->GetCreatureInfo()->npcflag); @@ -684,7 +593,10 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustDied(Unit* pKiller) { if (Player* pPlayer = Unit::GetPlayer(m_uiPlayerGUID)) - pPlayer->FailQuest(QUEST_TOOGA); + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_TOOGA); + } m_uiPlayerGUID = 0; m_creature->GetMotionMaster()->MovementExpired(); diff --git a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp index d17d0b06cd1..d957ba26ae7 100644 --- a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp +++ b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp @@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -507,75 +507,143 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) enum { - SAY_PROGRESS_1 = -1000272, - SAY_PROGRESS_2 = -1000273, - SAY_PROGRESS_3 = -1000274, - - SAY_MERCENARY_4 = -1000275, - - SAY_PROGRESS_5 = -1000276, - SAY_PROGRESS_6 = -1000277, - SAY_PROGRESS_7 = -1000278, - SAY_PROGRESS_8 = -1000279, + SAY_START = -1000272, + SAY_STARTUP1 = -1000273, + SAY_STARTUP2 = -1000274, + SAY_MERCENARY = -1000275, + SAY_PROGRESS_1 = -1000276, + SAY_PROGRESS_2 = -1000277, + SAY_PROGRESS_3 = -1000278, + SAY_END = -1000279, QUEST_ESCAPE = 863, FACTION_RATCHET = 637, - NPC_PILOT = 3451, - MOB_MERCENARY = 3282, + NPC_PILOT_WIZZ = 3451, + NPC_MERCENARY = 3282, }; struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { - npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) { } + npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } - bool Completed; + bool m_bIsPostEvent; + uint32 m_uiPostEventTimer; + uint32 m_uiPostEventCount; - void WaypointReached(uint32 i) + void Reset() { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + if (!IsBeingEscorted) + { + if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } + } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; - switch(i) + switch(uiPointId) { - case 0: DoScriptText(SAY_PROGRESS_1, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; - case 10: DoScriptText(SAY_PROGRESS_3, m_creature, pPlayer); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 20:{ - Unit* Mercenary = m_creature->FindNearestCreature(MOB_MERCENARY, 99); - if (Mercenary) + case 0: + DoScriptText(SAY_STARTUP1, m_creature); + break; + case 9: + SetRun(false); + break; + case 17: + if (Creature* pTemp = m_creature->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) { - DoScriptText(SAY_MERCENARY_4, Mercenary); - CAST_CRE(Mercenary)->AI()->AttackStart(m_creature); - AttackStart(Mercenary); + DoScriptText(SAY_MERCENARY, pTemp); + m_creature->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); } - }break; - case 21: DoScriptText(SAY_PROGRESS_5, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; - case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; - case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; - case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); - m_creature->setDeathState(JUST_DIED); - Completed = true; - pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + break; + case 24: + m_bIsPostEvent = true; break; } } - void Reset() + void WaypointStart(uint32 uiPointId) { - m_creature->setDeathState(ALIVE); - Completed = false; - if (!IsBeingEscorted) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) { - if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) - m_creature->SetStandState(UNIT_STAND_STATE_STAND); + case 9: + DoScriptText(SAY_STARTUP2, m_creature, pPlayer); + break; + case 18: + DoScriptText(SAY_PROGRESS_1, m_creature, pPlayer); + SetRun(); + break; } } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) + m_creature->SetStandState(UNIT_STAND_STATE_DEAD); + + if (pSummoned->GetEntry() == NPC_MERCENARY) + pSummoned->AI()->AttackStart(m_creature); + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (m_bIsPostEvent) + { + if (m_uiPostEventTimer < uiDiff) + { + switch(m_uiPostEventCount) + { + case 0: + DoScriptText(SAY_PROGRESS_2, m_creature); + break; + case 1: + DoScriptText(SAY_PROGRESS_3, m_creature); + break; + case 2: + DoScriptText(SAY_END, m_creature); + break; + case 3: + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + m_creature->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + } + break; + } + + ++m_uiPostEventCount; + m_uiPostEventTimer = 5000; + } + else + m_uiPostEventTimer -= uiDiff; + } + + return; + } + + DoMeleeAttackIfReady(); + } }; bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -591,42 +659,7 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) { - npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(pCreature); - - thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); - thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); - thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); - thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); - thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); - thisAI->AddWaypoint(5, 1106.98, -3099.44, 82.18, 1000); - thisAI->AddWaypoint(6, 1103.74, -3103.29, 83.05, 1000); - thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); - thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); - thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); - thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); - thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); - thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); - thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); - thisAI->AddWaypoint(14, 1096.97, -3051.99, 82.50); - thisAI->AddWaypoint(15, 1094.06, -3036.79, 82.70); - thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); - thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); - thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); - thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); - thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); - thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); - thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); - thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); - thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); - thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); - thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); - thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); - thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); - thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); - thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); - thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); - - return thisAI; + return new npc_wizzlecrank_shredderAI(pCreature); } void AddSC_the_barrens() diff --git a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp index be0c2db5aa9..24e6a21e743 100644 --- a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp @@ -60,7 +60,7 @@ struct TRINITY_DLL_DECL npc_kanatiAI : public npc_escortAI DoSpawnGalak(); break; case 1: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, m_creature); break; } @@ -149,7 +149,7 @@ struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI DoSpawnBandits(ID_AMBUSH_3); break; case 45: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, m_creature); break; } @@ -222,7 +222,7 @@ struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI DoScriptText(SAY_COMPLETE, m_creature); break; case 27: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_HOMEWARD, m_creature); break; } diff --git a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp index 323faf67814..81f122d61db 100644 --- a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -76,21 +76,18 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI break; case 55: DoScriptText(SAY_FINISH, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_CHASING_AME,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_CHASING_AME,m_creature); break; } - } + } void Reset() { DEMORALIZINGSHOUT_Timer = 5000; } - void EnterCombat(Unit* who) - {} - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); @@ -98,11 +95,8 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_CHASING_AME); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_CHASING_AME); } void UpdateAI(const uint32 diff) @@ -135,66 +129,7 @@ bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* ques CreatureAI* GetAI_npc_ame(Creature* pCreature) { - npc_ameAI* thisAI = new npc_ameAI(pCreature); - - thisAI->AddWaypoint(1, -6380.38, -1965.14, -258.292, 5000); - thisAI->AddWaypoint(2, -6383.06, -1962.9, -258.936); - thisAI->AddWaypoint(3, -6391.09, -1956.13, -260.291); - thisAI->AddWaypoint(4, -6395.29, -1933.58, -262.949); - thisAI->AddWaypoint(5, -6396.58, -1919.93, -263.838); - thisAI->AddWaypoint(6, -6389.01, -1912.64, -260.689); - thisAI->AddWaypoint(7, -6369.19, -1892.87, -255.924); - thisAI->AddWaypoint(8, -6373.77, -1879.36, -259.268); - thisAI->AddWaypoint(9, -6377.55, -1869.56, -260.503); - thisAI->AddWaypoint(10, -6376.58, -1860.79, -260.026); - thisAI->AddWaypoint(11, -6373.13, -1847.22, -259.249); - thisAI->AddWaypoint(12, -6370.54, -1837.04, -260.007); - thisAI->AddWaypoint(13, -6372.52, -1829.16, -260.071); - thisAI->AddWaypoint(14, -6377.13, -1815.94, -262.632); - thisAI->AddWaypoint(15, -6380.27, -1806.95, -265.53); - thisAI->AddWaypoint(16, -6386.04, -1790.43, -268.546); - thisAI->AddWaypoint(17, -6386.72, -1776.29, -269.851); - thisAI->AddWaypoint(18, -6385.92, -1762.31, -271.494); - thisAI->AddWaypoint(19, -6384.69, -1744.86, -272.196); - thisAI->AddWaypoint(20, -6383.8, -1732.66, -272.222); - thisAI->AddWaypoint(21, -6382.66, -1716.96, -272.235); - thisAI->AddWaypoint(22, -6381.5, -1703.01, -272.964); - thisAI->AddWaypoint(23, -6379.96, -1685.58, -272.842); - thisAI->AddWaypoint(24, -6379.34, -1678.61, -272.34); - thisAI->AddWaypoint(25, -6364.45, -1636.27, -271.065); - thisAI->AddWaypoint(26, -6371.85, -1626.36, -272.188); - thisAI->AddWaypoint(27, -6383.5, -1629.01, -272.206); - thisAI->AddWaypoint(28, -6388.09, -1635.37, -272.105, 5000); - thisAI->AddWaypoint(29, -6375.42, -1637.33, -272.193); - thisAI->AddWaypoint(30, -6365.46, -1617.25, -272.141); - thisAI->AddWaypoint(31, -6353.79, -1603.48, -271.932); - thisAI->AddWaypoint(32, -6340.24, -1592.41, -269.435); - thisAI->AddWaypoint(33, -6329.45, -1566.89, -269.895); - thisAI->AddWaypoint(34, -6312.2, -1499.06, -269.507); - thisAI->AddWaypoint(35, -6304.55, -1468.5, -269.431); - thisAI->AddWaypoint(36, -6310.36, -1440.94, -268.427); - thisAI->AddWaypoint(37, -6321, -1418.91, -266.525); - thisAI->AddWaypoint(38, -6358.76, -1389.97, -267.522); - thisAI->AddWaypoint(39, -6378.65, -1375.67, -271.749); - thisAI->AddWaypoint(40, -6387.22, -1360.95, -272.109); - thisAI->AddWaypoint(41, -6406.95, -1323.87, -271.586); - thisAI->AddWaypoint(42, -6405, -1311.92, -271.906); - thisAI->AddWaypoint(43, -6395.56, -1303.62, -271.902); - thisAI->AddWaypoint(44, -6375.97, -1296.08, -271.865); - thisAI->AddWaypoint(45, -6364.39, -1281.23, -269.012); - thisAI->AddWaypoint(46, -6353.71, -1263.19, -267.95); - thisAI->AddWaypoint(47, -6340.09, -1248.65, -267.441); - thisAI->AddWaypoint(48, -6338.21, -1237.11, -267.844); - thisAI->AddWaypoint(49, -6336.6, -1219.69, -269.196); - thisAI->AddWaypoint(50, -6334.44, -1202.33, -271.527); - thisAI->AddWaypoint(51, -6329.56, -1189.82, -270.947); - thisAI->AddWaypoint(52, -6324.66, -1179.46, -270.103); - thisAI->AddWaypoint(53, -6315.08, -1176.74, -269.735); - thisAI->AddWaypoint(54, -6308.49, -1179.12, -269.57); - thisAI->AddWaypoint(55, -6302.43, -1181.32, -269.328, 5000); - thisAI->AddWaypoint(56, -6298.87, -1185.79, -269.278); - - return thisAI; + return new npc_ameAI(pCreature); } void AddSC_ungoro_crater() diff --git a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp index bb97fb12d18..41454f330f1 100644 --- a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp +++ b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp @@ -64,7 +64,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -90,7 +90,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); break; case 28: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, m_creature); // me->RestoreFaction(); DoScriptText(SAY_END_IRO,m_creature); @@ -104,17 +104,12 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI if (!IsBeingEscorted) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); } } - - void UpdateAI(Player* pPlayer, Creature* pCreature,const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp index 209d11c3509..9e7e6145178 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp @@ -70,8 +70,6 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI DoScriptText(SAY_SUMMON, m_creature); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (Faction_Timer) @@ -227,9 +225,9 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer || pPlayer->GetTypeId() != TYPEID_PLAYER) + if (!pPlayer) return; switch (i) diff --git a/src/bindings/scripts/scripts/outland/netherstorm.cpp b/src/bindings/scripts/scripts/outland/netherstorm.cpp index 1e3c4349116..8d1aa2c3b3c 100644 --- a/src/bindings/scripts/scripts/outland/netherstorm.cpp +++ b/src/bindings/scripts/scripts/outland/netherstorm.cpp @@ -803,20 +803,15 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI npc_bessyAI(Creature *c) : npc_escortAI(c) {} - bool Completed; - void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(Q_ALMABTRIEB); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(Q_ALMABTRIEB); } void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -836,17 +831,12 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI case 12: if (pPlayer) - { - CAST_PLR(pPlayer)->GroupEventHappens(Q_ALMABTRIEB, m_creature); - Completed = true; - } - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_1, m_creature);}break; + pPlayer->GroupEventHappens(Q_ALMABTRIEB, m_creature); + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_1, m_creature); break; case 13: - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_2, m_creature, pPlayer);}break; + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_2, m_creature, pPlayer); break; } } @@ -855,17 +845,9 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void EnterCombat(Unit* who){} - void Reset() { - Completed = false; - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; @@ -883,24 +865,7 @@ bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_bessy(Creature* pCreature) { - npc_bessyAI* bessyAI = new npc_bessyAI(pCreature); - - bessyAI->AddWaypoint(0, 2488.77, 2184.89, 104.64); - bessyAI->AddWaypoint(1, 2478.72, 2184.77, 98.58); - bessyAI->AddWaypoint(2, 2473.52, 2184.71, 99.00); - bessyAI->AddWaypoint(3, 2453.15, 2184.96, 97.09,4000); - bessyAI->AddWaypoint(4, 2424.18, 2184.15, 94.11); - bessyAI->AddWaypoint(5, 2413.18, 2184.15, 93.42); - bessyAI->AddWaypoint(6, 2402.02, 2183.90, 87.59); - bessyAI->AddWaypoint(7, 2333.31, 2181.63, 90.03,4000); - bessyAI->AddWaypoint(8, 2308.73, 2184.34, 92.04); - bessyAI->AddWaypoint(9, 2303.10, 2196.89, 94.94); - bessyAI->AddWaypoint(10, 2304.58, 2272.23, 96.67); - bessyAI->AddWaypoint(11, 2297.09, 2271.40, 95.16); - bessyAI->AddWaypoint(12, 2297.68, 2266.79, 95.07,4000); - bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); - - return bessyAI; + return new npc_bessyAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp index 998cedf9c1e..5ef2be74bf9 100644 --- a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp @@ -83,8 +83,6 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI CastTimer = 5000; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (bCanEat || bIsEating) @@ -205,8 +203,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -325,8 +321,6 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI PoisonTimer = 0; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -696,8 +690,6 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI Event = false; } - void EnterCombat(Unit* who){} - void StartEvent() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -891,7 +883,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -944,7 +936,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI case 50: DoScriptText(SAY_WIL_END, m_creature, pPlayer); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature); break; } diff --git a/src/bindings/scripts/scripts/outland/shattrath_city.cpp b/src/bindings/scripts/scripts/outland/shattrath_city.cpp index 5e0904f7661..23d54ce83b6 100644 --- a/src/bindings/scripts/scripts/outland/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/outland/shattrath_city.cpp @@ -61,12 +61,9 @@ struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI void Reset() { Uppercut_Timer = 5000; - if (m_creature->getFaction() != m_uiNormFaction) - m_creature->setFaction(m_uiNormFaction); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -126,11 +123,9 @@ struct TRINITY_DLL_DECL npc_salsalabimAI : public ScriptedAI void Reset() { MagneticPull_Timer = 15000; - m_creature->setFaction(FACTION_FRIENDLY_SA); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -288,71 +283,60 @@ public: void WaypointReached(uint32 i) { - Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pTemp) + if (!pPlayer) return; switch(i) { - case 0: DoScriptText(SAY1, m_creature, pTemp); break; - case 4: DoScriptText(WHISP1, m_creature, pTemp); break; - case 6: DoScriptText(WHISP2, m_creature, pTemp); break; - case 7: DoScriptText(WHISP3, m_creature, pTemp); break; - case 8: DoScriptText(WHISP4, m_creature, pTemp); break; - case 17: DoScriptText(WHISP5, m_creature, pTemp); break; - case 18: DoScriptText(WHISP6, m_creature, pTemp); break; - case 19: DoScriptText(WHISP7, m_creature, pTemp); break; - case 33: DoScriptText(WHISP8, m_creature, pTemp); break; - case 34: DoScriptText(WHISP9, m_creature, pTemp); break; - case 35: DoScriptText(WHISP10, m_creature, pTemp); break; - case 36: DoScriptText(WHISP11, m_creature, pTemp); break; - case 43: DoScriptText(WHISP12, m_creature, pTemp); break; - case 44: DoScriptText(WHISP13, m_creature, pTemp); break; - case 49: DoScriptText(WHISP14, m_creature, pTemp); break; - case 50: DoScriptText(WHISP15, m_creature, pTemp); break; - case 51: DoScriptText(WHISP16, m_creature, pTemp); break; - case 52: DoScriptText(WHISP17, m_creature, pTemp); break; - case 53: DoScriptText(WHISP18, m_creature, pTemp); break; - case 54: DoScriptText(WHISP19, m_creature, pTemp); break; - case 55: DoScriptText(WHISP20, m_creature, pTemp); break; - case 56: DoScriptText(WHISP21, m_creature, pTemp); - if (PlayerGUID) - { - Player* pPlayer = (Unit::GetPlayer(PlayerGUID)); - if (pPlayer) - pPlayer->GroupEventHappens(10211,m_creature); - } + case 0: DoScriptText(SAY1, m_creature, pPlayer); break; + case 4: DoScriptText(WHISP1, m_creature, pPlayer); break; + case 6: DoScriptText(WHISP2, m_creature, pPlayer); break; + case 7: DoScriptText(WHISP3, m_creature, pPlayer); break; + case 8: DoScriptText(WHISP4, m_creature, pPlayer); break; + case 17: DoScriptText(WHISP5, m_creature, pPlayer); break; + case 18: DoScriptText(WHISP6, m_creature, pPlayer); break; + case 19: DoScriptText(WHISP7, m_creature, pPlayer); break; + case 33: DoScriptText(WHISP8, m_creature, pPlayer); break; + case 34: DoScriptText(WHISP9, m_creature, pPlayer); break; + case 35: DoScriptText(WHISP10, m_creature, pPlayer); break; + case 36: DoScriptText(WHISP11, m_creature, pPlayer); break; + case 43: DoScriptText(WHISP12, m_creature, pPlayer); break; + case 44: DoScriptText(WHISP13, m_creature, pPlayer); break; + case 49: DoScriptText(WHISP14, m_creature, pPlayer); break; + case 50: DoScriptText(WHISP15, m_creature, pPlayer); break; + case 51: DoScriptText(WHISP16, m_creature, pPlayer); break; + case 52: DoScriptText(WHISP17, m_creature, pPlayer); break; + case 53: DoScriptText(WHISP18, m_creature, pPlayer); break; + case 54: DoScriptText(WHISP19, m_creature, pPlayer); break; + case 55: DoScriptText(WHISP20, m_creature, pPlayer); break; + case 56: DoScriptText(WHISP21, m_creature, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(10211,m_creature); break; } } - void EnterCombat(Unit* who) {} - - void MoveInLineOfSight(Unit *who) + void MoveInLineOfSight(Unit* pWho) { if (IsBeingEscorted) return; - if (who->GetTypeId() == TYPEID_PLAYER) + if (pWho->GetTypeId() == TYPEID_PLAYER) { - if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) + if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) { float Radius = 10.0; - if (m_creature->IsWithinDistInMap(who, Radius)) + if (m_creature->IsWithinDistInMap(pWho, Radius)) { - Start(false, false, who->GetGUID()); + Start(false, false, pWho->GetGUID()); } } } } void Reset() {} - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) { diff --git a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp index b2c658c0eef..bfce48a17dd 100644 --- a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp @@ -179,7 +179,7 @@ public: void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -412,11 +412,9 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} - bool Completed; - void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -435,11 +433,11 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI case 29:DoScriptText(SAY_PROGRESS_4, m_creature, pPlayer); if (pPlayer) { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_A, m_creature); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_H, m_creature); - } Completed = true; + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->GroupEventHappens(QUEST_EFTW_A, m_creature); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->GroupEventHappens(QUEST_EFTW_H, m_creature); + } m_creature->SetInFront(pPlayer); break; case 30: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; case 31: DoCast(m_creature, SPELL_CAT); @@ -449,31 +447,19 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI void Reset() { - Completed = false; - m_creature->setFaction(1660); + me->RestoreFaction(); } - void EnterCombat(Unit* who){} - void JustDied(Unit* killer) { - if (PlayerGUID) + if (Player* pPlayer = GetPlayerForEscort()) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer && !Completed) - { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_A); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_H); - } + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->FailQuest(QUEST_EFTW_A); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->FailQuest(QUEST_EFTW_H); } } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -488,45 +474,7 @@ bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest c CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) { - npc_isla_starmaneAI* thisAI = new npc_isla_starmaneAI(pCreature); - - thisAI->AddWaypoint(0, -2265.21, 3091.14, 13.91); - thisAI->AddWaypoint(1, -2266.80, 3091.33, 13.82, 1000); - thisAI->AddWaypoint(2, -2268.20, 3091.14, 13.82, 7000);//progress1 - thisAI->AddWaypoint(3, -2278.32, 3098.98, 13.82); - thisAI->AddWaypoint(4, -2294.82, 3110.59, 13.82); - thisAI->AddWaypoint(5, -2300.71, 3114.60, 13.82, 20000);//progress2 - thisAI->AddWaypoint(6, -2300.71, 3114.60, 13.82, 3000);//progress3 - thisAI->AddWaypoint(7, -2307.36, 3122.76, 13.79); - thisAI->AddWaypoint(8, -2312.83, 3130.55, 12.04); - thisAI->AddWaypoint(9, -2345.02, 3151.00, 8.38); - thisAI->AddWaypoint(10, -2351.97, 3157.61, 6.27); - thisAI->AddWaypoint(11, -2360.35, 3171.48, 3.31); - thisAI->AddWaypoint(12, -2371.44, 3185.41, 0.89); - thisAI->AddWaypoint(13, -2371.21, 3197.92, -0.96); - thisAI->AddWaypoint(14, -2380.35, 3210.45, -1.08); - thisAI->AddWaypoint(15, -2384.74, 3221.25, -1.17); - thisAI->AddWaypoint(16, -2386.15, 3233.39, -1.29); - thisAI->AddWaypoint(17, -2383.45, 3247.79, -1.32); - thisAI->AddWaypoint(18, -2367.50, 3265.64, -1.33); - thisAI->AddWaypoint(19, -2354.90, 3273.30, -1.50); - thisAI->AddWaypoint(20, -2348.88, 3280.58, -0.09); - thisAI->AddWaypoint(21, -2349.06, 3295.86, -0.95); - thisAI->AddWaypoint(22, -2350.43, 3328.27, -2.10); - thisAI->AddWaypoint(23, -2346.76, 3356.27, -2.82); - thisAI->AddWaypoint(24, -2340.56, 3370.68, -4.02); - thisAI->AddWaypoint(25, -2318.84, 3384.60, -7.61); - thisAI->AddWaypoint(26, -2313.99, 3398.61, -10.40); - thisAI->AddWaypoint(27, -2320.85, 3414.49, -11.49); - thisAI->AddWaypoint(28, -2338.26, 3426.06, -11.46); - thisAI->AddWaypoint(29, -2342.67, 3439.44, -11.32, 12000);//progress4 - thisAI->AddWaypoint(30, -2342.67, 3439.44, -11.32, 7000);//emote bye - thisAI->AddWaypoint(31, -2342.67, 3439.44, -11.32, 5000);//cat form - thisAI->AddWaypoint(32, -2344.60, 3461.27, -10.44); - thisAI->AddWaypoint(33, -2396.81, 3517.17, -3.55); - thisAI->AddWaypoint(34, -2439.23, 3523.00, -1.05); - - return thisAI; + return new npc_isla_starmaneAI(pCreature); } /*###### @@ -624,7 +572,7 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if(!pPlayer) return; diff --git a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp index 0ce14cc0aee..2d505a5183a 100644 --- a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp @@ -284,34 +284,34 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pUnit = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pUnit) + if (!pPlayer) return; switch(i) { case 4: - DoScriptText(SAY_AMBUSH1, m_creature, pUnit); + DoScriptText(SAY_AMBUSH1, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 5: - DoScriptText(SAY_PROGRESS, m_creature, pUnit); + DoScriptText(SAY_PROGRESS, m_creature, pPlayer); SetRun(); break; case 16: - DoScriptText(SAY_AMBUSH2, m_creature, pUnit); + DoScriptText(SAY_AMBUSH2, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 17: SetRun(false); - DoScriptText(SAY_NEAR_END, m_creature, pUnit); + DoScriptText(SAY_NEAR_END, m_creature, pPlayer); break; case 25: - DoScriptText(SAY_END, m_creature, pUnit); - pUnit->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); + DoScriptText(SAY_END, m_creature, pPlayer); + pPlayer->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); break; } } |
