diff --git a/data/sql/updates/db_world/2025_01_07_00.sql b/data/sql/updates/db_world/2025_01_07_00.sql new file mode 100644 index 000000000..e724ddcad --- /dev/null +++ b/data/sql/updates/db_world/2025_01_07_00.sql @@ -0,0 +1,178 @@ +-- DB update 2025_01_05_07 -> 2025_01_07_00 + +-- Remove Wrong WP for Tamed Amani Crocolisk +DELETE FROM `waypoint_data` WHERE `id` IN (176360, 201960); + +-- Remove Amani'shi Handler and Flame Caster (replaced with Amani'shi Beast Tamer) +DELETE FROM `creature` WHERE (`id1` = 24065) AND (`guid` IN (24323, 20861, 34024, 34025, 34026)); +DELETE FROM `creature` WHERE (`id1` = 23596) AND (`guid` IN (34031, 34030)); +DELETE FROM `creature_addon` WHERE (`guid` IN (24323, 20861, 34024, 34025, 34031, 34030, 34026)); +DELETE FROM `linked_respawn` WHERE (`guid` IN (24323, 20861, 34024, 34025, 34031, 34030, 34026)); + +-- Waypoint for Amani'shi Beast Tamer group (already in DB I only corrected it) +DELETE FROM `waypoint_data` WHERE `id` IN (243230); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(243230, 1, 442.129, 904.214, 0.000692, NULL, 0, 0, 0, 100, 0), +(243230, 2, 416.327, 888.693, 0.000035, NULL, 0, 0, 0, 100, 0), +(243230, 3, 442.129, 904.214, 0.000692, NULL, 0, 0, 0, 100, 0), +(243230, 4, 445.459, 962.963, 0.000075, NULL, 0, 0, 0, 100, 0), +(243230, 5, 425.408, 985.171, 0.000075, NULL, 0, 0, 0, 100, 0), +(243230, 6, 410.89, 986.49, 0.000075, NULL, 0, 0, 0, 100, 0), +(243230, 7, 425.408, 985.171, 0.000075, NULL, 0, 0, 0, 100, 0), +(243230, 8, 445.459, 962.963, 0.000075, NULL, 0, 0, 0, 100, 0), +(243230, 9, 442.129, 904.214, 0.000692, NULL, 0, 0, 0, 100, 0); + +-- Sniffed Waypoint for an Amani'shi Handler +DELETE FROM `waypoint_data` WHERE `id` IN (8917400); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(8917400, 1, 221.95709, 1133.2837, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 2, 220.70128, 1130.3092, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 3, 222.21317, 1126.2802, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 4, 225.12256, 1123.6393, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 5, 231.03201, 1126.2893, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 6, 235.53342, 1124.0503, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 7, 242.74089, 1126.9958, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 8, 244.73573, 1133.0251, 1.55080, NULL, 0, 0, 0, 100, 0), +(8917400, 9, 248.98828, 1142.2306, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 10, 243.06467, 1143.4736, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 11, 242.09348, 1137.6598, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 12, 236.63585, 1135.982, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 13, 231.60368, 1135.6569, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 14, 227.66483, 1133.9977, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 15, 224.44601, 1136.731, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 16, 221.43864, 1138.8192, 0, NULL, 0, 0, 0, 100, 0), +(8917400, 17, 221.95709, 1133.2837, 0, NULL, 0, 0, 0, 100, 0); + +-- Set WD, MT and remove pathid from Tamed Amani Crocolisk +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 0 WHERE `guid` IN (17636, 20196) AND `id1` = 24138; +UPDATE `creature_addon` SET `path_id` = 0 WHERE (`guid` IN (17636, 20196)); + +-- Create new Amani'shi Beast Tamer +DELETE FROM `creature` WHERE (`id1` = 24059) AND (`guid` IN (89309, 89311, 89312, 89329, 89407)); +INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES +(89309, 24059, 0, 0, 568, 0, 0, 1, 1, 1, 277.305, 1054.69, 0.000044, 5.70759, 7200, 0, 0, 78044, 0, 2, 0, 0, 0, '', 0), +(89311, 24059, 0, 0, 568, 0, 0, 1, 1, 1, 436.083, 920.6, 0.00397012, 1.93599, 7200, 0, 0, 78044, 0, 2, 0, 0, 0, '', 0), +(89312, 24059, 0, 0, 568, 0, 0, 1, 1, 1, 440.151, 919.88, 0.0001, 4.539345, 7200, 0, 0, 78044, 0, 0, 0, 0, 0, '', 0), +(89329, 24059, 0, 0, 568, 0, 0, 1, 1, 1, 385.161, 996.886, 0.009852, 5.01081, 7200, 0, 0, 78044, 0, 0, 0, 0, 0, '', 0), +(89407, 24059, 0, 0, 568, 0, 0, 1, 1, 1, 381.87, 991.632, 0.00122086, 0.387951, 7200, 0, 0, 78044, 0, 0, 0, 0, 0, '', 0); + +-- Update WD and MT for Amani'shi Handler +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 2 WHERE `guid` IN (89174) AND `id1` = 24065; + +-- Creature Addon for two Amani'shi Beast Tamer and one Amani'shi Handler +DELETE FROM `creature_addon` WHERE (`guid` IN (89309, 89311, 89174)); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES +(89309, 208610, 0, 0, 0, 0, 0, NULL), +(89311, 243230, 0, 0, 0, 0, 0, NULL), +(89174, 8917400, 0, 0, 0, 0, 0, NULL); + +-- Set Creature Formation for Amani'shi Beast Tamer and Crocodiles +DELETE FROM `creature_formations` WHERE `leaderGUID` = 89309; +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(89309, 89309, 0, 0, 515, 0, 0), +(89309, 17636, 3, 90, 515, 0, 0), +(89309, 20196, 3, 270, 515, 0, 0); + +-- Set Creature Formation for two Amani'shi Beast Tamer +DELETE FROM `creature_formations` WHERE `leaderGUID` = 89311; +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(89311, 89311, 0, 0, 515, 0, 0), +(89311, 89312, 3, 90, 515, 0, 0); + +-- Set WD and MT for Amani Lynx +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 0 WHERE `guid` IN (25813, 28406, 29104, 29105, 29107, 29108, 29109, 29441, 29846, 31753, 31756, 31826, 31834, 33301) AND `id1` = 24043; + +-- Set SmartAI for Amani Lynx +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 24043; +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 24043); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(24043, 0, 0, 0, 1, 0, 100, 3, 0, 0, 1000, 1000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(24043, 0, 1, 2, 4, 0, 100, 512, 0, 0, 0, 0, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - On Aggro - Remove Aura \'Stealth\''), +(24043, 0, 2, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 11, 43317, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - On Aggro - Cast \'Dash\''), +(24043, 0, 3, 0, 0, 0, 100, 2, 5000, 5000, 35000, 35000, 0, 0, 11, 43357, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - In Combat - Cast \'Feral Swipe\''); + +-- Set WD and MT for Amani Lynx Cub +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 0 WHERE `guid` IN (87042, 89201, 89202, 89203) AND `id1` = 24064; + +-- Add Extra Flag (DONT_OVERRIDE_SAI_ENTRY) +UPDATE `creature_template` SET `flags_extra` = `flags_extra`|134217728 WHERE `entry` IN (24064); + +-- Amani Lynx Cub smartAI change +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 24064; +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 24064); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(24064, 0, 0, 1, 4, 0, 100, 0, 0, 0, 0, 0, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - On Aggro - Remove Aura \'Stealth\''), +(24064, 0, 1, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 11, 43317, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - On Aggro - Cast \'Dash\''), +(24064, 0, 2, 0, 0, 0, 100, 2, 5000, 5000, 35000, 35000, 0, 0, 11, 43358, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - In Combat - Cast \'Gut Rip\' (Normal Dungeon)'); + +-- First on/off invisibility pack +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89177); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89177, 0, 3, 0, 1, 0, 100, 0, 30000, 35000, 30000, 35000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89177, 0, 4, 0, 1, 0, 100, 0, 40000, 40000, 40000, 40000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -86922); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-86922, 0, 3, 0, 1, 0, 100, 0, 50000, 55000, 50000, 55000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-86922, 0, 4, 0, 1, 0, 100, 0, 60000, 60000, 60000, 60000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89172); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89172, 0, 3, 0, 1, 0, 100, 0, 60000, 65000, 60000, 65000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89172, 0, 4, 0, 1, 0, 100, 0, 70000, 70000, 70000, 70000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89173); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89173, 0, 3, 0, 1, 0, 100, 0, 80000, 85000, 80000, 85000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89173, 0, 4, 0, 1, 0, 100, 0, 90000, 90000, 90000, 90000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89145); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89145, 0, 3, 0, 1, 0, 100, 0, 100000, 105000, 100000, 105000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89145, 0, 4, 0, 1, 0, 100, 0, 110000, 110000, 110000, 110000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89175); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89175, 0, 3, 0, 1, 0, 100, 0, 20000, 25000, 20000, 25000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89175, 0, 4, 0, 1, 0, 100, 0, 30000, 30000, 30000, 30000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -86921); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-86921, 0, 3, 0, 1, 0, 100, 0, 120000, 125000, 120000, 125000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-86921, 0, 4, 0, 1, 0, 100, 0, 130000, 130000, 130000, 130000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +-- Second on/off invisibility pack +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -87043); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-87043, 0, 3, 0, 1, 0, 100, 0, 30000, 35000, 30000, 35000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-87043, 0, 4, 0, 1, 0, 100, 0, 40000, 40000, 40000, 40000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -86198); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-86198, 0, 3, 0, 1, 0, 100, 0, 50000, 55000, 50000, 55000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-86198, 0, 4, 0, 1, 0, 100, 0, 60000, 60000, 60000, 60000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89141); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89141, 0, 3, 0, 1, 0, 100, 0, 60000, 65000, 60000, 65000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89141, 0, 4, 0, 1, 0, 100, 0, 70000, 70000, 70000, 70000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89176); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89176, 0, 3, 0, 1, 0, 100, 0, 80000, 85000, 80000, 85000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89176, 0, 4, 0, 1, 0, 100, 0, 90000, 90000, 90000, 90000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -88652); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-88652, 0, 3, 0, 1, 0, 100, 0, 100000, 105000, 100000, 105000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-88652, 0, 4, 0, 1, 0, 100, 0, 110000, 110000, 110000, 110000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89135); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89135, 0, 3, 0, 1, 0, 100, 0, 20000, 25000, 20000, 25000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89135, 0, 4, 0, 1, 0, 100, 0, 30000, 30000, 30000, 30000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = -89200); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(-89200, 0, 3, 0, 1, 0, 100, 0, 120000, 125000, 120000, 125000, 0, 0, 11, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Cast \'Stealth\''), +(-89200, 0, 4, 0, 1, 0, 100, 0, 130000, 130000, 130000, 130000, 0, 0, 28, 42943, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amani Lynx Cub - Out of Combat - Remove Aura \'Stealth\''); diff --git a/data/sql/updates/db_world/2025_01_07_01.sql b/data/sql/updates/db_world/2025_01_07_01.sql new file mode 100644 index 000000000..ec32fe160 --- /dev/null +++ b/data/sql/updates/db_world/2025_01_07_01.sql @@ -0,0 +1,44 @@ +-- DB update 2025_01_07_00 -> 2025_01_07_01 + +-- Delete Wrong Amani'shi Medicine Man +DELETE FROM `creature` WHERE (`id1` = 23581) AND (`guid` IN (89310)); +DELETE FROM `creature_addon` WHERE (`guid` IN (89310)); +DELETE FROM `linked_respawn` WHERE (`guid` IN (89310)); + +-- Set WD and MT for Amani'shi Medicine Man +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 0 WHERE `guid` IN (86209) AND `id1` = 23581; + +-- Waypoint +DELETE FROM `waypoint_data` WHERE `id` IN (8621000); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(8621000, 1, 97.787, 1411.9034, -3.8629317, NULL, 0, 0, 0, 100, 0), +(8621000, 2, 118.593, 1404.9677, -7.3945456, NULL, 0, 0, 0, 100, 0), +(8621000, 3, 140.44618, 1412.8431, -0.6880279, NULL, 0, 0, 0, 100, 0), +(8621000, 4, 160.95193, 1408.474, 4.5122232, NULL, 0, 0, 0, 100, 0), +(8621000, 5, 148.4082, 1422.7607, 2.8240137, NULL, 0, 0, 0, 100, 0), +(8621000, 6, 132.07227, 1418.0293, -1.9425232, NULL, 0, 0, 0, 100, 0), +(8621000, 7, 99.87826, 1421.7754, 0.6053877, NULL, 0, 0, 0, 100, 0), +(8621000, 8, 69.989365, 1421.9194, 0.8218676, NULL, 0, 0, 0, 100, 0), +(8621000, 9, 63.964302, 1410.9033, 0.8689089, NULL, 0, 0, 0, 100, 0), +(8621000, 10, 97.787, 1411.9034, -3.8629317, NULL, 0, 0, 0, 100, 0); + +-- Set WD and MT and add creature addon for Amani'shi Wind Walker (I would have preferred to put the path in the guid smartai, just to prevent the delay). +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 2 WHERE `guid` IN (86210) AND `id1` = 24179; +DELETE FROM `creature_addon` WHERE (`guid` IN (86210)); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES +(86210, 8621000, 0, 0, 0, 0, 0, NULL); + +-- Add Creature Formation +DELETE FROM `creature_formations` WHERE `leaderGUID` = 86210; +INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES +(86210, 86210, 0, 0, 515, 0, 0), +(86210, 86209, 3, 270, 515, 0, 0); + +-- Remove other two Wrong Npcs (and set WD and MT for another). +DELETE FROM `creature` WHERE (`id1` = 24059) AND (`guid` IN (86211)); +DELETE FROM `creature` WHERE (`id1` = 23596) AND (`guid` IN (86212)); +DELETE FROM `creature_addon` WHERE (`guid` IN (86211 ,86212)); +DELETE FROM `linked_respawn` WHERE (`guid` IN (86211 ,86212)); + +-- This npc and an Amani'shi Flame Caster should be in formation and one of them have a waypoint, but I cannot sniff it (it was changed during cataclysm). +UPDATE `creature` SET `wander_distance` = 0, `MovementType` = 0 WHERE `guid` IN (89326) AND `id1` = 24059; diff --git a/data/sql/updates/db_world/2025_01_07_02.sql b/data/sql/updates/db_world/2025_01_07_02.sql new file mode 100644 index 000000000..a9f252e9a --- /dev/null +++ b/data/sql/updates/db_world/2025_01_07_02.sql @@ -0,0 +1,3 @@ +-- DB update 2025_01_07_01 -> 2025_01_07_02 +-- loot table for item 22568 Sealed Craftsman's Writ +UPDATE `item_template` SET `flagsCustom` = `flagsCustom` | 2 WHERE `entry` BETWEEN 22600 AND 22626; diff --git a/data/sql/updates/db_world/2025_01_07_03.sql b/data/sql/updates/db_world/2025_01_07_03.sql new file mode 100644 index 000000000..9f8412d62 --- /dev/null +++ b/data/sql/updates/db_world/2025_01_07_03.sql @@ -0,0 +1,3 @@ +-- DB update 2025_01_07_02 -> 2025_01_07_03 +-- +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` IN (17160, 17159)); diff --git a/data/sql/updates/db_world/2025_01_09_00.sql b/data/sql/updates/db_world/2025_01_09_00.sql new file mode 100644 index 000000000..ba792d62b --- /dev/null +++ b/data/sql/updates/db_world/2025_01_09_00.sql @@ -0,0 +1,8 @@ +-- DB update 2025_01_07_03 -> 2025_01_09_00 + +-- Delete Tanzar +DELETE FROM `creature` WHERE `id1` = 23790 AND (`guid` IN (89157)); +DELETE FROM `creature_addon` WHERE (`guid` IN (89157)); + +-- Set use group loot rules +UPDATE `gameobject_template` SET `Data15` = `Data15`|1 WHERE (`entry` = 186648); diff --git a/src/common/Threading/PCQueue.h b/src/common/Threading/PCQueue.h index 1efb494ba..57ea0b2d3 100644 --- a/src/common/Threading/PCQueue.h +++ b/src/common/Threading/PCQueue.h @@ -20,51 +20,51 @@ #include #include +#include +#include template class ProducerConsumerQueue { private: - std::mutex _queueLock; + mutable std::mutex _queueLock; std::queue _queue; std::condition_variable _condition; - std::atomic _cancel; - std::atomic _shutdown; + std::atomic _cancel{}; + std::atomic _shutdown{}; public: - ProducerConsumerQueue() : _cancel(false), _shutdown(false) { } + ProducerConsumerQueue() = default; void Push(const T& value) { - std::lock_guard lock(_queueLock); - _queue.push(std::move(value)); - + { + std::lock_guard lock(_queueLock); + _queue.push(std::move(value)); + } _condition.notify_one(); } - bool Empty() + bool Empty() const { std::lock_guard lock(_queueLock); - return _queue.empty(); } [[nodiscard]] std::size_t Size() const { + std::lock_guard lock(_queueLock); return _queue.size(); } bool Pop(T& value) { std::lock_guard lock(_queueLock); - if (_queue.empty() || _cancel) return false; - value = _queue.front(); - + value = std::move(_queue.front()); _queue.pop(); - return true; } @@ -72,39 +72,30 @@ public: { std::unique_lock lock(_queueLock); - // we could be using .wait(lock, predicate) overload here but it is broken - // https://connect.microsoft.com/VisualStudio/feedback/details/1098841 - while (_queue.empty() && !_cancel && !_shutdown) - _condition.wait(lock); + // Wait for the queue to have an element or the cancel/shutdown flag + _condition.wait(lock, [this] { return !_queue.empty() || _cancel || _shutdown; }); if (_queue.empty() || _cancel) return; - value = _queue.front(); - + value = std::move(_queue.front()); _queue.pop(); } - // Clears the queue and will immediately stop any consumers + // Clears the queue and immediately stops any consumers. void Cancel() { - std::unique_lock lock(_queueLock); - - while (!_queue.empty()) - { + std::lock_guard lock(_queueLock); + while (!_queue.empty()) { T& value = _queue.front(); - DeleteQueuedObject(value); - _queue.pop(); } - _cancel = true; - _condition.notify_all(); } - // Graceful stop, will wait for queue to become empty before stopping consumers + // Graceful stop: waits for the queue to become empty before stopping consumers. void Shutdown() { _shutdown = true; @@ -113,10 +104,13 @@ public: private: template - typename std::enable_if::value>::type DeleteQueuedObject(E& obj) { delete obj; } + typename std::enable_if::value>::type DeleteQueuedObject(E& obj) + { + delete obj; + } template - typename std::enable_if::value>::type DeleteQueuedObject(E const& /*packet*/) { } + typename std::enable_if::value>::type DeleteQueuedObject(E const& /*obj*/) { } }; #endif diff --git a/src/common/Utilities/TaskScheduler.cpp b/src/common/Utilities/TaskScheduler.cpp index 6f8978f3c..8e07e0ed0 100644 --- a/src/common/Utilities/TaskScheduler.cpp +++ b/src/common/Utilities/TaskScheduler.cpp @@ -124,9 +124,9 @@ bool TaskScheduler::IsGroupScheduled(group_t const group) return _task_holder.IsGroupQueued(group); } -Milliseconds TaskScheduler::GetNextGroupOcurrence(group_t const group) const +Milliseconds TaskScheduler::GetNextGroupOccurrence(group_t const group) const { - return std::chrono::duration_cast(_task_holder.GetNextGroupOcurrence(group) - clock_t::now()); + return std::chrono::duration_cast(_task_holder.GetNextGroupOccurrence(group) - clock_t::now()); } void TaskScheduler::TaskQueue::Push(TaskContainer&& task) @@ -194,15 +194,12 @@ bool TaskScheduler::TaskQueue::IsGroupQueued(group_t const group) return false; } -TaskScheduler::timepoint_t TaskScheduler::TaskQueue::GetNextGroupOcurrence(group_t const group) const +TaskScheduler::timepoint_t TaskScheduler::TaskQueue::GetNextGroupOccurrence(group_t const group) const { TaskScheduler::timepoint_t next = TaskScheduler::timepoint_t::max(); for (auto const& task : container) - { if (task->IsInGroup(group) && task->_end < next) next = task->_end; - } - return next; } @@ -248,7 +245,7 @@ TaskScheduler::repeated_t TaskContext::GetRepeatCounter() const return _task->_repeated; } -TaskScheduler::timepoint_t TaskContext::GetNextOcurrence() const +TaskScheduler::timepoint_t TaskContext::GetNextOccurrence() const { return _task->_end; } diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index b85ad5497..4e422d637 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -149,7 +149,7 @@ class TaskScheduler bool IsGroupQueued(group_t const group); // Returns the next group occurrence. - TaskScheduler::timepoint_t GetNextGroupOcurrence(group_t const group) const; + TaskScheduler::timepoint_t GetNextGroupOccurrence(group_t const group) const; bool IsEmpty() const; }; @@ -377,7 +377,7 @@ public: } // Returns the next group occurrence. - Milliseconds GetNextGroupOcurrence(group_t const group) const; + Milliseconds GetNextGroupOccurrence(group_t const group) const; private: /// Insert a new task to the enqueued tasks. @@ -483,7 +483,7 @@ public: /// Returns the repeat counter which increases every time the task is repeated. TaskScheduler::repeated_t GetRepeatCounter() const; - TaskScheduler::timepoint_t GetNextOcurrence() const; + TaskScheduler::timepoint_t GetNextOccurrence() const; /// Repeats the event and sets a new duration. /// std::chrono::seconds(5) for example. diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 95f931439..423db19e1 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3516,20 +3516,20 @@ void ObjectMgr::LoadVehicleSeatAddon() if (!sVehicleSeatStore.LookupEntry(seatID)) { - LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u does not exist in VehicleSeat.dbc. Skipping entry.", seatID); + LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: {} does not exist in VehicleSeat.dbc. Skipping entry.", seatID); continue; } // Sanitizing values if (orientation > float(M_PI * 2)) { - LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u is using invalid angle offset value (%f). Set Value to 0.", seatID, orientation); + LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: {} is using invalid angle offset value ({}). Set Value to 0.", seatID, orientation); orientation = 0.0f; } if (exitParam >= AsUnderlyingType(VehicleExitParameters::VehicleExitParamMax)) { - LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u is using invalid exit parameter value (%u). Setting to 0 (none).", seatID, exitParam); + LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: {} is using invalid exit parameter value ({}). Setting to 0 (none).", seatID, exitParam); continue; } @@ -3538,7 +3538,7 @@ void ObjectMgr::LoadVehicleSeatAddon() ++count; } while (result->NextRow()); - LOG_INFO("server.loading", ">> Loaded %u Vehicle Seat Addon entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server.loading", ">> Loaded {} Vehicle Seat Addon entries in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPetLevelInfo() diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 552b48d7e..8f8704da5 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -67,7 +67,7 @@ private: uint32 m_diff; }; -MapUpdater::MapUpdater(): pending_requests(0) +MapUpdater::MapUpdater() : pending_requests(0), _cancelationToken(false) { } @@ -84,10 +84,11 @@ void MapUpdater::deactivate() { _cancelationToken = true; - wait(); + wait(); // This is where we wait for tasks to complete - _queue.Cancel(); + _queue.Cancel(); // Cancel the queue to prevent further task processing + // Join all worker threads for (auto& thread : _workerThreads) { if (thread.joinable()) @@ -99,44 +100,45 @@ void MapUpdater::deactivate() void MapUpdater::wait() { - std::unique_lock guard(_lock); + std::unique_lock guard(_lock); // Guard lock for safe waiting - while (pending_requests > 0) - _condition.wait(guard); + // Wait until there are no pending requests + _condition.wait(guard, [this] { + return pending_requests.load(std::memory_order_acquire) == 0; + }); +} - guard.unlock(); +void MapUpdater::schedule_task(UpdateRequest* request) +{ + // Atomic increment for pending_requests + pending_requests.fetch_add(1, std::memory_order_release); + _queue.Push(request); } void MapUpdater::schedule_update(Map& map, uint32 diff, uint32 s_diff) { - std::lock_guard guard(_lock); - - ++pending_requests; - - _queue.Push(new MapUpdateRequest(map, *this, diff, s_diff)); + schedule_task(new MapUpdateRequest(map, *this, diff, s_diff)); } void MapUpdater::schedule_lfg_update(uint32 diff) { - std::lock_guard guard(_lock); - - ++pending_requests; - - _queue.Push(new LFGUpdateRequest(*this, diff)); + schedule_task(new LFGUpdateRequest(*this, diff)); } bool MapUpdater::activated() { - return _workerThreads.size() > 0; + return !_workerThreads.empty(); } void MapUpdater::update_finished() { - std::lock_guard lock(_lock); - - --pending_requests; - - _condition.notify_all(); + // Atomic decrement for pending_requests + if (pending_requests.fetch_sub(1, std::memory_order_acquire) == 1) + { + // Only notify when pending_requests becomes 0 (i.e., all tasks are finished) + std::lock_guard lock(_lock); // Lock only for condition variable notification + _condition.notify_all(); // Notify waiting threads that all requests are complete + } } void MapUpdater::WorkerThread() @@ -145,16 +147,16 @@ void MapUpdater::WorkerThread() CharacterDatabase.WarnAboutSyncQueries(true); WorldDatabase.WarnAboutSyncQueries(true); - while (1) + while (!_cancelationToken) { UpdateRequest* request = nullptr; - _queue.WaitAndPop(request); - if (_cancelationToken) - return; + _queue.WaitAndPop(request); // Wait for and pop a request from the queue - request->call(); - - delete request; + if (!_cancelationToken && request) + { + request->call(); // Execute the request + delete request; // Clean up after processing + } } } diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index e65cb0193..174cef977 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -22,6 +22,7 @@ #include "PCQueue.h" #include #include +#include class Map; class UpdateRequest; @@ -32,6 +33,7 @@ public: MapUpdater(); ~MapUpdater() = default; + void schedule_task(UpdateRequest* request); void schedule_update(Map& map, uint32 diff, uint32 s_diff); void schedule_lfg_update(uint32 diff); void wait(); @@ -42,15 +44,12 @@ public: private: void WorkerThread(); - ProducerConsumerQueue _queue; - + std::atomic pending_requests; // Use std::atomic for pending_requests to avoid lock contention + std::atomic _cancelationToken; // Atomic flag for cancellation to avoid race conditions std::vector _workerThreads; - std::atomic _cancelationToken; - - std::mutex _lock; + std::mutex _lock; // Mutex and condition variable for synchronization std::condition_variable _condition; - std::size_t pending_requests; }; #endif //_MAP_UPDATER_H_INCLUDED diff --git a/src/server/game/Motd/MotdMgr.cpp b/src/server/game/Motd/MotdMgr.cpp index eb16810bd..a63bce7b6 100644 --- a/src/server/game/Motd/MotdMgr.cpp +++ b/src/server/game/Motd/MotdMgr.cpp @@ -139,7 +139,7 @@ void MotdMgr::LoadLocalizedMotds(uint32 realmId) { if (!baseResult) { - LOG_ERROR("server.loading", "No base MOTD found for realm %u. Localized MOTDs will not be loaded.", realmId); + LOG_ERROR("server.loading", "No base MOTD found for realm {}. Localized MOTDs will not be loaded.", realmId); return; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 7a5005e5d..d11dc06d7 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1275,7 +1275,7 @@ public: if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid)) { - handler->SendErrorMessage("Selected creature can't link with guid '%u'", linkguid); + handler->SendErrorMessage("Selected creature can't link with guid '{}'", linkguid); return false; } diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp index d09e9e292..2874976ac 100644 --- a/src/server/scripts/Commands/cs_send.cpp +++ b/src/server/scripts/Commands/cs_send.cpp @@ -179,7 +179,7 @@ public: /// - Send the message // Use SendAreaTriggerMessage for fastest delivery. - player->GetSession()->SendAreaTriggerMessage("%s", msg.c_str()); + player->GetSession()->SendAreaTriggerMessage("{}", msg); player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); // Confirmation message diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 430ff20ee..7638efe9a 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -342,7 +342,7 @@ class spell_entropius_negative_energy_periodic : public AuraScript void PeriodicTick(AuraEffect const* aurEff) { PreventDefaultAction(); - uint32 targetCount = aurEff->GetTickNumber() > 12 ? 1 : aurEff->GetTickNumber() / 12; + uint32 targetCount = (aurEff->GetTickNumber() + 11) / 12; GetTarget()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targetCount); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 11cf383a0..d2b04f318 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -98,7 +98,7 @@ struct boss_akilzon : public BossAI }); ScheduleTimedEvent(20s, 30s, [&] { - if (scheduler.GetNextGroupOcurrence(GROUP_ELECTRICAL_STORM) > 5s) + if (scheduler.GetNextGroupOccurrence(GROUP_ELECTRICAL_STORM) > 5s) DoCastRandomTarget(SPELL_GUST_OF_WIND, 1); }, 20s, 30s); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 5f5f05a34..9c9b1514d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -135,7 +135,8 @@ enum Misc MAX_ADD_COUNT = 4, ADDITIONAL_CLASS_SPRIEST = 11, AURA_SHADOW_FORM = 15473, - GROUP_CLASS_ABILITY = 1 + GROUP_CLASS_ABILITY = 1, + GROUP_DRAIN_POWER = 2 }; enum AbilityTarget @@ -242,12 +243,15 @@ struct boss_hexlord_malacrass : public BossAI BossAI::Reset(); _currentClass = CLASS_NONE; _classAbilityTimer = 10000ms; + _timeUntilNextDrainPower = 0ms; SpawnAdds(); ScheduleHealthCheckEvent(80, [&] { - ScheduleTimedEvent(1s, [&] { + scheduler.Schedule(1s, GROUP_DRAIN_POWER, [this](TaskContext context) + { DoCastSelf(SPELL_DRAIN_POWER, true); Talk(SAY_DRAIN_POWER); - }, 30s); + context.Repeat(30s); + }); }); } @@ -282,6 +286,14 @@ struct boss_hexlord_malacrass : public BossAI ScheduleTimedEvent(30s, [&]{ scheduler.CancelGroup(GROUP_CLASS_ABILITY); DoCastSelf(SPELL_SPIRIT_BOLTS); + // Delay Drain Power if it's currently within 10s of being cast + // TODO: see what is wrong with GetNextGroupOccurrence as the timers don't seem correct on resets + _timeUntilNextDrainPower = scheduler.GetNextGroupOccurrence(GROUP_DRAIN_POWER); + if (_timeUntilNextDrainPower > 0s && _timeUntilNextDrainPower < 10s) + { + std::chrono::milliseconds delayTime = 10s - _timeUntilNextDrainPower + 1s; + scheduler.DelayGroup(GROUP_DRAIN_POWER, delayTime); + } scheduler.Schedule(10s, [this](TaskContext) { if (Creature* siphonTrigger = me->SummonCreature(NPC_TEMP_TRIGGER, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 30000)) @@ -354,6 +366,7 @@ struct boss_hexlord_malacrass : public BossAI private: uint8 _currentClass; std::chrono::milliseconds _classAbilityTimer; + std::chrono::milliseconds _timeUntilNextDrainPower; std::vector _creatureIndex; }; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 04b09dca0..b179c16d0 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -464,7 +464,7 @@ class spell_summon_all_players_dummy: public SpellScript Position pos = GetCaster()->GetPosition(); targets.remove_if([&, pos](WorldObject* target) -> bool { - return target->IsWithinBox(pos, 18.0f, 18.0f, 18.0f); + return target->IsWithinBox(pos, 22.0f, 28.0f, 28.0f); }); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 88cd3e738..ecc4ec01a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -682,22 +682,6 @@ private: SummonList _summons; }; -struct WorldTriggerHutPred -{ - bool operator()(Creature* trigger) const - { - return trigger->GetOrientation() > 2.7f || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f); - } -}; - -struct WorldTriggerDrumPred -{ - bool operator()(Creature* trigger) const - { - return !WorldTriggerHutPred()(trigger); - } -}; - enum AmanishiScout { NPC_WORLD_TRIGGER = 22515, @@ -708,6 +692,18 @@ enum AmanishiScout SPELL_SHOOT = 16496 }; +inline bool IsHut(Creature* trigger) +{ + return trigger->GetPositionX() < -90.0f // South of Jan'alai area + && ((trigger->GetOrientation() > 2.7f) || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f)); +} + +inline bool IsDrum(Creature* trigger) +{ + return trigger->GetPositionX() < -90.0f // South of Jan'alai area + && !IsHut(trigger); +} + struct npc_amanishi_scout : public ScriptedAI { npc_amanishi_scout(Creature* creature) : ScriptedAI(creature) { } @@ -725,7 +721,7 @@ struct npc_amanishi_scout : public ScriptedAI // Move to Drum std::list triggers; GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 50.0f); - triggers.remove_if(WorldTriggerHutPred()); + triggers.remove_if([](Creature* trigger) {return !IsDrum(trigger);}); triggers.sort(Acore::ObjectDistanceOrderPred(me)); if (!triggers.empty()) { @@ -826,7 +822,7 @@ class spell_summon_amanishi_sentries : public SpellScript { std::list triggers; GetCreatureListWithEntryInGrid(triggers, GetHitUnit(), NPC_WORLD_TRIGGER, 50.0f); - triggers.remove_if(WorldTriggerDrumPred()); + triggers.remove_if([](Creature* trigger) {return !IsHut(trigger);}); if (triggers.empty()) return; Creature* trigger = Acore::Containers::SelectRandomContainerElement(triggers); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 64a6de9a3..08a178be0 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -268,7 +268,7 @@ public: Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) if (Player* player = itr->GetSource()) - if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasInvisibilityAura() && !player->HasStealthAura() && !player->HasUnattackableAura()) + if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasInvisibilityAura() && !player->HasStealthAura() && !player->HasUnattackableAura() && !player->HasAura(5384)) return true; return false; }