diff --git a/data/sql/updates/db_world/2023_09_04_00.sql b/data/sql/updates/db_world/2023_09_04_00.sql new file mode 100644 index 000000000..1e8151a53 --- /dev/null +++ b/data/sql/updates/db_world/2023_09_04_00.sql @@ -0,0 +1,2 @@ +-- DB update 2023_08_30_00 -> 2023_09_04_00 +UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask`|1|2|8|16|32|64|256|512|1024|2048|4096|8192|65536|131072|524288|4194304|8388608|67108864|536870912 WHERE `entry` IN (22827, 22826, 22825, 20888, 22828, 22920); diff --git a/data/sql/updates/db_world/2023_09_04_01.sql b/data/sql/updates/db_world/2023_09_04_01.sql new file mode 100644 index 000000000..a169856a7 --- /dev/null +++ b/data/sql/updates/db_world/2023_09_04_01.sql @@ -0,0 +1,2 @@ +-- DB update 2023_09_04_00 -> 2023_09_04_01 +UPDATE `gameobject` SET `position_y` = -5124.500500, `position_z` = 87.242325 WHERE `guid` = 9329 and `id` = 2047; diff --git a/data/sql/updates/db_world/2023_09_04_02.sql b/data/sql/updates/db_world/2023_09_04_02.sql new file mode 100644 index 000000000..bc59c4d33 --- /dev/null +++ b/data/sql/updates/db_world/2023_09_04_02.sql @@ -0,0 +1,104 @@ +-- DB update 2023_09_04_01 -> 2023_09_04_02 +-- +DELETE FROM `creature_text` WHERE `CreatureID` = 14041; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(14041, 0, 0, 'Spare some change?', 12, 0, 100, 1, 0, 0, 9088, 0, 'Haggle - Random Say'), +(14041, 0, 1, 'I had it all! I had it all and then I lost it. Lost... all gone... like... my mind. My mind is like... cheese. I like cheese.', 12, 0, 100, 1, 0, 0, 9089, 0, 'Haggle - Random Say'), +(14041, 0, 2, 'Forty-two... forty-two... forty-two what? It could be anything! Forty-two... hmmm...', 12, 0, 100, 1, 0, 0, 9098, 0, 'Haggle - Random Say'), +(14041, 0, 3, 'Rat-kabobs! Get your tasty Rat-kabobs here! Get them while they last!', 12, 0, 100, 1, 0, 0, 9150, 0, 'Haggle - Random Say'), +(14041, 0, 4, 'Rats everywhere. Everywhere I see rats. Always looking at me with their beedy little eyes. I\'ll show them. I\'ll show them all!', 12, 0, 100, 1, 0, 0, 9149, 0, 'Haggle - Random Say'), +(14041, 1, 0, '%s yawns.', 16, 0, 100, 0, 0, 0, 9147, 0, 'Haggle - Emote 1'), +(14041, 2, 0, '%s sifts through the trash.', 16, 0, 100, 69, 0, 0, 9141, 0, 'Haggle - Emote 2'); + +DELETE FROM `creature` WHERE `guid` = 53788 AND `id1` = 14041; +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 +(53788, 14041, 0, 0, 369, 0, 0, 1, 1, 0, 38.99483, 24.375648, -4.2973485, 0.366166770458221435, 190, 0, 0, 484, 0, 0, 0, 0, 0, '', 45704); + +DELETE FROM `waypoints` WHERE `entry` = 1404100; +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `point_comment`) VALUES +(1404100, 1, 33.34522, 31.454027, -4.2973475, NULL, 0, 'Haggle'), +(1404100, 2, 26.45702, 34.893867, -4.2973475, NULL, 0, 'Haggle'), +(1404100, 3, 20.477, 34.7853, -4.297975, NULL, 0, 'Haggle'), +(1404100, 4, 17.328176, 31.855068, -4.288516, NULL, 0, 'Haggle'), +(1404100, 5, 17.432047, -19.700907, -4.2973523, NULL, 0, 'Haggle'), +(1404100, 6, 14.175989, -24.883198, -4.290597, NULL, 0, 'Haggle'), +(1404100, 7, 14.169546, -28.330238, -4.2973585, NULL, 0, 'Haggle'), +(1404100, 8, 11.564287, -30.887716, -4.2973533, NULL, 0, 'Haggle'), +(1404100, 9, -4.735959, -30.929426, -4.2978487, NULL, 0, 'Haggle'), +(1404100, 10, -7.366175, -25.010038, -4.297242, NULL, 0, 'Haggle'), +(1404100, 11, -19.336628, -17.376917, -4.2973704, NULL, 0, 'Haggle - start wander 1'), +(1404100, 12, -15.261998, -3.653864, -4.297435, NULL, 0, 'Haggle - resume waypoint'), +(1404100, 13, -17.923254, -1.263314, -4.2876077, NULL, 0, 'Haggle - into sleeping on bench'), +(1404100, 14, -16.773191, -1.117661, -4.287462, NULL, 0, 'Haggle'), +(1404100, 15, -14.93353, -15.882146, -4.2973704, NULL, 0, 'Haggle'), +(1404100, 16, -19.337181, -17.266024, -4.2973704, NULL, 0, 'Haggle - start wander 2'), +(1404100, 17, -22.05402, -9.908834, -4.296536, NULL, 0, 'Haggle'), +(1404100, 18, -21.497362, -9.651139, -4.296598, NULL, 0, 'Haggle - sifting through trash 1'), +(1404100, 19, -19.452112, -3.621434, -4.2970552, NULL, 0, 'Haggle - sifting through trash 2'), +(1404100, 20, -14.487922, 0.329824, -4.287024, NULL, 0, 'Haggle'), +(1404100, 21, -15.168751, 20.166489, -4.3063, NULL, 0, 'Haggle'), +(1404100, 22, -16.66379, 21.67101, -4.305281, NULL, 0, 'Haggle'), +(1404100, 23, -18.431108, 21.27326, -4.304296, NULL, 0, 'Haggle - sifting through trash 3'), +(1404100, 24, -15.260129, 26.659346, -4.299999, NULL, 0, 'Haggle'), +(1404100, 25, -16.375502, 26.893675, -4.299803, NULL, 0, 'Haggle - sifting through trash 4'), +(1404100, 26, -13.471532, -15.474365, -4.2973704, NULL, 0, 'Haggle - into sitting on ground'), +(1404100, 27, -19.333311, -17.326876, -4.2973704, NULL, 0, 'Haggle - start wander 3'), +(1404100, 28, -15.293428, -22.230337, -4.299684, NULL, 0, 'Haggle'), +(1404100, 29, -11.042005, -22.395052, -4.29911, NULL, 0, 'Haggle'), +(1404100, 30, -6.875696, -25.810347, -4.29732, NULL, 0, 'Haggle'), +(1404100, 31, -6.518164, -29.358128, -4.2977223, NULL, 0, 'Haggle'), +(1404100, 32, -4.615194, -32.011036, -4.2979712, NULL, 0, 'Haggle'), +(1404100, 33, 10.915832, -32.93334, -4.2973523, NULL, 0, 'Haggle'), +(1404100, 34, 14.343336, -28.164183, -4.2973585, NULL, 0, 'Haggle'), +(1404100, 35, 14.472878, -22.567085, -4.289472, NULL, 0, 'Haggle'), +(1404100, 36, 21.931023, -18.69022, -4.2973504, NULL, 0, 'Haggle'), +(1404100, 37, 22.149866, -17.656652, -4.2973504, NULL, 0, 'Haggle - sifting through trash 5'), +(1404100, 38, 30.895535, -16.94747, -4.297347, NULL, 0, 'Haggle'), +(1404100, 39, 38.974773, -11.690686, -4.297347, NULL, 0, 'Haggle - sifting through trash 6'), +(1404100, 40, 37.514492, -1.188888, -4.2973495, NULL, 0, 'Haggle'), +(1404100, 41, 38.968258, 0.839936, -4.29735, NULL, 0, 'Haggle - sifting through trash 7'), +(1404100, 42, 27.43926, 5.252612, -4.297351, NULL, 0, 'Haggle'), +(1404100, 43, 21.324173, 13.69732, -4.2973514, NULL, 0, 'Haggle'), +(1404100, 44, 21.230026, 14.574246, -4.297351, NULL, 0, 'Haggle - sifting through trash 8'), +(1404100, 45, 27.30816, 14.715199, -4.2973504, NULL, 0, 'Haggle'), +(1404100, 46, 32.701, 21.962217, -4.2973495, NULL, 0, 'Haggle - talking'), +(1404100, 47, 38.99483, 24.375648, -4.2973485, NULL, 0, 'Haggle - sifting through trash 9'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 14041; + +DELETE FROM `smart_scripts` WHERE `entryorguid` = 14041 AND `source_type` = 0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (1404100, 1404101, 1404102, 1404103, 1404104, 1404105) AND `source_type` = 9; +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 +(14041, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 53, 0, 1404100, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Respawn - Start waypoint'), +(14041, 0, 1, 0, 40, 0, 100, 0, 11, 0, 0, 0, 0, 0, 80, 1404100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP11 reached - Run Actionlist'), +(14041, 0, 2, 0, 40, 0, 100, 0, 13, 0, 0, 0, 0, 0, 80, 1404101, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP13 reached - Run Actionlist'), +(14041, 0, 3, 0, 40, 0, 100, 0, 16, 0, 0, 0, 0, 0, 80, 1404102, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP16 reached - Run Actionlist'), +(14041, 0, 4, 0, 40, 0, 100, 0, 18, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP18 reached - Run Actionlist'), +(14041, 0, 5, 0, 40, 0, 100, 0, 19, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP19 reached - Run Actionlist'), +(14041, 0, 6, 0, 40, 0, 100, 0, 23, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP23 reached - Run Actionlist'), +(14041, 0, 7, 0, 40, 0, 100, 0, 25, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP25 reached - Run Actionlist'), +(14041, 0, 8, 0, 40, 0, 100, 0, 26, 0, 0, 0, 0, 0, 80, 1404104, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP26 reached - Run Actionlist'), +(14041, 0, 9, 0, 40, 0, 100, 0, 27, 0, 0, 0, 0, 0, 80, 1404103, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP27 reached - Run Actionlist'), +(14041, 0, 10, 0, 40, 0, 100, 0, 37, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP37 reached - Run Actionlist'), +(14041, 0, 11, 0, 40, 0, 100, 0, 39, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP39 reached - Run Actionlist'), +(14041, 0, 12, 0, 40, 0, 100, 0, 41, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP41 reached - Run Actionlist'), +(14041, 0, 13, 0, 40, 0, 100, 0, 44, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP44 reached - Run Actionlist'), +(14041, 0, 14, 0, 40, 0, 100, 0, 47, 0, 0, 0, 0, 0, 80, 1404105, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On WP47 reached - Run Actionlist'), +(1404100, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 20000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 20 seconds'), +(1404100, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 89, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Random movement'), +(1404100, 9, 2, 0, 0, 0, 100, 0, 10000, 10000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Say random'), +(1404100, 9, 3, 0, 0, 0, 100, 0, 12000, 12000, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Say emote 1'), +(1404101, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 122000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 122 seconds'), +(1404101, 9, 1, 0, 0, 0, 100, 0, 500, 500, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 1.448623299598693847, 'Haggle - On On Script - Change orientation'), +(1404101, 9, 2, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 90, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On On Script - Set bytes1 - sleep'), +(1404101, 9, 3, 0, 0, 0, 100, 0, 121500, 121500, 0, 0, 0, 0, 91, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script- Remove bytes1 - sleep'), +(1404102, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 45000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 45 seconds'), +(1404102, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 89, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Random movement'), +(1404103, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 45000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 45 seconds'), +(1404103, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 0, 0, 89, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Random movement'), +(1404103, 9, 2, 0, 0, 0, 100, 0, 36000, 36000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Say random'), +(1404104, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 16000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 16 seconds'), +(1404104, 9, 1, 0, 0, 0, 100, 0, 500, 500, 0, 0, 0, 0, 90, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On On Script - Set bytes1 - sit'), +(1404104, 9, 2, 0, 0, 0, 100, 0, 15500, 15500, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script- Remove bytes1 - sit'), +(1404105, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 54, 3000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Pause Waypoint 3 seconds'), +(1404105, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Haggle - On Script - Say emote 2'); diff --git a/data/sql/updates/db_world/2023_09_05_00.sql b/data/sql/updates/db_world/2023_09_05_00.sql new file mode 100644 index 000000000..fc88ea075 --- /dev/null +++ b/data/sql/updates/db_world/2023_09_05_00.sql @@ -0,0 +1,7 @@ +-- DB update 2023_09_04_02 -> 2023_09_05_00 +-- +DELETE FROM `creature_template_addon` WHERE `entry` IN (34146, 34150, 34151); +INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES +(34146, 0, 0, 0, 0, 0, 0, '64615'), +(34150, 0, 0, 0, 0, 0, 0, '64615'), +(34151, 0, 0, 0, 0, 0, 0, '64615'); diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index 9836a6400..3aa74d667 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -944,9 +944,6 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP uint32 need_space; - if (pSrcItem && pSrcItem->IsNotEmptyBag() && !IsBagPos(uint16(bag) << 8 | slot)) - return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS; - // empty specific slot - check item fit to slot if (!pItem2 || swap) { diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 9e1405074..daa7d1b05 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3040,7 +3040,10 @@ void InstanceMap::RemovePlayerFromMap(Player* player, bool remove) //if (!m_unloadTimer && m_mapRefMgr.getSize() == 1) // m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); Map::RemovePlayerFromMap(player, remove); - player->SetPendingBind(0, 0); + + // If remove == true - player already deleted. + if (!remove) + player->SetPendingBind(0, 0); } void InstanceMap::AfterPlayerUnlinkFromMap() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 358678794..8456ac1d8 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -114,7 +114,7 @@ struct boss_moroes : public BossAI scheduler.Schedule(10s, GROUP_PRECOMBAT_TALK, [this](TaskContext context) { - if(Creature* guest = GetRandomGuest()) + if (Creature* guest = GetRandomGuest()) { guest->AI()->Talk(SAY_GUEST); } @@ -156,7 +156,6 @@ struct boss_moroes : public BossAI scheduler.Schedule(5s, 7s, [this](TaskContext) { me->SetImmuneToAll(false); - DoCastRandomTarget(SPELL_GARROTE, 0, 100.0f, true, true); DoCastSelf(SPELL_VANISH_TELEPORT); _vanished = false; }); @@ -178,7 +177,7 @@ struct boss_moroes : public BossAI void KilledUnit(Unit* victim) override { - if(!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER) + if (!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER) { Talk(SAY_KILL); _recentlySpoken = true; @@ -206,6 +205,7 @@ struct boss_moroes : public BossAI guestList.push_back(summon); } } + return Acore::Containers::SelectRandomContainerElement(guestList); } @@ -234,7 +234,7 @@ struct boss_moroes : public BossAI EnterEvadeMode(); summons.DoForAllSummons([](WorldObject* summon) { - summon->ToCreature()->AI()->EnterEvadeMode(); + summon->ToCreature()->DespawnOnEvade(5s); }); return; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index f44a93d7d..fcb698653 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -122,7 +122,7 @@ struct boss_nightbane : public BossAI MovePhase = 0; } - ScheduleHealthCheckEvent({25, 50, 70}, [&]{ + ScheduleHealthCheckEvent({ 75, 50, 25 }, [&]{ TakeOff(); }); } @@ -219,9 +219,7 @@ struct boss_nightbane : public BossAI void JustDied(Unit* /*killer*/) override { - if (instance) - instance->SetData(DATA_NIGHTBANE, DONE); - + _JustDied(); HandleTerraceDoors(true); } @@ -398,6 +396,7 @@ private: uint8 _skeletonCount; uint8 _skeletonSpawnCounter; }; + class go_blackened_urn : public GameObjectScript { public: @@ -405,13 +404,17 @@ public: //if we summon an entity instead of using a sort of invisible entity, we could unsummon boss on reset //right now that doesn't work because of how the urn works - bool OnGossipHello(Player* player, GameObject* go) override + bool OnGossipHello(Player* /*player*/, GameObject* go) override { - if (InstanceScript* pInstance = go->GetInstanceScript()) + if (InstanceScript* instance = go->GetInstanceScript()) { - if (pInstance->GetData(DATA_NIGHTBANE) != DONE && !go->FindNearestCreature(NPC_NIGHTBANE, 40.0f)) - if (Creature* cr = ObjectAccessor::GetCreature(*player, pInstance->GetGuidData(DATA_NIGHTBANE))) + if (instance->GetData(DATA_NIGHTBANE) != DONE && !go->FindNearestCreature(NPC_NIGHTBANE, 40.0f)) + { + if (Creature* cr = instance->GetCreature(DATA_NIGHTBANE)) + { cr->GetMotionMaster()->MovePoint(0, IntroWay[0][0], IntroWay[0][1], IntroWay[0][2]); + } + } } return false; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 50fab68d7..5b08d8399 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -305,7 +305,6 @@ struct boss_shade_of_aran : public BossAI if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) { unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); - unit->CastSpell(unit, 11027, true); FlameWreathTarget[i].Clear(); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 3f70f5790..f7c600a13 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -34,16 +34,17 @@ const Position OptionalSpawn[] = ObjectData const creatureData[] = { - { NPC_ATTUMEN_THE_HUNTSMAN, DATA_ATTUMEN }, - { NPC_MIDNIGHT, DATA_MIDNIGHT }, - { NPC_DOROTHEE, DATA_DOROTHEE }, - { NPC_TITO, DATA_TITO }, - { NPC_ROAR, DATA_ROAR }, - { NPC_STRAWMAN, DATA_STRAWMAN }, - { NPC_TINHEAD, DATA_TINHEAD }, - { NPC_ROMULO, DATA_ROMULO }, - { NPC_JULIANNE, DATA_JULIANNE }, - { 0, 0 } + { NPC_ATTUMEN_THE_HUNTSMAN, DATA_ATTUMEN }, + { NPC_MIDNIGHT, DATA_MIDNIGHT }, + { NPC_DOROTHEE, DATA_DOROTHEE }, + { NPC_TITO, DATA_TITO }, + { NPC_ROAR, DATA_ROAR }, + { NPC_STRAWMAN, DATA_STRAWMAN }, + { NPC_TINHEAD, DATA_TINHEAD }, + { NPC_ROMULO, DATA_ROMULO }, + { NPC_JULIANNE, DATA_JULIANNE }, + { NPC_NIGHTBANE, DATA_NIGHTBANE }, + { 0, 0 } }; class instance_karazhan : public InstanceMapScript diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp index 8f28db2a4..6c63243a4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp @@ -24,30 +24,49 @@ #include "SpellAuraEffects.h" #include "SpellScript.h" #include "Vehicle.h" +#include "TaskScheduler.h" enum Texts { // Freya - GOSSIP_MENU_FREYA = 10324, - NPC_TEXT_FREYA = 14332, + GOSSIP_MENU_FREYA = 10324, + NPC_TEXT_FREYA = 14332, // Hodir - GOSSIP_MENU_HODIR = 10335, - NPC_TEXT_HODIR = 14326, + GOSSIP_MENU_HODIR = 10335, + NPC_TEXT_HODIR = 14326, // Mimiron - GOSSIP_MENU_MIMIRON = 10336, - NPC_TEXT_MIMIRON = 14334, + GOSSIP_MENU_MIMIRON = 10336, + NPC_TEXT_MIMIRON = 14334, // Thorim - GOSSIP_MENU_THORIM = 10337, - NPC_TEXT_THORIM = 14333, + GOSSIP_MENU_THORIM = 10337, + NPC_TEXT_THORIM = 14333, // Confirm assistance - GOSSIP_MENU_CONFIRM = 10333, - NPC_TEXT_CONFIRM = 14325, + GOSSIP_MENU_CONFIRM = 10333, + NPC_TEXT_CONFIRM = 14325, - SAY_KEEPER_SELECTED = 1, + SAY_KEEPER_SELECTED = 1, +}; + +enum UldNPCs +{ + NPC_WINTER_JORMUNGAR = 34137, + NPC_SNOW_MOUND_4 = 34146, + NPC_SNOW_MOUND_6 = 34150, + NPC_SNOW_MOUND_8 = 34151 +}; + +enum UldGameObjects +{ + GOBJ_SNOW_MOUND = 194907 +}; + +enum UldSpells +{ + SPELL_SNOW_MOUND_PARTICLES = 64615 }; class npc_ulduar_keeper : public CreatureScript @@ -157,52 +176,72 @@ public: } }; -class npc_ulduar_snow_mound : public CreatureScript +struct npc_ulduar_snow_mound : public ScriptedAI { -public: - npc_ulduar_snow_mound() : CreatureScript("npc_ulduar_snow_mound") { } - - CreatureAI* GetAI(Creature* creature) const override + npc_ulduar_snow_mound(Creature* creature) : ScriptedAI(creature) { - return GetUlduarAI(creature); + _activated = false; + _count = 0; + _counter = 0; } - struct npc_ulduar_snow_moundAI : public ScriptedAI + void MoveInLineOfSight(Unit* who) override { - npc_ulduar_snow_moundAI(Creature* creature) : ScriptedAI(creature) + if (!_activated && who->GetTypeId() == TYPEID_PLAYER) { - activated = false; - me->CastSpell(me, 64615, true); - } - - bool activated; - - void MoveInLineOfSight(Unit* who) override - { - if (!activated && who->GetTypeId() == TYPEID_PLAYER) - if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f, - who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing)) + if (me->GetExactDist2d(who) <= 10.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f, + who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing)) + { + _activated = true; + me->RemoveAura(SPELL_SNOW_MOUND_PARTICLES); + if (GameObject* go = me->FindNearestGameObject(GOBJ_SNOW_MOUND, 5.0f)) { - activated = true; - me->RemoveAura(64615); - if (GameObject* go = me->FindNearestGameObject(194907, 5.0f)) - go->Delete(); - uint8 count; - if (me->GetEntry() == 34146) count = 4; - else if (me->GetEntry() == 34150) count = 6; - else count = 8; - for (uint8 i = 0; i < count; ++i) - { - float a = rand_norm() * 2 * M_PI; - float d = rand_norm() * 4.0f; - if (Creature* c = me->SummonCreature(34137, me->GetPositionX() + cos(a) * d, me->GetPositionY() + std::sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000)) - c->AI()->AttackStart(who); - } + go->Delete(); } - } - void UpdateAI(uint32 /*diff*/) override {} - }; + switch (me->GetEntry()) + { + case NPC_SNOW_MOUND_4: + _count = 4; + break; + case NPC_SNOW_MOUND_6: + _count = 6; + break; + case NPC_SNOW_MOUND_8: + _count = 8; + break; + default: + return; + } + + _scheduler.Schedule(0s, [this](TaskContext context) + { + _counter++; + float a = rand_norm() * 2 * M_PI; //needs verification from sniffs + float d = rand_norm() * 4.0f; + if (Creature* jormungar = me->SummonCreature(NPC_WINTER_JORMUNGAR, me->GetPositionX() + cos(a) * d, me->GetPositionY() + std::sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000)) + { + jormungar->SetInCombatWithZone(); + } + if (_counter < _count) + { + context.Repeat(2s); + } + }); + } + } + } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } + +private: + bool _activated; + TaskScheduler _scheduler; + uint8 _count; + uint8 _counter; }; class npc_ulduar_storm_tempered_keeper : public CreatureScript @@ -512,13 +551,11 @@ struct npc_salvaged_siege_engine : public VehicleAI void AddSC_ulduar() { new npc_ulduar_keeper(); - new spell_ulduar_energy_sap(); - new npc_ulduar_snow_mound(); + RegisterUlduarCreatureAI(npc_ulduar_snow_mound); new npc_ulduar_storm_tempered_keeper(); new npc_ulduar_arachnopod_destroyer(); new spell_ulduar_arachnopod_damaged(); - new AreaTrigger_at_celestial_planetarium_enterance(); new go_call_tram(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 186bcde78..ac91d1488 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -302,4 +302,6 @@ inline AI* GetUlduarAI(T* obj) return GetInstanceAI(obj, UlduarScriptName); } +#define RegisterUlduarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetUlduarAI) + #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 132af1a6c..f301dbfcc 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -102,12 +102,16 @@ struct boss_magtheridon : public BossAI BossAI::Reset(); _channelersKilled = 0; _currentPhase = 0; + _castingQuake = false; _recentlySpoken = false; _magReleased = false; _interruptScheduler.CancelAll(); scheduler.Schedule(90s, [this](TaskContext context) { - Talk(SAY_TAUNT); + if (!me->IsEngaged()) + { + Talk(SAY_TAUNT); + } context.Repeat(90s); }); DoCastSelf(SPELL_SHADOW_CAGE, true); @@ -166,6 +170,7 @@ struct boss_magtheridon : public BossAI void ScheduleCombatEvents() { + me->GetThreatMgr().ClearAllThreat(); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); @@ -182,9 +187,18 @@ struct boss_magtheridon : public BossAI context.Repeat(11s, 39s); }).Schedule(40s, [this](TaskContext context) { - DoCastSelf(SPELL_QUAKE); //needs fixes with custom spell + DoCastSelf(SPELL_QUAKE); + _castingQuake = true; + me->GetMotionMaster()->Clear(); + me->SetReactState(REACT_PASSIVE); + me->SetOrientation(me->GetAngle(me->GetVictim())); + me->SetTarget(ObjectGuid::Empty); + scheduler.DelayAll(6999ms); scheduler.Schedule(7s, [this](TaskContext /*context*/) { + _castingQuake = false; + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); DoCastSelf(SPELL_BLAST_NOVA); _interruptScheduler.Schedule(50ms, GROUP_INTERRUPT_CHECK, [this](TaskContext context) @@ -234,6 +248,10 @@ struct boss_magtheridon : public BossAI BossAI::JustEngagedWith(who); Talk(SAY_EMOTE_BEGIN); + instance->DoForAllMinions(TYPE_MAGTHERIDON, [&](Creature* creature) { + creature->SetInCombatWithZone(); + }); + scheduler.Schedule(60s, GROUP_EARLY_RELEASE_CHECK, [this](TaskContext /*context*/) { Talk(SAY_EMOTE_NEARLY); @@ -256,13 +274,14 @@ struct boss_magtheridon : public BossAI scheduler.Update(diff); _interruptScheduler.Update(diff); - if (_currentPhase != 1) + if (_currentPhase != 1 && !_castingQuake) { DoMeleeAttackIfReady(); } } private: + bool _castingQuake; bool _recentlySpoken; bool _magReleased; uint8 _currentPhase;