diff --git a/sql/migrations/20180526193243_world.sql b/sql/migrations/20180526193243_world.sql new file mode 100644 index 000000000..e45486139 --- /dev/null +++ b/sql/migrations/20180526193243_world.sql @@ -0,0 +1,270 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20180526193243'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20180526193243'); +-- Add your query below. + + +-- Make specific Ancient Core Hound in MC switch to random movement on waypoint 8. +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `flags`) VALUES +(116, 46, 0, 0, 0), -- Is Alive +(117, 43, 0, 0, 1), -- Is Not In Combat +(118, -1, 116, 117, 2), -- Source Is Alive And Not In Combat +(119, 43, 0, 0, 0), -- Source Is In Combat +(120, -1, 116, 119, 2); -- Source Is Alive And In Combat +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES (56851, 1, 20, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 118, 'Ancient Core Hound - Start Random Movement (Out of Combat)'); +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES (56851, 1, 67, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 'Ancient Core Hound - Set Default Movement to Random Movement (In Combat)'); +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES (56851, 120, 20, 2, 1, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 118, 'Ancient Core Hound - Resume Waypoint Movement from Point 8 (Out of Combat)'); +INSERT INTO `creature_movement_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES (56851, 120, 67, 2, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 'Ancient Core Hound - Set Default Movement to Waypoint Movement (In Combat)'); +UPDATE `creature_movement` SET `waittime`=5000, `script_id`=56851 WHERE `point`=8 && `id`=56851; + +-- Fix newly introduced startup errors. +-- ERROR:Creature (GUID: 46654) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46655) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46656) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46657) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46658) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46659) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46660) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46661) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46662) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46663) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46664) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46665) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46666) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46667) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46668) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46669) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46670) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46671) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46672) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46673) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46690) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46724) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46725) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46726) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46727) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46728) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46729) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46730) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46731) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46732) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46733) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46734) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46735) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46736) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46737) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46738) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46739) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46740) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46741) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46742) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46743) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46744) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46745) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46856) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46892) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46893) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46895) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46896) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46960) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46962) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46963) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46965) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46966) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46967) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46969) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46970) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46977) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46978) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46979) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46990) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46991) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46992) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 46994) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47045) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47046) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47047) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47048) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47049) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47050) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47051) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47077) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47078) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47079) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47080) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47081) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47086) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47087) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47205) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47206) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47207) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47209) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47210) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47211) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47212) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47213) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47214) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47215) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 47216) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 48173) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 48174) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 48203) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 48209) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88903) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88904) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88905) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88906) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88907) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88908) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88909) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 88911) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90487) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90489) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90491) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90513) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90515) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90516) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90517) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90519) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90520) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90521) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90522) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90523) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90524) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90525) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90526) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90527) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90528) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90529) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90530) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90531) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90532) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90533) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90534) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90535) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90536) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90537) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90538) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90539) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90540) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90541) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90542) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90543) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90544) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90545) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90546) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90547) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90548) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90549) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90550) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90551) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90552) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90553) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90554) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90555) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90556) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90557) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90558) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90559) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90560) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90561) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90562) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90563) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90564) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90565) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90566) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90567) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90568) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90569) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90570) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90571) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90572) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90573) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90574) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90575) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90576) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90577) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90578) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90579) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90580) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90581) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90582) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90583) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90584) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90585) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90747) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90748) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90749) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90750) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90751) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90752) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90753) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90754) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90755) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90756) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90757) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90758) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90759) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90760) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90761) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90762) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90763) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90764) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90765) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90766) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90768) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90769) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90770) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90771) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90772) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90773) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90774) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90775) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90776) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90777) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90778) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90779) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90780) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90781) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90784) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90786) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90787) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90788) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90789) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90790) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90791) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90792) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90793) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90794) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90795) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90796) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90797) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90798) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90799) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90800) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90801) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90802) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90803) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90804) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90806) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 90807) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 91108) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 91109) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 91110) does not exist but has a record in `creature_addon` +-- ERROR:Creature (GUID: 91112) does not exist but has a record in `creature_addon` +DELETE FROM `creature_addon` WHERE `guid` IN (46654, 46655, 46656, 46657, 46658, 46659, 46660, 46661, 46662, 46663, 46664, 46665, 46666, 46667, 46668, 46669, 46670, 46671, 46672, 46673, 46690, 46724, 46725, 46726, 46727, 46728, 46729, 46730, 46731, 46732, 46733, 46734, 46735, 46736, 46737, 46738, 46739, 46740, 46741, 46742, 46743, 46744, 46745, 46856, 46892, 46893, 46895, 46896, 46960, 46962, 46963, 46965, 46966, 46967, 46969, 46970, 46977, 46978, 46979, 46990, 46991, 46992, 46994, 47045, 47046, 47047, 47048, 47049, 47050, 47051, 47077, 47078, 47079, 47080, 47081, 47086, 47087, 47205, 47206, 47207, 47209, 47210, 47211, 47212, 47213, 47214, 47215, 47216, 48173, 48174, 48203, 48209, 88903, 88904, 88905, 88906, 88907, 88908, 88909, 88911, 90487, 90489, 90491, 90513, 90515, 90516, 90517, 90519, 90520, 90521, 90522, 90523, 90524, 90525, 90526, 90527, 90528, 90529, 90530, 90531, 90532, 90533, 90534, 90535, 90536, 90537, 90538, 90539, 90540, 90541, 90542, 90543, 90544, 90545, 90546, 90547, 90548, 90549, 90550, 90551, 90552, 90553, 90554, 90555, 90556, 90557, 90558, 90559, 90560, 90561, 90562, 90563, 90564, 90565, 90566, 90567, 90568, 90569, 90570, 90571, 90572, 90573, 90574, 90575, 90576, 90577, 90578, 90579, 90580, 90581, 90582, 90583, 90584, 90585, 90747, 90748, 90749, 90750, 90751, 90752, 90753, 90754, 90755, 90756, 90757, 90758, 90759, 90760, 90761, 90762, 90763, 90764, 90765, 90766, 90768, 90769, 90770, 90771, 90772, 90773, 90774, 90775, 90776, 90777, 90778, 90779, 90780, 90781, 90784, 90786, 90787, 90788, 90789, 90790, 90791, 90792, 90793, 90794, 90795, 90796, 90797, 90798, 90799, 90800, 90801, 90802, 90803, 90804, 90806, 90807, 91108, 91109, 91110, 91112); +-- ERROR:CREATURE GROUPS: Bad leader guid 56659 +DELETE FROM `creature_groups` WHERE `leaderGUID`=56659; + + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/Conditions.cpp b/src/game/Conditions.cpp index 88e284309..bf574a535 100644 --- a/src/game/Conditions.cpp +++ b/src/game/Conditions.cpp @@ -92,6 +92,7 @@ uint8 const ConditionTargetsInternal[] = CONDITION_REQ_TARGET_UNIT, // 43 CONDITION_REQ_BOTH_UNITS, // 44 CONDITION_REQ_TARGET_PLAYER, // 45 + CONDITION_REQ_TARGET_UNIT, // 46 }; // Starts from 4th element so that -3 will return first element. @@ -570,6 +571,10 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, { return target->ToPlayer()->GetGroup(); } + case CONDITION_IS_ALIVE: + { + return target->ToUnit()->isAlive(); + } } return false; } @@ -1115,6 +1120,7 @@ bool ConditionEntry::IsValid() case CONDITION_IS_IN_COMBAT: case CONDITION_IS_HOSTILE_TO: case CONDITION_IS_IN_GROUP: + case CONDITION_IS_ALIVE: break; default: sLog.outErrorDb("Condition entry %u has bad type of %d, skipped ", m_entry, m_condition); diff --git a/src/game/Conditions.h b/src/game/Conditions.h index 52b813c85..76b89ba80 100644 --- a/src/game/Conditions.h +++ b/src/game/Conditions.h @@ -72,7 +72,7 @@ enum ConditionType CONDITION_MAP_ID = 33, // map_id CONDITION_INSTANCE_DATA = 34, // index data 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than) CONDITION_MAP_EVENT_DATA = 35, // event_id index data 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than) - CONDITION_MAP_EVENT_ACTIVE = 36, // event_id + CONDITION_MAP_EVENT_ACTIVE = 36, // event_id 0 CONDITION_LINE_OF_SIGHT = 37, // 0 0 CONDITION_DISTANCE = 38, // distance 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than) CONDITION_IS_MOVING = 39, // 0 0 @@ -82,6 +82,7 @@ enum ConditionType CONDITION_IS_IN_COMBAT = 43, // 0 0 CONDITION_IS_HOSTILE_TO = 44, // 0 0 CONDITION_IS_IN_GROUP = 45, // 0 0 + CONDITION_IS_ALIVE = 46, // 0 0 }; enum ConditionFlags diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index 3286abefb..4d9c05517 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -827,6 +827,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj bool ScriptCommand_RemoveMapEventTarget(const ScriptInfo& script, WorldObject* source, WorldObject* target); bool ScriptCommand_SetMapEventData(const ScriptInfo& script, WorldObject* source, WorldObject* target); bool ScriptCommand_SendMapEvent(const ScriptInfo& script, WorldObject* source, WorldObject* target); + bool ScriptCommand_SetDefaultMovement(const ScriptInfo& script, WorldObject* source, WorldObject* target); // Add any new script command functions to the array. const ScriptCommandFunction m_ScriptCommands[SCRIPT_COMMAND_MAX] = @@ -898,6 +899,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj &Map::ScriptCommand_RemoveMapEventTarget, // 64 &Map::ScriptCommand_SetMapEventData, // 65 &Map::ScriptCommand_SendMapEvent, // 66 + &Map::ScriptCommand_SetDefaultMovement, // 67 }; public: diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index 9d48e22f6..037c27c23 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -700,12 +700,18 @@ bool Map::ScriptCommand_SetMovementType(const ScriptInfo& script, WorldObject* s switch (script.movement.movementType) { case IDLE_MOTION_TYPE: + if (script.movement.clear) + pSource->GetMotionMaster()->Clear(false, true); pSource->GetMotionMaster()->MoveIdle(); break; case RANDOM_MOTION_TYPE: + if (script.movement.clear) + pSource->GetMotionMaster()->Clear(false, true); pSource->GetMotionMaster()->MoveRandom(script.movement.boolParam, script.x); break; case WAYPOINT_MOTION_TYPE: + if (script.movement.clear) + pSource->GetMotionMaster()->Clear(false, true); pSource->GetMotionMaster()->MoveWaypoint(0, script.movement.intParam, 0, 0, 0, script.movement.boolParam); break; case CONFUSED_MOTION_TYPE: @@ -1033,10 +1039,24 @@ bool Map::ScriptCommand_SetHomePosition(const ScriptInfo& script, WorldObject* s return ShouldAbortScript(script); } - if (script.setHome.useCurrent) - pSource->SaveHomePosition(); - else - pSource->SetHomePosition(script.x, script.y, script.z, script.o); + switch (script.setHome.mode) + { + case SO_SETHOME_PROVIDED_POSITION: + { + pSource->SetHomePosition(script.x, script.y, script.z, script.o); + break; + } + case SO_SETHOME_CURRENT_POSITION: + { + pSource->SaveHomePosition(); + break; + } + case SO_SETHOME_DEFAULT_POSITION: + { + pSource->ResetHomePosition(); + break; + } + } return false; } @@ -1796,5 +1816,29 @@ bool Map::ScriptCommand_SendMapEvent(const ScriptInfo& script, WorldObject* sour } } + return false; +} + +// SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (67) +bool Map::ScriptCommand_SetDefaultMovement(const ScriptInfo& script, WorldObject* source, WorldObject* target) +{ + Creature* pSource = ToCreature(source); + + if (!pSource) + { + sLog.outError("SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (script id %u) call for a NULL or non-creature source (TypeId: %u), skipping.", script.id, source ? source->GetTypeId() : 0); + return ShouldAbortScript(script); + } + + pSource->SetDefaultMovementType(MovementGeneratorType(script.setDefaultMovement.movementType)); + + if (script.setDefaultMovement.movementType == RANDOM_MOTION_TYPE) + pSource->SetRespawnRadius(script.setDefaultMovement.param1); + else if (script.setDefaultMovement.movementType == WAYPOINT_MOTION_TYPE) + pSource->m_startwaypoint = script.setDefaultMovement.param1; + + if (pSource->isAlive()) + pSource->GetMotionMaster()->InitializeNewDefault(script.setDefaultMovement.alwaysReplace); + return false; } \ No newline at end of file diff --git a/src/game/Movement/MotionMaster.cpp b/src/game/Movement/MotionMaster.cpp index eb00e80d6..74a65c4c0 100644 --- a/src/game/Movement/MotionMaster.cpp +++ b/src/game/Movement/MotionMaster.cpp @@ -55,8 +55,8 @@ void MotionMaster::Initialize() // set new default movement generator if (m_owner->GetTypeId() == TYPEID_UNIT && !m_owner->hasUnitState(UNIT_STAT_CONTROLLED)) { - MovementGenerator* movement = FactorySelector::selectMovementGenerator((Creature*)m_owner); - push(movement == NULL ? &si_idleMovement : movement); + MovementGenerator* movement = FactorySelector::selectMovementGenerator(static_cast(m_owner)); + push(movement == nullptr ? &si_idleMovement : movement); top()->Initialize(*m_owner); if (top()->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE) (static_cast*>(top()))->InitializeWaypointPath(*(static_cast(m_owner)), 0, static_cast(m_owner)->m_startwaypoint, PATH_NO_PATH, 0, 0, true); @@ -64,7 +64,7 @@ void MotionMaster::Initialize() else push(&si_idleMovement); - // Pet movement after control movement spell + // Pet movement after control movement spell. if (CharmInfo* ci = m_owner->GetCharmInfo()) { ci->SetIsAtStay(false); @@ -73,6 +73,65 @@ void MotionMaster::Initialize() } } +void MotionMaster::InitializeNewDefault(bool alwaysReplace) +{ + // This method changes the creature's default movement type + // without interrupting the currently used movement generator + + if (empty()) + { + Initialize(); + return; + } + + Creature* pCreature = m_owner->ToCreature(); + if (!pCreature) + return; + + MovementGeneratorType new_default = pCreature->GetDefaultMovementType(); + + // Already using the same motion type as default + if (!alwaysReplace && (size() == 1) && (top()->GetMovementGeneratorType() == new_default)) + return; + + // Get the current generator and eject it from the stack + MovementGenerator *curr = top(); + pop(); + + // Clear ALL other movement generators + Clear(false, true); + + if (alwaysReplace || (curr->GetMovementGeneratorType() != new_default)) + { + // Set new default movement generator + if (!m_owner->hasUnitState(UNIT_STAT_CONTROLLED)) + { + MovementGenerator* movement = FactorySelector::selectMovementGenerator(pCreature); + push(movement == nullptr ? &si_idleMovement : movement); + top()->Initialize(*m_owner); + if (top()->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + (static_cast*>(top()))->InitializeWaypointPath(*(pCreature), 0, pCreature->m_startwaypoint, PATH_NO_PATH, 100, 0, true); + } + else + push(&si_idleMovement); + + // Restore the previous current generator, if its different from the new default + if (curr->GetMovementGeneratorType() != new_default) + push(curr); + else + { + // Same as the new default, so we can delete it + if (!m_expList) + m_expList = new ExpireList(); + curr->Finalize(*m_owner); + if (!isStatic(curr)) + m_expList->push_back(curr); + } + } + else + push(curr); +} + MotionMaster::~MotionMaster() { // just deallocate movement generator, but do not Finalize since it may access to already deallocated owner's memory @@ -123,7 +182,7 @@ void MotionMaster::UpdateMotion(uint32 diff) } delete m_expList; - m_expList = NULL; + m_expList = nullptr; if (empty()) Initialize(); @@ -229,7 +288,7 @@ void MotionMaster::DirectExpire(bool reset) delete(*it); } // Store current top MMGen, as Finalize might push a new MMGen - MovementGenerator* nowTop = empty() ? NULL : top(); + MovementGenerator* nowTop = empty() ? nullptr : top(); // it can add another motions instead curr->Finalize(*m_owner); @@ -351,7 +410,13 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) if (m_owner->GetTypeId() == TYPEID_PLAYER) Mutate(new ChaseMovementGenerator(*target, dist, angle)); else + { + // interrupt current movespline + if (!m_owner->IsStopped()) + m_owner->StopMoving(); + Mutate(new ChaseMovementGenerator(*target, dist, angle)); + } } void MotionMaster::MoveFollow(Unit* target, float dist, float angle) diff --git a/src/game/Movement/MotionMaster.h b/src/game/Movement/MotionMaster.h index b071e2157..e63677b5b 100644 --- a/src/game/Movement/MotionMaster.h +++ b/src/game/Movement/MotionMaster.h @@ -92,6 +92,7 @@ class MANGOS_DLL_SPEC MotionMaster : std::stack ~MotionMaster(); void Initialize(); + void InitializeNewDefault(bool alwaysReplace); MovementGenerator const* GetCurrent() const { return top(); } //MovementGenerator* top() { return std::stack::top(); } diff --git a/src/game/Movement/WaypointMovementGenerator.cpp b/src/game/Movement/WaypointMovementGenerator.cpp index fdacfc867..7426ba405 100644 --- a/src/game/Movement/WaypointMovementGenerator.cpp +++ b/src/game/Movement/WaypointMovementGenerator.cpp @@ -77,7 +77,10 @@ void WaypointMovementGenerator::InitializeWaypointPath(Creature& u, in if (startPoint) { if (i_path && !i_path->empty() && (i_path->find(startPoint) != i_path->end())) + { i_currentNode = startPoint; + m_lastReachedWaypoint = startPoint - 1; + } else sLog.outError("WaypointMovementGenerator::InitializeWaypointPath: %s tries to start movement from invalid point id %u", u.GetGuidStr().c_str(), startPoint); } diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index a27314105..0bfe2a4e1 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -3123,6 +3123,14 @@ void Creature::SetHomePosition(float x, float y, float z, float o) m_HomeOrientation = o; } +void Creature::ResetHomePosition() +{ + if (CreatureData const *data = sObjectMgr.GetCreatureData(GetGUIDLow())) + SetHomePosition(data->posX, data->posY, data->posZ, data->orientation); + else if (IsTemporarySummon()) + GetSummonPoint(m_HomeX, m_HomeY, m_HomeZ, m_HomeOrientation); +} + void Creature::OnLeaveCombat() { UpdateCombatState(false); diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index 8886dd760..1f9d10ab4 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -511,6 +511,7 @@ class MANGOS_DLL_SPEC Creature : public Unit void SetHomePosition(float x, float y, float z, float o); void GetHomePosition(float &x, float &y, float &z, float &o, float* dist = nullptr); float GetHomePositionO() const { return m_HomeOrientation; } + void ResetHomePosition(); CreatureSubtype GetSubtype() const { return m_subtype; } bool IsPet() const { return m_subtype == CREATURE_SUBTYPE_PET; } diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 43238f9d4..b8dc716cf 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -993,6 +993,15 @@ void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename) } break; } + case SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT: + { + if (tmp.setDefaultMovement.movementType >= MAX_DB_MOTION_TYPE) + { + sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT for script id %u.", tablename, tmp.setDefaultMovement.movementType, tmp.id); + continue; + } + break; + } } if (scripts.find(tmp.id) == scripts.end()) diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index bc9a22a7f..5d4580ebc 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -136,6 +136,7 @@ enum eScriptCommand // datalong = see enum MovementGeneratorType (not all are supported) // datalong2 = bool_param (meaning depends on the motion type) // datalong3 = int_param (meaning depends on the motion type) + // datalong4 = (bool) clear // x = distance (only for some motion types) // o = angle (only for some motion types) SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21, // source = Creature @@ -173,7 +174,7 @@ enum eScriptCommand // datalong3 = eTerminateConditionFlags SCRIPT_COMMAND_ENTER_EVADE_MODE = 33, // source = Creature SCRIPT_COMMAND_SET_HOME_POSITION = 34, // source = Creature - // datalong = (bool) use_current_position + // datalong = eSetHomePositionOptions // x/y/z/o = coordinates SCRIPT_COMMAND_TURN_TO = 35, // source = Unit // target = WorldObject @@ -281,6 +282,10 @@ enum eScriptCommand // datalong = event_id // datalong2 = data // datalong3 = eSendMapEventOptions + SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT = 67, // source = Creature + // datalong = movement_type + // datalong = (bool) always_replace + // datalong3 = param1 SCRIPT_COMMAND_MAX, @@ -359,6 +364,14 @@ enum eTerminateConditionFlags SF_TERMINATECONDITION_WHEN_FALSE = 0x1 }; +// Possible datalong values for SCRIPT_COMMAND_SET_HOME_POSITION +enum eSetHomePositionOptions +{ + SO_SETHOME_PROVIDED_POSITION = 0, + SO_SETHOME_CURRENT_POSITION = 1, + SO_SETHOME_DEFAULT_POSITION = 2 +}; + // Possible datalong values for SCRIPT_COMMAND_TURN_TO enum eTurnToFacingOptions { @@ -586,6 +599,7 @@ struct ScriptInfo uint32 movementType; // datalong uint32 boolParam; // datalong2 uint32 intParam; // datalong3 + uint32 clear; // datalong4 } movement; struct // SCRIPT_COMMAND_SET_ACTIVEOBJECT (21) @@ -657,7 +671,7 @@ struct ScriptInfo struct // SCRIPT_COMMAND_SET_HOME_POSITION (34) { - uint32 useCurrent; // datalong + uint32 mode; // datalong } setHome; struct // SCRIPT_COMMAND_TURN_TO (35) @@ -861,6 +875,13 @@ struct ScriptInfo uint32 targets; // datalong3 } sendMapEvent; + struct // SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (67) + { + uint32 movementType; // datalong + uint32 alwaysReplace; // datalong2 + uint32 param1; // datalong3 + } setDefaultMovement; + struct { uint32 data[9];