Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-08-26 22:29:54 +08:00
358 changed files with 1165 additions and 1381 deletions
+18 -7
View File
@@ -3,16 +3,27 @@ if ! command -v lsb_release &>/dev/null ; then
fi fi
DEBIAN_VERSION=$(lsb_release -sr) DEBIAN_VERSION=$(lsb_release -sr)
DEBIAN_VERSION_MIN="12"
if [[ $DEBIAN_VERSION -lt $DEBIAN_VERSION_MIN ]]; then
echo "########## ########## ##########"
echo ""
echo " using unsupported Debian version" $DEBIAN_VERSION
echo " please update to Debian" $DEBIAN_VERSION_MIN "or later"
echo ""
echo "########## ########## ##########"
fi
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y gdbserver gdb unzip curl \ sudo apt-get install -y gdbserver gdb unzip curl \
libncurses-dev libreadline-dev clang g++ \ libncurses-dev libreadline-dev clang g++ \
gcc git cmake make ccache gcc git cmake make ccache \
default-libmysqlclient-dev libssl-dev libbz2-dev \
libboost-all-dev gnupg wget
if [[ $DEBIAN_VERSION -eq "10" ]]; then # run noninteractive install for MYSQL 8.4 LTS
sudo apt-get install -y default-libmysqlclient-dev libssl-dev libreadline-dev libncurses-dev mariadb-server wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
libboost-system1.6*-dev libboost-filesystem1.6*-dev libboost-program-options1.6*-dev libboost-iostreams1.6*-dev \ sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_0.8.32-1_all.deb
else # Debian 8 and 9 should work using this sudo apt-get update
sudo apt-get install -y libmysqlclient-dev libssl1.0-dev mysql-server sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server
fi
@@ -0,0 +1,7 @@
-- DB update 2024_08_19_00 -> 2024_08_19_01
-- Fix spells timers for Hemathion (18692)
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 18692) AND (`source_type` = 0) AND (`id` IN (0, 1, 2));
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
(18692, 0, 0, 0, 0, 0, 100, 0, 5000, 15000, 5000, 35000, 0, 0, 11, 9573, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Hemathion - In Combat - Cast Flame Breath'),
(18692, 0, 1, 0, 0, 0, 100, 0, 5000, 15000, 40000, 60000, 0, 0, 11, 14100, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Hemathion - In Combat - Cast Terrifying Roar'),
(18692, 0, 2, 0, 12, 0, 100, 1, 0, 20, 0, 0, 0, 0, 11, 38895, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Hemathion - Between 0-20% Health - Cast Devour (No Repeat)');
@@ -0,0 +1,2 @@
-- DB update 2024_08_19_01 -> 2024_08_19_02
UPDATE `creature_template` SET `minlevel` = 68, `maxlevel` = 80, `exp` = 0, `DamageModifier` = 1, `unit_class` = 2 WHERE `entry` = 15438;
@@ -0,0 +1,3 @@
-- DB update 2024_08_19_02 -> 2024_08_20_00
--
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_mother_shahraz_fatal_attraction_aura';
+107
View File
@@ -0,0 +1,107 @@
-- DB update 2024_08_20_00 -> 2024_08_21_00
-- .
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=1428;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 1, 1428, 0, 0, 29, 0, 1433, 100, 0, 1, 0, 0, "", "Execute Rema Schneider's SAI only if Corbett Schneider is not nearby");
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry` IN (1428, 1433);
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (1428, 1433, 143300, 143301, 143302);
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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(1428, 0, 0, 0, 20, 0, 100, 0, 333, 0, 0, 0, 12, 1433, 8, 0, 0, 0, 0, 8, 0, 0, 0, -8773.6504, 717.4009, 99.5340, 3.8705, "Rema Schneider - On Quest Turn-in - Summon Corbett Schneider"),
(1433, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 80, 143300, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Spawn - Run Actionlist"),
(1433, 0, 1, 0, 40, 0, 100, 0, 4, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 4 Reached - Talk 1"),
(1433, 0, 2, 0, 40, 0, 100, 0, 31, 0, 0, 0, 80, 143301, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 31 Reached - Run Actionlist"),
(1433, 0, 3, 0, 40, 0, 100, 0, 34, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 34 Reached - Talk 4"),
(1433, 0, 4, 0, 40, 0, 100, 0, 41, 0, 0, 0, 80, 143302, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 41 Reached - Run Actionlist"),
(1433, 0, 5, 0, 40, 0, 100, 0, 44, 0, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 44 Reached - Talk 8"),
(1433, 0, 6, 0, 40, 0, 100, 0, 64, 0, 0, 0, 1, 9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 64 Reached - Talk 9"),
(1433, 0, 7, 0, 40, 0, 100, 0, 70, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On WP 70 Reached - Despawn"),
(143300, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 1428, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 0 (Rema Schneider)"),
(143300, 9, 1, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 0"),
(143300, 9, 2, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 53, 0, 1433, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Start Waypoint"),
(143301, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 54, 16000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Pause WP for 15 seconds"),
(143301, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 2"),
(143301, 9, 2, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 1427, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 0 (Harlan Bagley)"),
(143301, 9, 3, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 3"),
(143302, 9, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 54, 21000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Pause WP for 15 seconds"),
(143302, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 1, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 5"),
(143302, 9, 2, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 19, 483, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 0 (Elaine Trias)"),
(143302, 9, 3, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 6, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 6"),
(143302, 9, 4, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 1, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Corbett Schneider - On Script - Talk 7");
DELETE FROM `waypoints` WHERE `entry`=1433;
INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES
(1433, 1, -8766.4648, 716.7565, 99.5340, "Corbett Schneider"),
(1433, 2, -8756.1455, 726.3924, 98.1680, "Corbett Schneider"),
(1433, 3, -8736.9951, 700.4968, 98.6993, "Corbett Schneider"),
(1433, 4, -8752.06, 687.8629, 100.4303, "Corbett Schneider"),
(1433, 5, -8762.08, 680.5356, 101.7102, "Corbett Schneider"),
(1433, 6, -8772.759, 671.8912, 103.0923, "Corbett Schneider"),
(1433, 7, -8772.768, 667.782, 103.4332, "Corbett Schneider"),
(1433, 8, -8773.276, 664.1729, 103.2741, "Corbett Schneider"),
(1433, 9, -8768.034, 657.9344, 103.6037, "Corbett Schneider"),
(1433, 10, -8761.147, 647.2188, 103.86, "Corbett Schneider"),
(1433, 11, -8759.447, 638.8893, 103.3162, "Corbett Schneider"),
(1433, 12, -8758.039, 628.078, 102.0694, "Corbett Schneider"),
(1433, 13, -8761.208, 620.6109, 99.95255, "Corbett Schneider"),
(1433, 14, -8767.146, 612.2792, 97.46174, "Corbett Schneider"),
(1433, 15, -8777.32, 603.8011, 97.09476, "Corbett Schneider"),
(1433, 16, -8793.533, 591.5438, 97.66048, "Corbett Schneider"),
(1433, 17, -8798.256, 589.9958, 97.36029, "Corbett Schneider"),
(1433, 18, -8803.463, 592.6121, 97.25187, "Corbett Schneider"),
(1433, 19, -8808.244, 598.1001, 96.85836, "Corbett Schneider"),
(1433, 20, -8813.239, 605.8572, 96.07804, "Corbett Schneider"),
(1433, 21, -8819.136, 613.8248, 95.15321, "Corbett Schneider"),
(1433, 22, -8821.637, 620.8274, 94.33056, "Corbett Schneider"),
(1433, 23, -8820.776, 625.7927, 93.82214, "Corbett Schneider"),
(1433, 24, -8816.414, 628.6717, 94.11055, "Corbett Schneider"),
(1433, 25, -8809.802, 631.7798, 94.22869, "Corbett Schneider"),
(1433, 26, -8801.114, 634.4752, 94.22869, "Corbett Schneider"),
(1433, 27, -8793.909, 634.5373, 94.32002, "Corbett Schneider"),
(1433, 28, -8788.455, 635.6047, 94.8966, "Corbett Schneider"),
(1433, 29, -8783.56, 636.822, 97.24657, "Corbett Schneider"),
(1433, 30, -8781.598, 636.8708, 97.22314, "Corbett Schneider"),
(1433, 31, -8781.735, 638.8378, 97.22314, "Corbett Schneider"),
(1433, 32, -8781.778, 636.7758, 97.22314, "Corbett Schneider"),
(1433, 33, -8795.15, 634.1953, 94.28103, "Corbett Schneider"),
(1433, 34, -8801.708, 633.1341, 94.22869, "Corbett Schneider"),
(1433, 35, -8817.858, 626.8513, 93.98212, "Corbett Schneider"),
(1433, 36, -8828.889, 622.524, 93.88631, "Corbett Schneider"),
(1433, 37, -8840.156, 612.7209, 92.8798, "Corbett Schneider"),
(1433, 38, -8847.144, 604.3766, 92.36099, "Corbett Schneider"),
(1433, 39, -8852.638, 595.577, 92.37487, "Corbett Schneider"),
(1433, 40, -8863.147, 582.9686, 93.46239, "Corbett Schneider"),
(1433, 41, -8848.96, 570.478, 96.0, "Corbett Schneider"),
(1433, 42, -8859.677, 580.5781, 94.49109, "Corbett Schneider"),
(1433, 43, -8862.987, 584.5252, 93.1463, "Corbett Schneider"),
(1433, 44, -8840.954, 607.2128, 93.16522, "Corbett Schneider"),
(1433, 45, -8837.177, 617.1418, 93.02146, "Corbett Schneider"),
(1433, 46, -8839.63, 632.0125, 94.44655, "Corbett Schneider"),
(1433, 47, -8845.286, 644.3653, 96.2437, "Corbett Schneider"),
(1433, 48, -8849.153, 651.5832, 96.53387, "Corbett Schneider"),
(1433, 49, -8851.61, 661.0834, 97.05186, "Corbett Schneider"),
(1433, 50, -8845.611, 665.9679, 97.63871, "Corbett Schneider"),
(1433, 51, -8837.404, 671.1436, 98.19347, "Corbett Schneider"),
(1433, 52, -8825.113, 679.1154, 97.53572, "Corbett Schneider"),
(1433, 53, -8830.587, 690.738, 97.36238, "Corbett Schneider"),
(1433, 54, -8841.896, 715.2056, 97.55064, "Corbett Schneider"),
(1433, 55, -8842.827, 723.2777, 97.29913, "Corbett Schneider"),
(1433, 56, -8834.735, 728.9673, 97.85699, "Corbett Schneider"),
(1433, 57, -8819.055, 738.2991, 97.92567, "Corbett Schneider"),
(1433, 58, -8803.791, 745.3076, 97.57478, "Corbett Schneider"),
(1433, 59, -8787.081, 745.6882, 98.51132, "Corbett Schneider"),
(1433, 60, -8773.176, 740.5723, 99.45663, "Corbett Schneider"),
(1433, 61, -8764.434, 735.3757, 98.88588, "Corbett Schneider"),
(1433, 62, -8758.341, 726.0469, 98.21922, "Corbett Schneider"),
(1433, 63, -8762.695, 720.631, 99.53365, "Corbett Schneider"),
(1433, 64, -8767.639, 715.3578, 99.53385, "Corbett Schneider"),
(1433, 65, -8773.21, 714.8073, 99.53385, "Corbett Schneider"),
(1433, 66, -8777.759, 715.541, 99.52771, "Corbett Schneider"),
(1433, 67, -8780.018, 717.4185, 99.53414, "Corbett Schneider"),
(1433, 68, -8776.452, 719.8099, 101.5017, "Corbett Schneider"),
(1433, 69, -8773.681, 722.051, 104.1553, "Corbett Schneider"),
(1433, 70, -8771.129, 724.3008, 105.9132, "Corbett Schneider");
@@ -0,0 +1,3 @@
-- DB update 2024_08_21_00 -> 2024_08_22_00
--
DELETE FROM `event_scripts` WHERE `id` = 14797;
@@ -0,0 +1,6 @@
-- DB update 2024_08_22_00 -> 2024_08_22_01
-- Set RequiredNpcOrGo1 of quest 6661 Deeprun Rat Roundup to 13017
UPDATE `quest_template` SET `RequiredNpcOrGo1`=13017 WHERE `ID`=6661;
-- Set quest credit to unit 13017 in 'Deeprun Rat - On Spellhit - Quest Credit'
UPDATE `smart_scripts` SET `action_param1`=13017 WHERE `entryorguid`=13016 AND `source_type`=0 AND `id`=2 AND `link`=3;
@@ -0,0 +1,13 @@
-- DB update 2024_08_22_01 -> 2024_08_25_00
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=23569;
DELETE FROM `smart_scripts` WHERE `entryorguid`=23569 AND `source_type`=0;
DELETE FROM `smart_scripts` WHERE `entryorguid`=2356900 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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(23569,0,0,1,62,0,100,0,8837,0,0,0,134,42670,0,0,0,0,0,7,0,0,0,0,0,0,0,'Renn McGill - On Gossip Option 0 Selected - Invoker Cast \'Replace Repaired Diving Gear\''),
(23569,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Renn McGill - On Gossip Option 0 Selected - Close Gossip'),
(23569,0,2,0,20,0,100,0,11140,0,0,0,80,2356900,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Quest \'Recover the Cargo!\' Finished - Run Script'),
(2356900,9,0,0,0,0,100,0,0,0,0,0,83,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Remove Npc Flag Questgiver+Gossip'),
(2356900,9,1,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 0'),
(2356900,9,2,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 1'),
(2356900,9,3,0,0,0,100,0,5000,5000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 2'),
(2356900,9,4,0,0,0,100,0,6000,6000,0,0,82,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Add Npc Flag Questgiver+Gossip');
@@ -0,0 +1,9 @@
-- DB update 2024_08_25_00 -> 2024_08_26_00
-- Fix the target_type for Chain lightning and Psychic Scream spells with Twilight Prophet
SET @ENTRY := 15308;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0) AND (`entryorguid` = @ENTRY);
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
(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 4000, 4500, 12000, 15000, 0, 0, 11, 15305, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - In Combat - Cast Chain Lightning'),
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 8000, 9000, 25000, 28000, 0, 0, 11, 22884, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - In Combat - Cast Psychic Scream'),
(@ENTRY, 0, 2, 0, 106, 0, 100, 0, 16000, 19000, 16000, 19000, 0, 8, 11, 17366, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - Within 0-8 Range - Cast Fire Nova'),
(@ENTRY, 0, 3, 0, 106, 0, 100, 0, 16000, 19000, 16000, 19000, 0, 8, 11, 15531, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - Within 0-8 Range - Cast Frost Nova');
@@ -0,0 +1,5 @@
-- DB update 2024_08_26_00 -> 2024_08_26_01
--
DELETE FROM `spell_script_names` WHERE `spell_id` = 41360;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(41360, 'spell_black_temple_l5_arcane_charge');
-1
View File
@@ -24,4 +24,3 @@ if (BUILD_APPLICATION_WORLDSERVER)
add_subdirectory(game) add_subdirectory(game)
add_subdirectory(scripts) add_subdirectory(scripts)
endif() endif()
@@ -28,4 +28,3 @@ int32 NullGameObjectAI::Permissible(GameObject const* /*go*/)
{ {
return PERMIT_BASE_IDLE; return PERMIT_BASE_IDLE;
} }
+5 -5
View File
@@ -33,7 +33,7 @@ int32 PetAI::Permissible(Creature const* creature)
{ {
if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
{ {
if (reinterpret_cast<Guardian const*>(creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER) if (reinterpret_cast<Guardian const*>(creature)->GetOwner()->IsPlayer())
return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_PROACTIVE;
return PERMIT_BASE_REACTIVE; return PERMIT_BASE_REACTIVE;
} }
@@ -210,7 +210,7 @@ void PetAI::UpdateAI(uint32 diff)
// Autocast (casted only in combat or persistent spells in any state) // Autocast (casted only in combat or persistent spells in any state)
if (!me->HasUnitState(UNIT_STATE_CASTING)) if (!me->HasUnitState(UNIT_STATE_CASTING))
{ {
if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget()) if (owner && owner->IsPlayer() && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
{ {
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), std::abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget()); owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), std::abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
@@ -332,10 +332,10 @@ void PetAI::UpdateAI(uint32 diff)
if (!me->HasInArc(M_PI, target)) if (!me->HasInArc(M_PI, target))
{ {
me->SetInFront(target); me->SetInFront(target);
if (target && target->GetTypeId() == TYPEID_PLAYER) if (target && target->IsPlayer())
me->SendUpdateToPlayer(target->ToPlayer()); me->SendUpdateToPlayer(target->ToPlayer());
if (owner && owner->GetTypeId() == TYPEID_PLAYER) if (owner && owner->IsPlayer())
me->SendUpdateToPlayer(owner->ToPlayer()); me->SendUpdateToPlayer(owner->ToPlayer());
} }
@@ -359,7 +359,7 @@ void PetAI::UpdateAllies()
if (!owner) if (!owner)
return; return;
else if (owner->GetTypeId() == TYPEID_PLAYER) else if (owner->IsPlayer())
group = owner->ToPlayer()->GetGroup(); group = owner->ToPlayer()->GetGroup();
//only pet and owner/not in group->ok //only pet and owner/not in group->ok
+1 -1
View File
@@ -129,7 +129,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
void TotemAI::AttackStart(Unit* /*victim*/) void TotemAI::AttackStart(Unit* /*victim*/)
{ {
// Sentry totem sends ping on attack // Sentry totem sends ping on attack
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER) if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->IsPlayer())
{ {
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4)); WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
data << me->GetGUID(); data << me->GetGUID();
+2 -2
View File
@@ -140,7 +140,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
{ {
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
{ {
me->AddAura(spellid, unit); me->AddAura(spellid, unit);
return SPELL_CAST_OK; return SPELL_CAST_OK;
@@ -163,7 +163,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
{ {
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
return me->CastSpell(unit, spellid, triggered); return me->CastSpell(unit, spellid, triggered);
} }
else else
@@ -668,7 +668,7 @@ void BossAI::TeleportCheaters()
ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target)) if (target->IsPlayer() && !IsInBoundary(target))
target->NearTeleportTo(x, y, z, 0); target->NearTeleportTo(x, y, z, 0);
} }
@@ -334,6 +334,7 @@ struct ScriptedAI : public CreatureAI
//Teleports a player without dropping threat (only teleports to same map) //Teleports a player without dropping threat (only teleports to same map)
void DoTeleportPlayer(Unit* unit, float x, float y, float z, float o); void DoTeleportPlayer(Unit* unit, float x, float y, float z, float o);
void DoTeleportPlayer(Unit* unit, Position pos) { DoTeleportPlayer(unit, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); };
void DoTeleportAll(float x, float y, float z, float o); void DoTeleportAll(float x, float y, float z, float o);
//Returns friendly unit with the most amount of hp missing from max hp //Returns friendly unit with the most amount of hp missing from max hp
+1 -1
View File
@@ -202,7 +202,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
mCanRepeatPath = repeat; mCanRepeatPath = repeat;
SetRun(run); SetRun(run);
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER) if (invoker && invoker->IsPlayer())
{ {
mEscortNPCFlags = me->GetNpcFlags(); mEscortNPCFlags = me->GetNpcFlags();
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
@@ -5220,12 +5220,12 @@ WorldObject* SmartScript::GetLastInvoker(WorldObject* invoker) const
bool SmartScript::IsUnit(WorldObject* obj) bool SmartScript::IsUnit(WorldObject* obj)
{ {
return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER); return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->IsPlayer());
} }
bool SmartScript::IsPlayer(WorldObject* obj) bool SmartScript::IsPlayer(WorldObject* obj)
{ {
return obj && obj->GetTypeId() == TYPEID_PLAYER; return obj && obj->IsPlayer();
} }
bool SmartScript::IsCreature(WorldObject* obj) bool SmartScript::IsCreature(WorldObject* obj)
@@ -720,9 +720,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
TeamId killerTeam = killer->GetTeamId(); TeamId killerTeam = killer->GetTeamId();
// xinef: tower cannons also grant rank // xinef: tower cannons also grant rank
if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) if (victim->IsPlayer() || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON)
{ {
if (victim->GetTypeId() == TYPEID_PLAYER && victim->HasAura(SPELL_LIEUTENANT)) if (victim->IsPlayer() && victim->HasAura(SPELL_LIEUTENANT))
{ {
// Quest - Wintergrasp - PvP Kill - Horde/Alliance // Quest - Wintergrasp - PvP Kill - Horde/Alliance
for (auto& playerGuid : m_PlayersInWar[killerTeam]) for (auto& playerGuid : m_PlayersInWar[killerTeam])
@@ -749,7 +749,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
} }
// Xinef: Allow to Skin non-released corpse // Xinef: Allow to Skin non-released corpse
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
{ {
victim->SetUnitFlag(UNIT_FLAG_SKINNABLE); victim->SetUnitFlag(UNIT_FLAG_SKINNABLE);
} }
+22 -85
View File
@@ -438,13 +438,19 @@ inline void Battleground::_ProcessProgress(uint32 diff)
if (newtime > (MINUTE * IN_MILLISECONDS)) if (newtime > (MINUTE * IN_MILLISECONDS))
{ {
if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)) if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, nullptr, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))); GetBgMap()->DoForAllPlayers([&](Player* player)
{
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
});
} }
else else
{ {
//announce every 15 seconds //announce every 15 seconds
if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS)) if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, nullptr, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS)); GetBgMap()->DoForAllPlayers([&](Player* player)
{
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
});
} }
m_PrematureCountDownTimer = newtime; m_PrematureCountDownTimer = newtime;
} }
@@ -917,46 +923,34 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId)
} }
if (IsEventActive(EVENT_SPIRIT_OF_COMPETITION) && isBattleground()) if (IsEventActive(EVENT_SPIRIT_OF_COMPETITION) && isBattleground())
SpiritofCompetitionEvent(winnerTeamId); SpiritOfCompetitionEvent(winnerTeamId);
sScriptMgr->OnBattlegroundEnd(this, GetTeamId(winnerTeamId)); sScriptMgr->OnBattlegroundEnd(this, GetTeamId(winnerTeamId));
} }
bool Battleground::SpiritofCompetitionEvent(PvPTeamId winnerTeamId) void Battleground::SpiritOfCompetitionEvent(PvPTeamId winnerTeamId) const
{ {
// Everyone is eligible for tabard reward bool isDraw = winnerTeamId == PVP_TEAM_NEUTRAL;
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
Player* player = itr->second;
bool questStatus = player->GetQuestStatus(QUEST_FLAG_PARTICIPANT) != QUEST_STATUS_REWARDED;
if (player && questStatus)
player->CastSpell(player, SPELL_SPIRIT_OF_COMPETITION_PARTICIPANT, true);
}
// In case of a draw nobody get rewarded
if (winnerTeamId == PVP_TEAM_NEUTRAL)
return false;
std::vector<Player*> filteredPlayers; std::vector<Player*> filteredPlayers;
GetBgMap()->DoForAllPlayers([&](Player* player)
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{ {
Player* player = itr->second; // Reward all eligible players the participant reward
bool playerTeam = player->GetBgTeamId() == GetTeamId(winnerTeamId); if (player->GetQuestStatus(QUEST_FLAG_PARTICIPANT) != QUEST_STATUS_REWARDED)
bool questStatus = player->GetQuestStatus(QUEST_FLAG_WINNER) != QUEST_STATUS_REWARDED; player->CastSpell(player, SPELL_SPIRIT_OF_COMPETITION_PARTICIPANT, true);
if (player && playerTeam && questStatus) // Collect players of the winning team who has yet to recieve the winner reward
if (!isDraw && player->GetBgTeamId() == GetTeamId(winnerTeamId) &&
player->GetQuestStatus(QUEST_FLAG_WINNER) != QUEST_STATUS_REWARDED)
filteredPlayers.push_back(player); filteredPlayers.push_back(player);
} });
if (filteredPlayers.size()) // Randomly select one player from winners team to recieve the reward, if any eligible
if (!filteredPlayers.empty())
{ {
if (Player* wPlayer = filteredPlayers[rand() % filteredPlayers.size()]) Player* wPlayer = filteredPlayers[rand() % filteredPlayers.size()];
wPlayer->CastSpell(wPlayer, SPELL_SPIRIT_OF_COMPETITION_WINNER, true); wPlayer->CastSpell(wPlayer, SPELL_SPIRIT_OF_COMPETITION_WINNER, true);
} }
return true;
} }
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
@@ -1654,63 +1648,6 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
return false; return false;
} }
void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source)
{
if (!entry)
return;
Acore::BattlegroundChatBuilder bg_builder(type, entry, source);
Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do);
}
void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...)
{
if (!entry)
return;
va_list ap;
va_start(ap, source);
Acore::BattlegroundChatBuilder bg_builder(type, entry, source, &ap);
Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do);
va_end(ap);
}
void Battleground::SendWarningToAll(uint32 entry, ...)
{
if (!entry)
return;
std::map<uint32, WorldPacket> localizedPackets;
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
if (localizedPackets.find(itr->second->GetSession()->GetSessionDbLocaleIndex()) == localizedPackets.end())
{
char const* format = sObjectMgr->GetAcoreString(entry, itr->second->GetSession()->GetSessionDbLocaleIndex());
char str[1024];
va_list ap;
va_start(ap, entry);
vsnprintf(str, 1024, format, ap);
va_end(ap);
ChatHandler::BuildChatPacket(localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, nullptr, nullptr, str);
}
itr->second->SendDirectMessage(&localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()]);
}
}
void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2)
{
Acore::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
Acore::LocalizedPacketDo<Acore::Battleground2ChatBuilder> bg_do(bg_builder);
BroadcastWorker(bg_do);
}
void Battleground::EndNow() void Battleground::EndNow()
{ {
RemoveFromBGFreeSlotQueue(); RemoveFromBGFreeSlotQueue();
+1 -8
View File
@@ -344,7 +344,7 @@ public:
[[nodiscard]] uint32 GetBonusHonorFromKill(uint32 kills) const; [[nodiscard]] uint32 GetBonusHonorFromKill(uint32 kills) const;
// Spirit of Competition event // Spirit of Competition event
bool SpiritofCompetitionEvent(PvPTeamId winnerTeamId); void SpiritOfCompetitionEvent(PvPTeamId winnerTeamId) const;
bool IsRandom() { return m_IsRandom; } bool IsRandom() { return m_IsRandom; }
@@ -471,13 +471,6 @@ public:
void BlockMovement(Player* player); void BlockMovement(Player* player);
void SendWarningToAll(uint32 entry, ...);
void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr);
void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
// specialized version with 2 string id args
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
// Raid Group // Raid Group
[[nodiscard]] Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; } [[nodiscard]] Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
void SetBgRaid(TeamId teamId, Group* bg_raid); void SetBgRaid(TeamId teamId, Group* bg_raid);
@@ -16,6 +16,7 @@
*/ */
#include "BattlegroundSA.h" #include "BattlegroundSA.h"
#include "Chat.h"
#include "GameGraveyard.h" #include "GameGraveyard.h"
#include "GameObject.h" #include "GameObject.h"
#include "GameTime.h" #include "GameTime.h"
@@ -357,7 +358,11 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
if (TotalTime >= 1min) if (TotalTime >= 1min)
{ {
SendWarningToAll(LANG_BG_SA_HAS_BEGUN); GetBgMap()->DoForAllPlayers([&](Player* player)
{
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_HAS_BEGUN);
});
TotalTime = 0s; TotalTime = 0s;
ToggleTimer(); ToggleTimer();
DemolisherStartState(false); DemolisherStartState(false);
@@ -411,7 +416,12 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
Status = BG_SA_SECOND_WARMUP; Status = BG_SA_SECOND_WARMUP;
TotalTime = 0s; TotalTime = 0s;
ToggleTimer(); ToggleTimer();
SendWarningToAll(LANG_BG_SA_ROUND_ONE_END);
GetBgMap()->DoForAllPlayers([&](Player* player)
{
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_ROUND_ONE_END);
});
UpdateWaitTimer = 5000; UpdateWaitTimer = 5000;
SignaledRoundTwo = false; SignaledRoundTwo = false;
SignaledRoundTwoHalfMin = false; SignaledRoundTwoHalfMin = false;
@@ -616,11 +626,14 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
} }
if (eventType == go->GetGOInfo()->building.destroyedEvent) if (eventType == go->GetGOInfo()->building.destroyedEvent)
{
GetBgMap()->DoForAllPlayers([&](Player* player)
{ {
if (go->GetGOInfo()->building.destroyedEvent == 19837) if (go->GetGOInfo()->building.destroyedEvent == 19837)
SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED); ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_CHAMBER_BREACHED);
else else
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str()); ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name);
});
uint32 i = GetGateIDFromEntry(go->GetEntry()); uint32 i = GetGateIDFromEntry(go->GetEntry());
switch (i) switch (i)
@@ -655,7 +668,10 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
} }
if (eventType == go->GetGOInfo()->building.damageEvent) if (eventType == go->GetGOInfo()->building.damageEvent)
SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name.c_str()); GetBgMap()->DoForAllPlayers([&](Player* player)
{
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name);
});
} }
void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer) void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
@@ -957,10 +973,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE) GetBgMap()->DoForAllPlayers([&](Player* player)
SendWarningToAll(LANG_BG_SA_A_GY_WEST); {
if (player->GetTeamId() == TEAM_ALLIANCE)
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_WEST);
else else
SendWarningToAll(LANG_BG_SA_H_GY_WEST); ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_H_GY_WEST);
});
break; break;
case BG_SA_RIGHT_CAPTURABLE_GY: case BG_SA_RIGHT_CAPTURABLE_GY:
flag = BG_SA_RIGHT_FLAG; flag = BG_SA_RIGHT_FLAG;
@@ -985,10 +1004,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE) GetBgMap()->DoForAllPlayers([&](Player* player)
SendWarningToAll(LANG_BG_SA_A_GY_EAST); {
if (player->GetTeamId() == TEAM_ALLIANCE)
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_EAST);
else else
SendWarningToAll(LANG_BG_SA_H_GY_EAST); ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_H_GY_EAST);
});
break; break;
case BG_SA_CENTRAL_CAPTURABLE_GY: case BG_SA_CENTRAL_CAPTURABLE_GY:
flag = BG_SA_CENTRAL_FLAG; flag = BG_SA_CENTRAL_FLAG;
@@ -999,10 +1021,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0)); UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1)); UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE) GetBgMap()->DoForAllPlayers([&](Player* player)
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH); {
if (player->GetTeamId() == TEAM_ALLIANCE)
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_SOUTH);
else else
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_SOUTH);
});
break; break;
default: default:
ABORT(); ABORT();
@@ -1016,9 +1041,16 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{ {
if (Source->GetTeamId() == Attackers) if (Source->GetTeamId() == Attackers)
{ {
if (Source->GetTeamId() == TEAM_ALLIANCE) GetBgMap()->DoForAllPlayers([&](Player* player)
SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); {
else SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); if (player->GetTeamId() == Attackers)
{
if (player->GetTeamId() == TEAM_ALLIANCE)
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC);
else
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_HORDE_CAPTURED_RELIC);
}
});
if (Status == BG_SA_ROUND_ONE) if (Status == BG_SA_ROUND_ONE)
{ {
+2 -2
View File
@@ -66,7 +66,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
return false; return false;
// not to GM // not to GM
if (hatedUnit->GetTypeId() == TYPEID_PLAYER && hatedUnit->ToPlayer()->IsGameMaster()) if (hatedUnit->IsPlayer() && hatedUnit->ToPlayer()->IsGameMaster())
return false; return false;
// not to dead and not for dead // not to dead and not for dead
@@ -498,7 +498,7 @@ void ThreatMgr::_addThreat(Unit* victim, float threat)
HostileReference* hostileRef = new HostileReference(victim, this, 0); HostileReference* hostileRef = new HostileReference(victim, this, 0);
iThreatContainer.addReference(hostileRef); iThreatContainer.addReference(hostileRef);
hostileRef->AddThreat(threat); // now we add the real threat hostileRef->AddThreat(threat); // now we add the real threat
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster()) if (victim->IsPlayer() && victim->ToPlayer()->IsGameMaster())
hostileRef->setOnlineOfflineState(false); // GM is always offline hostileRef->setOnlineOfflineState(false); // GM is always offline
} }
} }
+1 -1
View File
@@ -325,7 +325,7 @@ namespace DisableMgr
uint8 spellFlags = itr->second.flags; uint8 spellFlags = itr->second.flags;
if (unit) if (unit)
{ {
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || if ((spellFlags & SPELL_DISABLE_PLAYER && unit->IsPlayer()) ||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE))) (unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
{ {
if (spellFlags & SPELL_DISABLE_MAP) if (spellFlags & SPELL_DISABLE_MAP)
@@ -1906,13 +1906,13 @@ bool Creature::CanStartAttack(Unit const* who) const
// This set of checks is should be done only for creatures // This set of checks is should be done only for creatures
if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
(IsImmuneToPC() && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false (IsImmuneToPC() && who->IsPlayer())) // immune to PC and target is a player, return false
{ {
return false; return false;
} }
if (Unit* owner = who->GetOwner()) if (Unit* owner = who->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && IsImmuneToPC()) // immune to PC and target has player owner if (owner->IsPlayer() && IsImmuneToPC()) // immune to PC and target has player owner
return false; return false;
// Do not attack non-combat pets // Do not attack non-combat pets
@@ -218,11 +218,11 @@ void TempSummon::InitStats(uint32 duration)
{ {
SetFaction(owner->GetFaction()); SetFaction(owner->GetFaction());
SetLevel(owner->GetLevel()); SetLevel(owner->GetLevel());
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
m_ControlledByPlayer = true; m_ControlledByPlayer = true;
} }
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
m_CreatedByPlayer = true; m_CreatedByPlayer = true;
} }
@@ -397,7 +397,7 @@ void Minion::setDeathState(DeathState s, bool despawn)
Creature::setDeathState(s, despawn); Creature::setDeathState(s, despawn);
if (s == DeathState::JustDied && IsGuardianPet()) if (s == DeathState::JustDied && IsGuardianPet())
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID()) if (owner->IsPlayer() && owner->GetMinionGUID() == GetGUID())
for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry()) if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry())
{ {
@@ -434,7 +434,7 @@ void Guardian::InitStats(uint32 duration)
{ {
InitStatsForLevel(m_owner->GetLevel()); InitStatsForLevel(m_owner->GetLevel());
if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) if (m_owner->IsPlayer() && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
m_charmInfo->InitCharmCreateSpells(); m_charmInfo->InitCharmCreateSpells();
} }
@@ -447,7 +447,7 @@ void Guardian::InitSummon()
if (Unit* m_owner = GetOwner()) if (Unit* m_owner = GetOwner())
{ {
if (m_owner->GetTypeId() == TYPEID_PLAYER && m_owner->GetMinionGUID() == GetGUID() && !m_owner->GetCharmGUID()) if (m_owner->IsPlayer() && m_owner->GetMinionGUID() == GetGUID() && !m_owner->GetCharmGUID())
{ {
m_owner->ToPlayer()->CharmSpellInitialize(); m_owner->ToPlayer()->CharmSpellInitialize();
} }
@@ -510,7 +510,7 @@ void GameObject::Update(uint32 diff)
{ {
// splash bobber (bobber ready now) // splash bobber (bobber ready now)
Unit* caster = GetOwner(); Unit* caster = GetOwner();
if (caster && caster->GetTypeId() == TYPEID_PLAYER) if (caster && caster->IsPlayer())
{ {
SetGoState(GO_STATE_ACTIVE); SetGoState(GO_STATE_ACTIVE);
ReplaceAllGameObjectFlags(GO_FLAG_NODESPAWN); ReplaceAllGameObjectFlags(GO_FLAG_NODESPAWN);
@@ -634,7 +634,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
{ {
Unit* caster = GetOwner(); Unit* caster = GetOwner();
if (caster && caster->GetTypeId() == TYPEID_PLAYER) if (caster && caster->IsPlayer())
{ {
caster->ToPlayer()->RemoveGameObject(this, false); caster->ToPlayer()->RemoveGameObject(this, false);
@@ -1635,7 +1635,7 @@ void GameObject::Use(Unit* user)
if (HasGameObjectFlag(GO_FLAG_IN_USE)) if (HasGameObjectFlag(GO_FLAG_IN_USE))
return; return;
if (user->GetTypeId() == TYPEID_PLAYER) if (user->IsPlayer())
{ {
Player* player = user->ToPlayer(); Player* player = user->ToPlayer();
+16 -16
View File
@@ -90,7 +90,7 @@ WorldObject::~WorldObject()
// this may happen because there are many !create/delete // this may happen because there are many !create/delete
if (IsWorldObject() && m_currMap) if (IsWorldObject() && m_currMap)
{ {
if (GetTypeId() == TYPEID_CORPSE) if (IsCorpse())
{ {
LOG_FATAL("entities.object", "Object::~Object Corpse {}, type={} deleted but still in map!!", GetGUID().ToString(), ((Corpse*)this)->GetType()); LOG_FATAL("entities.object", "Object::~Object Corpse {}, type={} deleted but still in map!!", GetGUID().ToString(), ((Corpse*)this)->GetType());
ABORT(); ABORT();
@@ -403,7 +403,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
*data << object->GetOrientation(); *data << object->GetOrientation();
if (GetTypeId() == TYPEID_CORPSE) if (IsCorpse())
*data << float(object->GetOrientation()); *data << float(object->GetOrientation());
else else
*data << float(0); *data << float(0);
@@ -1087,7 +1087,7 @@ void WorldObject::setActive(bool on)
if (m_isActive == on) if (m_isActive == on)
return; return;
if (GetTypeId() == TYPEID_PLAYER) if (IsPlayer())
return; return;
m_isActive = on; m_isActive = on;
@@ -1103,7 +1103,7 @@ void WorldObject::setActive(bool on)
{ {
if (GetTypeId() == TYPEID_UNIT) if (GetTypeId() == TYPEID_UNIT)
map->AddToActive(this->ToCreature()); map->AddToActive(this->ToCreature());
else if (GetTypeId() == TYPEID_DYNAMICOBJECT) else if (IsDynamicObject())
map->AddToActive((DynamicObject*)this); map->AddToActive((DynamicObject*)this);
else if (GetTypeId() == TYPEID_GAMEOBJECT) else if (GetTypeId() == TYPEID_GAMEOBJECT)
map->AddToActive((GameObject*)this); map->AddToActive((GameObject*)this);
@@ -1112,7 +1112,7 @@ void WorldObject::setActive(bool on)
{ {
if (GetTypeId() == TYPEID_UNIT) if (GetTypeId() == TYPEID_UNIT)
map->RemoveFromActive(this->ToCreature()); map->RemoveFromActive(this->ToCreature());
else if (GetTypeId() == TYPEID_DYNAMICOBJECT) else if (IsDynamicObject())
map->RemoveFromActive((DynamicObject*)this); map->RemoveFromActive((DynamicObject*)this);
else if (GetTypeId() == TYPEID_GAMEOBJECT) else if (GetTypeId() == TYPEID_GAMEOBJECT)
map->RemoveFromActive((GameObject*)this); map->RemoveFromActive((GameObject*)this);
@@ -1122,7 +1122,7 @@ void WorldObject::setActive(bool on)
void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type) void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type)
{ {
ASSERT(type < VisibilityDistanceType::Max); ASSERT(type < VisibilityDistanceType::Max);
if (GetTypeId() == TYPEID_PLAYER) if (IsPlayer())
{ {
return; return;
} }
@@ -1329,7 +1329,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz, VMAP::ModelIgnoreFla
{ {
oz += GetCollisionHeight(); oz += GetCollisionHeight();
float x, y, z; float x, y, z;
if (GetTypeId() == TYPEID_PLAYER) if (IsPlayer())
{ {
GetPosition(x, y, z); GetPosition(x, y, z);
z += GetCollisionHeight(); z += GetCollisionHeight();
@@ -1350,7 +1350,7 @@ bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlag
return false; return false;
float ox, oy, oz; float ox, oy, oz;
if (obj->GetTypeId() == TYPEID_PLAYER) if (obj->IsPlayer())
{ {
obj->GetPosition(ox, oy, oz); obj->GetPosition(ox, oy, oz);
oz += obj->GetCollisionHeight(); oz += obj->GetCollisionHeight();
@@ -1359,7 +1359,7 @@ bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlag
obj->GetHitSpherePointFor({ GetPositionX(), GetPositionY(), GetPositionZ() + (collisionHeight ? *collisionHeight : GetCollisionHeight()) }, ox, oy, oz); obj->GetHitSpherePointFor({ GetPositionX(), GetPositionY(), GetPositionZ() + (collisionHeight ? *collisionHeight : GetCollisionHeight()) }, ox, oy, oz);
float x, y, z; float x, y, z;
if (GetTypeId() == TYPEID_PLAYER) if (IsPlayer())
{ {
GetPosition(x, y, z); GetPosition(x, y, z);
z += GetCollisionHeight(); z += GetCollisionHeight();
@@ -1634,7 +1634,7 @@ float WorldObject::GetGridActivationRange() const
{ {
return ToCreature()->m_SightDistance; return ToCreature()->m_SightDistance;
} }
else if (((GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) || GetTypeId() == TYPEID_DYNAMICOBJECT) && isActiveObject()) else if (((GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) || IsDynamicObject()) && isActiveObject())
{ {
return GetMap()->GetVisibilityRange(); return GetMap()->GetVisibilityRange();
} }
@@ -1762,7 +1762,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
} }
// pussywizard: arena spectator // pussywizard: arena spectator
if (obj->GetTypeId() == TYPEID_PLAYER) if (obj->IsPlayer())
if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap()->IsBattleArena()) if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap()->IsBattleArena())
return false; return false;
@@ -1858,7 +1858,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
return false; return false;
// pussywizard: arena spectator // pussywizard: arena spectator
if (this->GetTypeId() == TYPEID_PLAYER) if (this->IsPlayer())
if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags())) if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags()))
return false; return false;
@@ -2035,7 +2035,7 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj, bool checkAlert) co
Unit const* unit = ToUnit(); Unit const* unit = ToUnit();
// If this unit is an NPC then player detect range doesn't apply // If this unit is an NPC then player detect range doesn't apply
if (unit && unit->GetTypeId() == TYPEID_PLAYER && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE) if (unit && unit->IsPlayer() && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE)
visibilityRange = MAX_PLAYER_STEALTH_DETECT_RANGE; visibilityRange = MAX_PLAYER_STEALTH_DETECT_RANGE;
if (checkAlert) if (checkAlert)
@@ -2058,7 +2058,7 @@ void WorldObject::SendPlayMusic(uint32 Music, bool OnlySelf)
{ {
WorldPacket data(SMSG_PLAY_MUSIC, 4); WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << Music; data << Music;
if (OnlySelf && GetTypeId() == TYPEID_PLAYER) if (OnlySelf && IsPlayer())
this->ToPlayer()->GetSession()->SendPacket(&data); this->ToPlayer()->GetSession()->SendPacket(&data);
else else
SendMessageToSet(&data, true); // ToSelf ignored in this case SendMessageToSet(&data, true); // ToSelf ignored in this case
@@ -2389,7 +2389,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
if (respawnTime) if (respawnTime)
go->SetSpellId(1); go->SetSpellId(1);
if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && summonType == GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)) //not sure how to handle this if (IsPlayer() || (GetTypeId() == TYPEID_UNIT && summonType == GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)) //not sure how to handle this
ToUnit()->AddGameObject(go); ToUnit()->AddGameObject(go);
else else
go->SetSpawnedByDefault(false); go->SetSpawnedByDefault(false);
@@ -2406,7 +2406,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return nullptr; return nullptr;
//summon->SetName(GetName()); //summon->SetName(GetName());
if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)) if (setLevel && (IsPlayer() || GetTypeId() == TYPEID_UNIT))
{ {
summon->SetFaction(((Unit*)this)->GetFaction()); summon->SetFaction(((Unit*)this)->GetFaction());
summon->SetLevel(((Unit*)this)->GetLevel()); summon->SetLevel(((Unit*)this)->GetLevel());
+18 -11
View File
@@ -195,21 +195,28 @@ public:
void ForceValuesUpdateAtIndex(uint32); void ForceValuesUpdateAtIndex(uint32);
[[nodiscard]] inline bool IsPlayer() const { return GetTypeId() == TYPEID_PLAYER; } [[nodiscard]] inline bool IsPlayer() const { return GetTypeId() == TYPEID_PLAYER; }
Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return nullptr; } Player* ToPlayer() { if (IsPlayer()) return reinterpret_cast<Player*>(this); else return nullptr; }
[[nodiscard]] Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; } [[nodiscard]] Player const* ToPlayer() const { if (IsPlayer()) return reinterpret_cast<Player const*>(this); else return nullptr; }
Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return nullptr; } Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return nullptr; }
[[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; } [[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature const*>(this); else return nullptr; }
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return nullptr; } Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || IsPlayer()) return reinterpret_cast<Unit*>(this); else return nullptr; }
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (Unit const*)((Unit*)this); else return nullptr; } [[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || IsPlayer()) return reinterpret_cast<Unit const*>(this); else return nullptr; }
GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return nullptr; }
[[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (GameObject const*)((GameObject*)this); else return nullptr; }
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return nullptr; } [[nodiscard]] inline bool IsGameObject() const { return GetTypeId() == TYPEID_GAMEOBJECT; }
[[nodiscard]] Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; } GameObject* ToGameObject() { if (IsGameObject()) return reinterpret_cast<GameObject*>(this); else return nullptr; }
[[nodiscard]] GameObject const* ToGameObject() const { if (IsGameObject()) return reinterpret_cast<GameObject const*>(this); else return nullptr; }
DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject*>(this); else return nullptr; } [[nodiscard]] inline bool IsCorpse() const { return GetTypeId() == TYPEID_CORPSE; }
[[nodiscard]] DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; } Corpse* ToCorpse() { if (IsCorpse()) return reinterpret_cast<Corpse*>(this); else return nullptr; }
[[nodiscard]] Corpse const* ToCorpse() const { if (IsCorpse()) return reinterpret_cast<Corpse const*>(this); else return nullptr; }
[[nodiscard]] inline bool IsDynamicObject() const { return GetTypeId() == TYPEID_DYNAMICOBJECT; }
DynamicObject* ToDynObject() { if (IsDynamicObject()) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
[[nodiscard]] DynamicObject const* ToDynObject() const { if (IsDynamicObject()) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
[[nodiscard]] inline bool IsItem() const { return GetTypeId() == TYPEID_ITEM; }
virtual std::string GetDebugInfo() const; virtual std::string GetDebugInfo() const;
+7 -12
View File
@@ -52,7 +52,7 @@ Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID
m_tempspellIsPositive(false), m_tempspellIsPositive(false),
m_tempspell(0) m_tempspell(0)
{ {
ASSERT(m_owner && m_owner->GetTypeId() == TYPEID_PLAYER); ASSERT(m_owner && m_owner->IsPlayer());
m_unitTypeMask |= UNIT_MASK_PET; m_unitTypeMask |= UNIT_MASK_PET;
@@ -415,7 +415,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
map->AddToMap(ToCreature(), true); map->AddToMap(ToCreature(), true);
//set last used pet number (for use in BG's) //set last used pet number (for use in BG's)
if (owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET)) if (owner->IsPlayer() && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET))
owner->ToPlayer()->SetLastPetNumber(petInfo->PetNumber); owner->ToPlayer()->SetLastPetNumber(petInfo->PetNumber);
owner->GetSession()->AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(std::make_shared<PetLoadQueryHolder>(ownerid, petInfo->PetNumber))) owner->GetSession()->AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(std::make_shared<PetLoadQueryHolder>(ownerid, petInfo->PetNumber)))
@@ -754,17 +754,12 @@ void Pet::Update(uint32 diff)
GetMotionMaster()->Clear(false); GetMotionMaster()->Clear(false);
GetMotionMaster()->MoveIdle(); GetMotionMaster()->MoveIdle();
bool oldCmdAttack = GetCharmInfo()->IsCommandAttack();
GetCharmInfo()->SetIsCommandAttack(false);
GetCharmInfo()->SetIsAtStay(true); GetCharmInfo()->SetIsAtStay(true);
GetCharmInfo()->SetIsCommandFollow(false); GetCharmInfo()->SetIsCommandFollow(false);
GetCharmInfo()->SetIsFollowing(false); GetCharmInfo()->SetIsFollowing(false);
GetCharmInfo()->SetIsReturning(false); GetCharmInfo()->SetIsReturning(false);
GetCharmInfo()->SaveStayPosition(true); GetCharmInfo()->SaveStayPosition(true);
GetCharmInfo()->SetIsCommandAttack(oldCmdAttack);
AddSpellCooldown(tempspell, 0, spellInfo->IsCooldownStartedOnEvent() ? infinityCooldownDelay : 0); AddSpellCooldown(tempspell, 0, spellInfo->IsCooldownStartedOnEvent() ? infinityCooldownDelay : 0);
CastSpell(tempspellTarget, tempspell, false); CastSpell(tempspellTarget, tempspell, false);
@@ -1040,7 +1035,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
//Determine pet type //Determine pet type
PetType petType = MAX_PET_TYPE; PetType petType = MAX_PET_TYPE;
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
{ {
sScriptMgr->OnBeforeGuardianInitStatsForLevel(owner->ToPlayer(), this, cinfo, petType); sScriptMgr->OnBeforeGuardianInitStatsForLevel(owner->ToPlayer(), this, cinfo, petType);
@@ -1137,8 +1132,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
// remove elite bonuses included in DB values // remove elite bonuses included in DB values
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class);
// xinef: multiply base values by creature_template factors! // xinef: multiply base values by creature_template factors!
float factorHealth = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; float factorHealth = owner->IsPlayer() ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth;
float factorMana = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; float factorMana = owner->IsPlayer() ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana;
if (sWorld->getBoolConfig(CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH)) if (sWorld->getBoolConfig(CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH))
{ {
@@ -1435,7 +1430,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetFullHealth(); SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
sScriptMgr->OnAfterGuardianInitStatsForLevel(owner->ToPlayer(), this); sScriptMgr->OnAfterGuardianInitStatsForLevel(owner->ToPlayer(), this);
return true; return true;
@@ -2030,7 +2025,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
{ {
// need update action bar for last removed rank // need update action bar for last removed rank
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
owner->ToPlayer()->PetSpellInitialize(); owner->ToPlayer()->PetSpellInitialize();
} }
} }
@@ -70,7 +70,7 @@ KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) :
_isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false) _isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false)
{ {
// mark the credit as pvp if victim is player // mark the credit as pvp if victim is player
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
_isPvP = true; _isPvP = true;
// or if its owned by player and its not a vehicle // or if its owned by player and its not a vehicle
else if (victim->GetCharmerOrOwnerGUID().IsPlayer()) else if (victim->GetCharmerOrOwnerGUID().IsPlayer())
@@ -201,7 +201,7 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
// 4.1. Give honor (player must be alive and not on BG). // 4.1. Give honor (player must be alive and not on BG).
_RewardHonor(player); _RewardHonor(player);
// 4.1.1 Send player killcredit for quests with PlayerSlain // 4.1.1 Send player killcredit for quests with PlayerSlain
if (_victim->GetTypeId() == TYPEID_PLAYER) if (_victim->IsPlayer())
player->KilledPlayerCredit(); player->KilledPlayerCredit();
} }
@@ -256,7 +256,7 @@ void KillRewarder::_RewardGroup()
{ {
_RewardPlayer(member, isDungeon); _RewardPlayer(member, isDungeon);
// Xinef: only count players // Xinef: only count players
//if (_victim->GetTypeId() == TYPEID_PLAYER) //if (_victim->IsPlayer())
// member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, _victim); // member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, _victim);
} }
} }
+5 -5
View File
@@ -5915,7 +5915,7 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
// Calculates how many reputation points player gains in victim's enemy factions // Calculates how many reputation points player gains in victim's enemy factions
void Player::RewardReputation(Unit* victim) void Player::RewardReputation(Unit* victim)
{ {
if (!victim || victim->GetTypeId() == TYPEID_PLAYER) if (!victim || victim->IsPlayer())
return; return;
if (victim->ToCreature()->IsReputationGainDisabled()) if (victim->ToCreature()->IsReputationGainDisabled())
@@ -6047,7 +6047,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
return false; return false;
/* check if player has same IP /* check if player has same IP
if (uVictim && uVictim->GetTypeId() == TYPEID_PLAYER) if (uVictim && uVictim->IsPlayer())
{ {
if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress()) if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress())
return false; return false;
@@ -6074,7 +6074,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
victim_guid = uVictim->GetGUID(); victim_guid = uVictim->GetGUID();
if (uVictim->GetTypeId() == TYPEID_PLAYER) if (uVictim->IsPlayer())
{ {
Player* victim = uVictim->ToPlayer(); Player* victim = uVictim->ToPlayer();
@@ -6185,7 +6185,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
return true; return true;
if (uVictim->GetTypeId() == TYPEID_PLAYER) if (uVictim->IsPlayer())
{ {
// Check if allowed to receive it in current map // Check if allowed to receive it in current map
uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE); uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
@@ -9172,7 +9172,7 @@ Pet* Player::CreatePet(Creature* creatureTarget, uint32 spellID /*= 0*/)
return nullptr; return nullptr;
} }
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
{ {
return nullptr; return nullptr;
} }
@@ -551,7 +551,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
uint32 timeAllowed = quest->GetTimeAllowed(); uint32 timeAllowed = quest->GetTimeAllowed();
// shared timed quest // shared timed quest
if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER) if (questGiver && questGiver->IsPlayer())
timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS; timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
AddTimedQuest(quest_id); AddTimedQuest(quest_id);
@@ -1947,7 +1947,7 @@ void Player::UpdateCharmedAI()
1 << (CLASS_PRIEST - 1)); 1 << (CLASS_PRIEST - 1));
// Xinef: charmer type specific actions // Xinef: charmer type specific actions
if (charmer->GetTypeId() == TYPEID_PLAYER) if (charmer->IsPlayer())
{ {
bool follow = false; bool follow = false;
if (!target) if (!target)
+1 -1
View File
@@ -51,7 +51,7 @@ void Totem::InitStats(uint32 duration)
if (Unit* owner = ObjectAccessor::GetUnit(*this, m_owner)) if (Unit* owner = ObjectAccessor::GetUnit(*this, m_owner))
{ {
uint32 slot = m_Properties->Slot; uint32 slot = m_Properties->Slot;
if (owner->GetTypeId() == TYPEID_PLAYER && slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT) if (owner->IsPlayer() && slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT)
{ {
WorldPackets::Totem::TotemCreated data; WorldPackets::Totem::TotemCreated data;
data.Totem = GetGUID(); data.Totem = GetGUID();
@@ -442,7 +442,7 @@ void MotionTransport::UnloadNonStaticPassengers()
{ {
for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ) for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); )
{ {
if ((*itr)->GetTypeId() == TYPEID_PLAYER) if ((*itr)->IsPlayer())
{ {
++itr; ++itr;
continue; continue;
@@ -518,7 +518,7 @@ bool MotionTransport::TeleportTransport(uint32 newMapid, float x, float y, float
// Teleport players, they need to know it // Teleport players, they need to know it
for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr) for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
{ {
if ((*itr)->GetTypeId() == TYPEID_PLAYER) if ((*itr)->IsPlayer())
{ {
float destX, destY, destZ, destO; float destX, destY, destZ, destO;
(*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
+1 -1
View File
@@ -114,7 +114,7 @@ void CharmInfo::InitCharmCreateSpells()
{ {
InitPetActionBar(); InitPetActionBar();
if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells if (_unit->IsPlayer()) // charmed players don't have spells
return; return;
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i) for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -82,7 +82,7 @@ void Vehicle::Install()
void Vehicle::InstallAllAccessories(bool evading) void Vehicle::InstallAllAccessories(bool evading)
{ {
if (GetBase()->GetTypeId() == TYPEID_PLAYER || !evading) if (GetBase()->IsPlayer() || !evading)
RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove
VehicleAccessoryList const* accessories = sObjectMgr->GetVehicleAccessoryList(this); VehicleAccessoryList const* accessories = sObjectMgr->GetVehicleAccessoryList(this);
@@ -116,7 +116,7 @@ void Vehicle::Uninstall()
void Vehicle::Reset(bool evading /*= false*/) void Vehicle::Reset(bool evading /*= false*/)
{ {
LOG_DEBUG("vehicles", "Vehicle::Reset: {}", _me->GetGUID().ToString()); LOG_DEBUG("vehicles", "Vehicle::Reset: {}", _me->GetGUID().ToString());
if (_me->GetTypeId() == TYPEID_PLAYER) if (_me->IsPlayer())
{ {
if (_usableSeatNum) if (_usableSeatNum)
_me->SetNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE); _me->SetNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE);
@@ -357,7 +357,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
--_usableSeatNum; --_usableSeatNum;
if (!_usableSeatNum) if (!_usableSeatNum)
{ {
if (_me->GetTypeId() == TYPEID_PLAYER) if (_me->IsPlayer())
_me->RemoveNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE); _me->RemoveNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE);
else else
_me->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK); _me->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK);
@@ -368,7 +368,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
return false; return false;
// Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags
if (unit->GetTypeId() == TYPEID_PLAYER && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET)) if (unit->IsPlayer() && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET))
unit->ToPlayer()->UnsummonPetTemporaryIfAny(); unit->ToPlayer()->UnsummonPetTemporaryIfAny();
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE) if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE)
@@ -383,7 +383,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
// xinef: removed seat->first == 0 check... // xinef: removed seat->first == 0 check...
if (_me->GetTypeId() == TYPEID_UNIT if (_me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER && unit->IsPlayer()
&& seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
{ {
// Removed try catch + ABORT() here, and make it as simple condition check. // Removed try catch + ABORT() here, and make it as simple condition check.
@@ -460,7 +460,7 @@ void Vehicle::RemovePassenger(Unit* unit)
unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first); unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first);
if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum) if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum)
_me->SetNpcFlag((_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK)); _me->SetNpcFlag((_me->IsPlayer() ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
// Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle // Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable) if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable)
@@ -468,7 +468,7 @@ void Vehicle::RemovePassenger(Unit* unit)
seat->second.Passenger.Reset(); seat->second.Passenger.Reset();
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) if (_me->GetTypeId() == TYPEID_UNIT && unit->IsPlayer() && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
_me->RemoveCharmedBy(unit); _me->RemoveCharmedBy(unit);
if (_me->IsInWorld()) if (_me->IsInWorld())
@@ -483,7 +483,7 @@ void Vehicle::RemovePassenger(Unit* unit)
} }
// only for flyable vehicles // only for flyable vehicles
if (_me->IsFlying() && !_me->GetInstanceId() && unit->GetTypeId() == TYPEID_PLAYER && !(unit->ToPlayer()->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT) && _me->GetEntry() != 30275 /*NPC_WILD_WYRM*/) if (_me->IsFlying() && !_me->GetInstanceId() && unit->IsPlayer() && !(unit->ToPlayer()->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT) && _me->GetEntry() != 30275 /*NPC_WILD_WYRM*/)
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true); _me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (_me->GetTypeId() == TYPEID_UNIT) if (_me->GetTypeId() == TYPEID_UNIT)
@@ -533,7 +533,7 @@ bool Vehicle::IsVehicleInUse()
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid))
{ {
if (passenger->GetTypeId() == TYPEID_PLAYER) if (passenger->IsPlayer())
return true; return true;
else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit() && passenger->GetVehicleKit()->IsVehicleInUse()) else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit() && passenger->GetVehicleKit()->IsVehicleInUse())
return true; return true;
@@ -550,7 +550,7 @@ void Vehicle::TeleportVehicle(float x, float y, float z, float ang)
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid))
{ {
if (passenger->GetTypeId() == TYPEID_PLAYER) if (passenger->IsPlayer())
{ {
passenger->ToPlayer()->SetMover(passenger); passenger->ToPlayer()->SetMover(passenger);
passenger->NearTeleportTo(x, y, z, ang, false, true); passenger->NearTeleportTo(x, y, z, ang, false, true);
+1 -1
View File
@@ -146,7 +146,7 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid con
switch (guid.GetHigh()) switch (guid.GetHigh())
{ {
case HighGuid::Item: case HighGuid::Item:
if (typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) if (typemask & TYPEMASK_ITEM && p.IsPlayer())
return ((Player const&)p).GetItemByGuid(guid); return ((Player const&)p).GetItemByGuid(guid);
break; break;
case HighGuid::Player: case HighGuid::Player:
@@ -159,7 +159,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
{ {
c->AI()->MoveInLineOfSight_Safe(u); c->AI()->MoveInLineOfSight_Safe(u);
} }
else if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true)) else if (u->IsPlayer() && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true))
{ {
c->AI()->TriggerAlert(u); c->AI()->TriggerAlert(u);
} }
@@ -107,7 +107,7 @@ namespace Acore
bool required3dDist; bool required3dDist;
MessageDistDeliverer(WorldObject const* src, WorldPacket const* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr, bool req3dDist = false) MessageDistDeliverer(WorldObject const* src, WorldPacket const* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr, bool req3dDist = false)
: i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist)
, teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) , teamId((own_team_only && src->IsPlayer()) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL)
, skipped_receiver(skipped), required3dDist(req3dDist) , skipped_receiver(skipped), required3dDist(req3dDist)
{ {
} }
@@ -978,7 +978,7 @@ namespace Acore
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {} AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {}
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER)) if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->IsPlayer()))
return true; return true;
else else
return false; return false;
@@ -996,7 +996,7 @@ namespace Acore
AnyFriendlyNotSelfUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {} AnyFriendlyNotSelfUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {}
bool operator()(Unit* u) bool operator()(Unit* u)
{ {
if (u != i_obj && u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER)) if (u != i_obj && u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->IsPlayer()))
return true; return true;
else else
return false; return false;
@@ -1083,8 +1083,8 @@ namespace Acore
Unit const* owner = i_funit->GetOwner(); Unit const* owner = i_funit->GetOwner();
if (owner) if (owner)
check = owner; check = owner;
i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER); i_targetForPlayer = (check->IsPlayer());
if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT) if (i_obj->IsDynamicObject())
_spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId()); _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
} }
bool operator()(Unit* u) bool operator()(Unit* u)
@@ -1104,7 +1104,8 @@ namespace Acore
} }
if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false)) if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false))
return true; return true;
return false; return false;
@@ -1487,7 +1488,7 @@ namespace Acore
} }
Player* player = nullptr; Player* player = nullptr;
if (u->GetTypeId() == TYPEID_PLAYER) if (u->IsPlayer())
{ {
player = u->ToPlayer(); player = u->ToPlayer();
} }
+6 -13
View File
@@ -92,7 +92,7 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
} }
// Xinef: allow to controll players // Xinef: allow to controll players
if (pet->GetTypeId() == TYPEID_PLAYER && flag != ACT_COMMAND && flag != ACT_REACTION) if (pet->IsPlayer() && flag != ACT_COMMAND && flag != ACT_REACTION)
return; return;
// Do not follow itself vehicle // Do not follow itself vehicle
@@ -355,13 +355,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
return; return;
} }
// Clear the flags as if owner clicked 'attack'. AI will reset them
// after AttackStart, even if spell failed
charmInfo->SetIsAtStay(false);
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsReturning(false);
charmInfo->SetIsFollowing(false);
TriggerCastFlags triggerCastFlags = TRIGGERED_NONE; TriggerCastFlags triggerCastFlags = TRIGGERED_NONE;
if (spellInfo->IsPassive()) if (spellInfo->IsPassive())
@@ -394,17 +387,17 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
if (unit_target) if (unit_target)
{ {
pet->SetInFront(unit_target); pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER) if (unit_target->IsPlayer())
pet->SendUpdateToPlayer(unit_target->ToPlayer()); pet->SendUpdateToPlayer(unit_target->ToPlayer());
} }
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget()) else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
{ {
pet->SetInFront(unit_target2); pet->SetInFront(unit_target2);
if (unit_target2->GetTypeId() == TYPEID_PLAYER) if (unit_target2->IsPlayer())
pet->SendUpdateToPlayer(unit_target2->ToPlayer()); pet->SendUpdateToPlayer(unit_target2->ToPlayer());
} }
if (Unit* powner = pet->GetCharmerOrOwner()) if (Unit* powner = pet->GetCharmerOrOwner())
if (powner->GetTypeId() == TYPEID_PLAYER) if (powner->IsPlayer())
pet->SendUpdateToPlayer(powner->ToPlayer()); pet->SendUpdateToPlayer(powner->ToPlayer());
result = SPELL_CAST_OK; result = SPELL_CAST_OK;
@@ -860,7 +853,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
pet->SetName(name); pet->SetName(name);
Unit* owner = pet->GetOwner(); Unit* owner = pet->GetOwner();
if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED); pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
@@ -1072,7 +1065,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell()) if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell())
spell->SendPetCastResult(result); spell->SendPetCastResult(result);
if (caster->GetTypeId() == TYPEID_PLAYER) if (caster->IsPlayer())
{ {
if (!caster->ToPlayer()->HasSpellCooldown(spellId)) if (!caster->ToPlayer()->HasSpellCooldown(spellId))
GetPlayer()->SendClearCooldown(spellId, caster); GetPlayer()->SendClearCooldown(spellId, caster);
+3 -3
View File
@@ -124,7 +124,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
// no or incorrect quest giver // no or incorrect quest giver
if (!object || object == _player || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) || if (!object || object == _player || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId))) (object->IsPlayer() && !object->ToPlayer()->CanShareQuest(questId)))
{ {
_player->PlayerTalkClass->SendCloseGossip(); _player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(); _player->SetDivider();
@@ -138,7 +138,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{ {
// pussywizard: exploit fix, can't share quests that give items to be sold // pussywizard: exploit fix, can't share quests that give items to be sold
if (object->GetTypeId() == TYPEID_PLAYER) if (object->IsPlayer())
if (uint32 itemId = quest->GetSrcItemId()) if (uint32 itemId = quest->GetSrcItemId())
if (ItemTemplate const* srcItem = sObjectMgr->GetItemTemplate(itemId)) if (ItemTemplate const* srcItem = sObjectMgr->GetItemTemplate(itemId))
if (srcItem->SellPrice > 0) if (srcItem->SellPrice > 0)
@@ -220,7 +220,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{ {
// not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE // not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE
// if this breaks them, add && object->GetTypeId() == TYPEID_ITEM to this check // if this breaks them, add && object->IsItem() to this check
// item-started quests never have that flag // item-started quests never have that flag
if (!_player->CanTakeQuest(quest, true)) if (!_player->CanTakeQuest(quest, true))
return; return;
+3 -3
View File
@@ -351,7 +351,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// ignore for remote control state (for player case) // ignore for remote control state (for player case)
Unit* mover = _player->m_mover; Unit* mover = _player->m_mover;
if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER) if (mover != _player && mover->IsPlayer())
{ {
recvPacket.rfinish(); // prevent spam at ignore packet recvPacket.rfinish(); // prevent spam at ignore packet
return; return;
@@ -372,7 +372,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
HandleClientCastFlags(recvPacket, castFlags, targets); HandleClientCastFlags(recvPacket, castFlags, targets);
// not have spell in spellbook // not have spell in spellbook
if (mover->GetTypeId() == TYPEID_PLAYER) if (mover->IsPlayer())
{ {
// not have spell in spellbook or spell passive and not casted by client // not have spell in spellbook or spell passive and not casted by client
if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!mover->ToPlayer()->HasActiveSpell(spellId) || spellInfo->IsPassive()) ) if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!mover->ToPlayer()->HasActiveSpell(spellId) || spellInfo->IsPassive()) )
@@ -688,7 +688,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
data << uint8(creator->getGender()); data << uint8(creator->getGender());
data << uint8(creator->getClass()); data << uint8(creator->getClass());
if (creator->GetTypeId() == TYPEID_PLAYER) if (creator->IsPlayer())
{ {
Player* player = creator->ToPlayer(); Player* player = creator->ToPlayer();
data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin
+1 -1
View File
@@ -70,7 +70,7 @@ Map::~Map()
WorldObject* obj = *i_worldObjects.begin(); WorldObject* obj = *i_worldObjects.begin();
ASSERT(obj->IsWorldObject()); ASSERT(obj->IsWorldObject());
LOG_DEBUG("maps", "Map::~Map: WorldObject TypeId is not a corpse! ({})", static_cast<uint8>(obj->GetTypeId())); LOG_DEBUG("maps", "Map::~Map: WorldObject TypeId is not a corpse! ({})", static_cast<uint8>(obj->GetTypeId()));
//ASSERT(obj->GetTypeId() == TYPEID_CORPSE); //ASSERT(obj->IsCorpse());
obj->RemoveFromWorld(); obj->RemoveFromWorld();
obj->ResetMap(); obj->ResetMap();
} }
+23 -23
View File
@@ -269,7 +269,7 @@ void MotionMaster::MoveTargetedHome(bool walk /*= false*/)
Unit* target = _owner->ToCreature()->GetCharmerOrOwner(); Unit* target = _owner->ToCreature()->GetCharmerOrOwner();
if (target) if (target)
{ {
LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, _owner->GetFollowAngle(),true), MOTION_SLOT_ACTIVE); Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, _owner->GetFollowAngle(),true), MOTION_SLOT_ACTIVE);
} }
} }
@@ -285,7 +285,7 @@ void MotionMaster::MoveConfused()
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) move confused", _owner->GetGUID().ToString()); LOG_DEBUG("movement.motionmaster", "Player ({}) move confused", _owner->GetGUID().ToString());
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED); Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
@@ -305,16 +305,16 @@ void MotionMaster::MoveChase(Unit* target, std::optional<ChaseRange> dist, std:
return; return;
//_owner->ClearUnitState(UNIT_STATE_FOLLOW); //_owner->ClearUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) chase to {} ({})", LOG_DEBUG("movement.motionmaster", "Player ({}) chase to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString());
Mutate(new ChaseMovementGenerator<Player>(target, dist, angle), MOTION_SLOT_ACTIVE); Mutate(new ChaseMovementGenerator<Player>(target, dist, angle), MOTION_SLOT_ACTIVE);
} }
else else
{ {
LOG_DEBUG("movement.motionmaster", "Creature ({}) chase to {} ({})", LOG_DEBUG("movement.motionmaster", "Creature ({}) chase to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString());
Mutate(new ChaseMovementGenerator<Creature>(target, dist, angle), MOTION_SLOT_ACTIVE); Mutate(new ChaseMovementGenerator<Creature>(target, dist, angle), MOTION_SLOT_ACTIVE);
} }
} }
@@ -401,16 +401,16 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
} }
//_owner->AddUnitState(UNIT_STATE_FOLLOW); //_owner->AddUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})", LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Player>(target, dist, angle, inheritWalkState), slot); Mutate(new FollowMovementGenerator<Player>(target, dist, angle, inheritWalkState), slot);
} }
else else
{ {
LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})", LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})",
_owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString());
Mutate(new FollowMovementGenerator<Creature>(target, dist, angle, inheritWalkState), slot); Mutate(new FollowMovementGenerator<Creature>(target, dist, angle, inheritWalkState), slot);
} }
} }
@@ -421,7 +421,7 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
@@ -439,7 +439,7 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
Mutate(new EscortMovementGenerator<Player>(path), MOTION_SLOT_ACTIVE); Mutate(new EscortMovementGenerator<Player>(path), MOTION_SLOT_ACTIVE);
} }
@@ -527,7 +527,7 @@ void MotionMaster::MoveTakeoff(uint32 id, float x, float y, float z, float speed
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ) void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{ {
//this function may make players fall below map //this function may make players fall below map
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
return; return;
if (speedXY <= 0.1f) if (speedXY <= 0.1f)
@@ -553,7 +553,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{ {
//this function may make players fall below map //this function may make players fall below map
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
return; return;
float x, y, z; float x, y, z;
@@ -603,7 +603,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f) if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0); _owner->m_movementInfo.SetFallTime(0);
@@ -634,7 +634,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE) if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z); LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED);
@@ -665,7 +665,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_ERROR("movement.motionmaster", "Player ({}) attempt to seek assistance", _owner->GetGUID().ToString()); LOG_ERROR("movement.motionmaster", "Player ({}) attempt to seek assistance", _owner->GetGUID().ToString());
} }
@@ -685,7 +685,7 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_ERROR("movement.motionmaster", "Player ({}) attempt to call distract after assistance", _owner->GetGUID().ToString()); LOG_ERROR("movement.motionmaster", "Player ({}) attempt to call distract after assistance", _owner->GetGUID().ToString());
} }
@@ -705,16 +705,16 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) flee from {} ({})", LOG_DEBUG("movement.motionmaster", "Player ({}) flee from {} ({})",
_owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString()); _owner->GetGUID().ToString(), enemy->IsPlayer() ? "player" : "creature", enemy->GetGUID().ToString());
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
} }
else else
{ {
LOG_DEBUG("movement.motionmaster", "Creature ({}) flee from {} ({}) {}", LOG_DEBUG("movement.motionmaster", "Creature ({}) flee from {} ({}) {}",
_owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString(), time ? " for a limited time" : ""); _owner->GetGUID().ToString(), enemy->IsPlayer() ? "player" : "creature", enemy->GetGUID().ToString(), time ? " for a limited time" : "");
if (time) if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED); Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
else else
@@ -724,7 +724,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{ {
if (_owner->GetTypeId() == TYPEID_PLAYER) if (_owner->IsPlayer())
{ {
if (path < sTaxiPathNodesByPath.size()) if (path < sTaxiPathNodesByPath.size())
{ {
@@ -754,7 +754,7 @@ void MotionMaster::MoveDistract(uint32 timer)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
/*if (_owner->GetTypeId() == TYPEID_PLAYER) /*if (_owner->IsPlayer())
{ {
LOG_DEBUG("movement.motionmaster", "Player ({}) distracted (timer: {})", _owner->GetGUID().ToString(), timer); LOG_DEBUG("movement.motionmaster", "Player ({}) distracted (timer: {})", _owner->GetGUID().ToString(), timer);
} }
@@ -817,12 +817,12 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
delete curr; delete curr;
}*/ }*/
//_owner->GetTypeId() == TYPEID_PLAYER ? //_owner->IsPlayer() ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)): //Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE); Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})", LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})",
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); _owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO");
} }
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction) void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
@@ -85,7 +85,7 @@ bool ChaseMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
bool forceDest = bool forceDest =
//(cOwner && (cOwner->isWorldBoss() || cOwner->IsDungeonBoss())) || // force for all bosses, even not in instances //(cOwner && (cOwner->isWorldBoss() || cOwner->IsDungeonBoss())) || // force for all bosses, even not in instances
(i_target->GetTypeId() == TYPEID_PLAYER && i_target->ToPlayer()->IsGameMaster()) || // for .npc follow (i_target->IsPlayer() && i_target->ToPlayer()->IsGameMaster()) || // for .npc follow
(owner->CanFly()) (owner->CanFly())
; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to ; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to
@@ -452,11 +452,11 @@ bool FollowMovementGenerator<T>::DoUpdate(T* owner, uint32 time_diff)
bool forceDest = bool forceDest =
(followingMaster) || // allow pets following their master to cheat while generating paths (followingMaster) || // allow pets following their master to cheat while generating paths
(i_target->GetTypeId() == TYPEID_PLAYER && i_target->ToPlayer()->IsGameMaster()) // for .npc follow (i_target->IsPlayer() && i_target->ToPlayer()->IsGameMaster()) // for .npc follow
; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to ; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to
bool targetIsMoving = false; bool targetIsMoving = false;
if (PositionOkay(target, owner->IsGuardian() && target->GetTypeId() == TYPEID_PLAYER, targetIsMoving, time_diff)) if (PositionOkay(target, owner->IsGuardian() && target->IsPlayer(), targetIsMoving, time_diff))
{ {
if (owner->HasUnitState(UNIT_STATE_FOLLOW_MOVE) && owner->movespline->Finalized()) if (owner->HasUnitState(UNIT_STATE_FOLLOW_MOVE) && owner->movespline->Finalized())
{ {
+2 -2
View File
@@ -40,7 +40,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
// prepare static data // prepare static data
ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
///- Schedule script execution for all scripts in the script map ///- Schedule script execution for all scripts in the script map
ScriptMap const* s2 = &(s->second); ScriptMap const* s2 = &(s->second);
@@ -75,7 +75,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
// prepare static data // prepare static data
ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty;
ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty;
ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty;
ScriptAction sa; ScriptAction sa;
sa.sourceGUID = sourceGUID; sa.sourceGUID = sourceGUID;
+16 -1
View File
@@ -30,9 +30,24 @@ namespace
template<typename T> template<typename T>
inline void SCR_CLEAR() inline void SCR_CLEAR()
{ {
for (auto const& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList) for (auto& [scriptID, script] : ScriptRegistry<T>::ScriptPointerList)
{
try
{
if(script)
{ {
delete script; delete script;
script = nullptr;
}
}
catch (const std::exception& e)
{
LOG_ERROR("scripts.unloading", "Failed to unload script {} with ID: {}. Error: {}", script->GetName(), scriptID, e.what());
}
catch (...)
{
LOG_ERROR("scripts.unloading", "Failed to unload script {} with ID: {}. Unknown error occurred.", script->GetName(), scriptID);
}
} }
ScriptRegistry<T>::ScriptPointerList.clear(); ScriptRegistry<T>::ScriptPointerList.clear();
+2 -2
View File
@@ -38,7 +38,7 @@ public:
}; };
WorldSocketMgr::WorldSocketMgr() : WorldSocketMgr::WorldSocketMgr() :
BaseSocketMgr(), _socketSystemSendBufferSize(-1), _socketApplicationSendBufferSize(65536), _tcpNoDelay(true) BaseSocketMgr(), _socketSystemSendBufferSize(-1), _socketApplicationSendBufferSize(4096), _tcpNoDelay(true)
{ {
} }
@@ -57,7 +57,7 @@ bool WorldSocketMgr::StartWorldNetwork(Acore::Asio::IoContext& ioContext, std::s
// -1 means use default // -1 means use default
_socketSystemSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutKBuff", -1); _socketSystemSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutKBuff", -1);
_socketApplicationSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutUBuff", 65536); _socketApplicationSendBufferSize = sConfigMgr->GetOption<int32>("Network.OutUBuff", 4096);
if (_socketApplicationSendBufferSize <= 0) if (_socketApplicationSendBufferSize <= 0)
{ {
@@ -1543,7 +1543,7 @@ void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint
} }
// call functions which may have additional effects after chainging state of unit // call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
} }
void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1557,7 +1557,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
if (apply) if (apply)
{ {
// apply glow vision // apply glow vision
if (target->GetTypeId() == TYPEID_PLAYER && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10)) if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
target->m_invisibility.AddFlag(type); target->m_invisibility.AddFlag(type);
@@ -1569,7 +1569,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
{ {
// if not have different invisibility auras. // if not have different invisibility auras.
// always remove glow vision // always remove glow vision
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
target->m_invisibility.DelFlag(type); target->m_invisibility.DelFlag(type);
@@ -1592,7 +1592,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
// if not have invisibility auras of type INVISIBILITY_GENERAL // if not have invisibility auras of type INVISIBILITY_GENERAL
// remove glow vision // remove glow vision
if (target->GetTypeId() == TYPEID_PLAYER && !target->m_invisibility.HasFlag(INVISIBILITY_GENERAL) && !target->m_invisibility.HasFlag(INVISIBILITY_UNK10)) if (target->IsPlayer() && !target->m_invisibility.HasFlag(INVISIBILITY_GENERAL) && !target->m_invisibility.HasFlag(INVISIBILITY_UNK10))
{ {
target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
} }
@@ -1609,7 +1609,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
} }
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
target->bRequestForcedVisibilityUpdate = false; target->bRequestForcedVisibilityUpdate = false;
} }
@@ -1635,7 +1635,7 @@ void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mod
} }
// call functions which may have additional effects after chainging state of unit // call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
} }
void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1652,7 +1652,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
target->m_stealth.AddValue(type, GetAmount()); target->m_stealth.AddValue(type, GetAmount());
target->SetStandFlags(UNIT_STAND_FLAGS_CREEP); target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH); target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH);
// interrupt autoshot // interrupt autoshot
@@ -1671,7 +1671,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
target->m_stealth.DelFlag(type); target->m_stealth.DelFlag(type);
target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH); target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH);
} }
} }
@@ -1683,7 +1683,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
} }
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
target->bRequestForcedVisibilityUpdate = false; target->bRequestForcedVisibilityUpdate = false;
} }
@@ -1701,7 +1701,7 @@ void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode
target->m_stealth.AddValue(type, -GetAmount()); target->m_stealth.AddValue(type, -GetAmount());
// call functions which may have additional effects after chainging state of unit // call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer());
} }
void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -2065,7 +2065,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
Rage_val += aurEff->GetAmount() * 10; Rage_val += aurEff->GetAmount() * 10;
} }
// Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
// Stance mastery - trainer spell // Stance mastery - trainer spell
PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
@@ -2104,7 +2104,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// add/remove the shapeshift aura's boosts // add/remove the shapeshift aura's boosts
HandleShapeshiftBoosts(target, apply); HandleShapeshiftBoosts(target, apply);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->InitDataForForm(); target->ToPlayer()->InitDataForForm();
if (target->IsClass(CLASS_DRUID, CLASS_CONTEXT_ABILITY)) if (target->IsClass(CLASS_DRUID, CLASS_CONTEXT_ABILITY))
@@ -2142,7 +2142,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (apply && aurApp->GetRemoveMode()) if (apply && aurApp->GetRemoveMode())
return; return;
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
// Learn spells for shapeshift form - no need to send action bars or add spells to spellbook // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
@@ -2730,7 +2730,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
target->setTransForm(GetId()); target->setTransForm(GetId());
// polymorph case // polymorph case
if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed()) if ((mode & AURA_EFFECT_HANDLE_REAL) && target->IsPlayer() && target->IsPolymorphed())
{ {
// for players, start regeneration after 1s (in polymorph fast regeneration case) // for players, start regeneration after 1s (in polymorph fast regeneration case)
// only if caster is Player (after patch 2.4.2) // only if caster is Player (after patch 2.4.2)
@@ -2991,7 +2991,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
target->RemoveFlag(field, flag); target->RemoveFlag(field, flag);
// Handle damage modification, shapeshifted druids are not affected // Handle damage modification, shapeshifted druids are not affected
if (target->GetTypeId() == TYPEID_PLAYER && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF)) if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF))
{ {
if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{ {
@@ -3087,7 +3087,7 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (apply) if (apply)
target->ToPlayer()->SetPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY); target->ToPlayer()->SetPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY);
@@ -3174,7 +3174,7 @@ void AuraEffect::HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode,
} }
// call functions which may have additional effects after chainging state of unit // call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER); target->UpdateObjectVisibility(target->IsPlayer());
} }
void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -3366,7 +3366,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode
target->SetFeatherFall(apply); target->SetFeatherFall(apply);
// start fall from current height // start fall from current height
if (!apply && target->GetTypeId() == TYPEID_PLAYER) if (!apply && target->IsPlayer())
target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ()); target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
} }
@@ -3400,7 +3400,7 @@ void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode,
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
// update timers in client // update timers in client
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->UpdateMirrorTimers(); target->ToPlayer()->UpdateMirrorTimers();
} }
@@ -3526,7 +3526,7 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode,
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
// Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health. // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
if (target->GetTypeId() == TYPEID_PLAYER || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR)) if (target->IsPlayer() || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
return; return;
/// @todo: find a way to cancel fleeing for assistance. /// @todo: find a way to cancel fleeing for assistance.
/// Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards. /// Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards.
@@ -3733,7 +3733,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
if (mode & AURA_EFFECT_HANDLE_REAL) if (mode & AURA_EFFECT_HANDLE_REAL)
{ {
//Players on flying mounts must be immune to polymorph //Players on flying mounts must be immune to polymorph
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied) // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
@@ -4327,7 +4327,7 @@ void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const* aurApp,
{ {
float value = float(GetAmount() - amount); float value = float(GetAmount() - amount);
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, value, apply);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply); target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
} }
} }
@@ -4346,7 +4346,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mo
if (GetMiscValue() & int32(1 << x)) if (GetMiscValue() & int32(1 << x))
{ {
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply); target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) if (target->IsPlayer() || target->IsPet())
target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply); target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
} }
} }
@@ -4379,7 +4379,7 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8
if (GetMiscValue() & int32(1 << i)) if (GetMiscValue() & int32(1 << i))
{ {
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply); target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) if (target->IsPlayer() || target->IsPet())
{ {
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
@@ -4413,11 +4413,11 @@ void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8
// applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
// show armor penetration // show armor penetration
if (target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)) if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, GetAmount(), apply); target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, GetAmount(), apply);
// show as spell penetration only full spell penetration bonuses (all resistances except armor and holy // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
if (target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_SPELL) == SPELL_SCHOOL_MASK_SPELL) if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_SPELL) == SPELL_SCHOOL_MASK_SPELL)
target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, GetAmount(), apply); target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, GetAmount(), apply);
} }
@@ -4445,7 +4445,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
{ {
//target->ApplyStatMod(Stats(i), m_amount, apply); //target->ApplyStatMod(Stats(i), m_amount, apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) if (target->IsPlayer() || target->IsPet())
target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply); target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
} }
} }
@@ -4575,12 +4575,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
{ {
if (i == STAT_STRENGTH || i == STAT_STAMINA) if (i == STAT_STRENGTH || i == STAT_STAMINA)
{ {
if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) if (apply && (target->IsPlayer() || target->IsPet()))
target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->ApplyStatPercentBuffMod(Stats(i), value, apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) if (!apply && (target->IsPlayer() || target->IsPet()))
target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->ApplyStatPercentBuffMod(Stats(i), value, apply);
} }
} }
@@ -4591,12 +4591,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
{ {
if (GetMiscValue() == i || GetMiscValue() == -1) if (GetMiscValue() == i || GetMiscValue() == -1)
{ {
if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) if (apply && (target->IsPlayer() || target->IsPet()))
target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->ApplyStatPercentBuffMod(Stats(i), value, apply);
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply);
if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) if (!apply && (target->IsPlayer() || target->IsPet()))
target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->ApplyStatPercentBuffMod(Stats(i), value, apply);
} }
} }
@@ -4892,7 +4892,7 @@ void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, b
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
target->ToPlayer()->UpdateMeleeHitChances(); target->ToPlayer()->UpdateMeleeHitChances();
target->ToPlayer()->UpdateRangedHitChances(); target->ToPlayer()->UpdateRangedHitChances();
@@ -4911,7 +4911,7 @@ void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mo
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->UpdateSpellHitChances(); target->ToPlayer()->UpdateSpellHitChances();
else else
target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount()); target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
@@ -4924,7 +4924,7 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 m
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->UpdateAllSpellCritChances(); target->ToPlayer()->UpdateAllSpellCritChances();
else else
target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
@@ -5152,7 +5152,7 @@ void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication con
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
// Recalculate bonus // Recalculate bonus
if (target->GetTypeId() == TYPEID_PLAYER && !(target->getClassMask() & CLASSMASK_WAND_USERS)) if (target->IsPlayer() && !(target->getClassMask() & CLASSMASK_WAND_USERS))
target->ToPlayer()->UpdateAttackPowerAndDamage(true); target->ToPlayer()->UpdateAttackPowerAndDamage(true);
} }
@@ -5169,7 +5169,7 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const* aurApp,
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
// Recalculate bonus // Recalculate bonus
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->UpdateAttackPowerAndDamage(false); target->ToPlayer()->UpdateAttackPowerAndDamage(false);
} }
/********************************/ /********************************/
@@ -5183,7 +5183,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
// apply item specific bonuses for already equipped weapon // apply item specific bonuses for already equipped weapon
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
for (int i = 0; i < MAX_ATTACK; ++i) for (int i = 0; i < MAX_ATTACK; ++i)
if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true)) if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
@@ -5208,7 +5208,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (GetAmount() > 0) if (GetAmount() > 0)
target->ApplyModInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, GetAmount(), apply); target->ApplyModInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, GetAmount(), apply);
@@ -5237,7 +5237,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
// Magic damage modifiers implemented in Unit::SpellDamageBonus // Magic damage modifiers implemented in Unit::SpellDamageBonus
// This information for client side use only // This information for client side use only
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (GetAmount() > 0) if (GetAmount() > 0)
{ {
@@ -5272,7 +5272,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply)) if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply))
return; return;
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
for (int i = 0; i < MAX_ATTACK; ++i) for (int i = 0; i < MAX_ATTACK; ++i)
if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false)) if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
@@ -5285,7 +5285,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply);
target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetAmount()), apply);
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float (GetAmount()), apply); target->ToPlayer()->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float (GetAmount()), apply);
} }
else else
@@ -5315,7 +5315,7 @@ void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mod
if (GetAuraType() == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT) if (GetAuraType() == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT)
modType = PCT_MOD; modType = PCT_MOD;
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply); target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
} }
@@ -5513,7 +5513,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->GetMotionMaster()->MoveFall(); target->GetMotionMaster()->MoveFall();
break; break;
case 46699: // Requires No Ammo case 46699: // Requires No Ammo
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
break; break;
case 71563: case 71563:
@@ -5599,7 +5599,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{ {
case 2584: // Waiting to Resurrect case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue // Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (Battleground* bg = target->ToPlayer()->GetBattleground()) if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->ToPlayer()); bg->RemovePlayerFromResurrectQueue(target->ToPlayer());
@@ -5646,7 +5646,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601) if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601)
{ {
auto caster2 = GetBase()->GetCaster(); auto caster2 = GetBase()->GetCaster();
if (caster2 && caster2->GetTypeId() == TYPEID_PLAYER) if (caster2 && caster2->IsPlayer())
{ {
caster2->ToPlayer()->KilledMonsterCredit(25987); caster2->ToPlayer()->KilledMonsterCredit(25987);
} }
@@ -5744,7 +5744,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
} }
// LK Intro VO (1) // LK Intro VO (1)
case 58204: case 58204:
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
// Play part 1 // Play part 1
if (apply) if (apply)
@@ -5756,7 +5756,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break; break;
// LK Intro VO (2) // LK Intro VO (2)
case 58205: case 58205:
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
// Play part 2 // Play part 2
if (apply) if (apply)
@@ -5987,13 +5987,13 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode,
if (apply) if (apply)
{ {
target->SetFaction(GetMiscValue()); target->SetFaction(GetMiscValue());
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); target->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
} }
else else
{ {
target->RestoreFaction(); target->RestoreFaction();
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); target->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
} }
} }
@@ -6366,7 +6366,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
case 30427: case 30427:
{ {
// move loot to player inventory and despawn target // move loot to player inventory and despawn target
if (caster && caster->GetTypeId() == TYPEID_PLAYER && if (caster && caster->IsPlayer() &&
target->GetTypeId() == TYPEID_UNIT && target->GetTypeId() == TYPEID_UNIT &&
target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD) target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD)
{ {
@@ -7134,7 +7134,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
{ {
Powers PowerType = Powers(GetMiscValue()); Powers PowerType = Powers(GetMiscValue());
if (target->GetTypeId() == TYPEID_PLAYER && !target->HasActivePowerType(PowerType) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) if (target->IsPlayer() && !target->HasActivePowerType(PowerType) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
return; return;
if (!target->IsAlive() || !target->GetMaxPower(PowerType)) if (!target->IsAlive() || !target->GetMaxPower(PowerType))
+7 -7
View File
@@ -486,7 +486,7 @@ AuraObjectType Aura::GetType() const
return UNIT_AURA_TYPE; return UNIT_AURA_TYPE;
} }
return (m_owner->GetTypeId() == TYPEID_DYNAMICOBJECT) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE; return (m_owner->IsDynamicObject()) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE;
} }
void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp) void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
@@ -559,7 +559,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp
} }
} }
if (caster && caster->GetTypeId() == TYPEID_PLAYER) if (caster && caster->IsPlayer())
{ {
if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid) if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
{ {
@@ -1350,7 +1350,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId()) switch (GetId())
{ {
case 32474: // Buffeting Winds of Susurrus case 32474: // Buffeting Winds of Susurrus
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->ActivateTaxiPathTo(506, GetId()); target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
break; break;
case 33572: // Gronn Lord's Grasp, becomes stoned case 33572: // Gronn Lord's Grasp, becomes stoned
@@ -1362,7 +1362,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
target->CastSpell(target, 50812, true); target->CastSpell(target, 50812, true);
break; break;
case 60970: // Heroic Fury (remove Intercept cooldown) case 60970: // Heroic Fury (remove Intercept cooldown)
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
target->ToPlayer()->RemoveSpellCooldown(20252, true); target->ToPlayer()->RemoveSpellCooldown(20252, true);
break; break;
} }
@@ -1587,7 +1587,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break; break;
case SPELLFAMILY_POTION: case SPELLFAMILY_POTION:
// Alchemy: Mixology // Alchemy: Mixology
if (caster && caster->HasAura(53042) && caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->GetSession()->PlayerLoading()) if (caster && caster->HasAura(53042) && caster->IsPlayer() && !caster->ToPlayer()->GetSession()->PlayerLoading())
{ {
if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/ if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/
{ {
@@ -1726,7 +1726,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (Aura const* aura = caster->GetAuraOfRankedSpell(47535)) if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
{ {
// check cooldown // check cooldown
if (caster->GetTypeId() == TYPEID_PLAYER) if (caster->IsPlayer())
{ {
if (caster->ToPlayer()->HasSpellCooldown(aura->GetId())) if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
{ {
@@ -2266,7 +2266,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
// do that only for passive spells // do that only for passive spells
/// @todo: this needs to be unified for all kinds of auras /// @todo: this needs to be unified for all kinds of auras
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->EquippedItemClass != -1) if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1)
{ {
if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT)) if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT))
{ {
+75 -71
View File
@@ -481,7 +481,7 @@ void SpellCastTargets::Update(Unit* caster)
m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : nullptr; m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : nullptr;
m_itemTarget = nullptr; m_itemTarget = nullptr;
if (caster->GetTypeId() == TYPEID_PLAYER) if (caster->IsPlayer())
{ {
Player* player = caster->ToPlayer(); Player* player = caster->ToPlayer();
if (m_targetMask & TARGET_FLAG_ITEM) if (m_targetMask & TARGET_FLAG_ITEM)
@@ -609,7 +609,7 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
if (m_attackType == RANGED_ATTACK) if (m_attackType == RANGED_ATTACK)
// wand case // wand case
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->IsPlayer())
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK)) if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType); m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
@@ -2031,7 +2031,7 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
{ {
case SPELL_EFFECT_SUMMON_RAF_FRIEND: case SPELL_EFFECT_SUMMON_RAF_FRIEND:
case SPELL_EFFECT_SUMMON_PLAYER: case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetTarget()) if (m_caster->IsPlayer() && m_caster->ToPlayer()->GetTarget())
{ {
WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetTarget()); WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetTarget());
@@ -2718,7 +2718,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
m_needComboPoints = false; m_needComboPoints = false;
// Restore spell mods for a miss/dodge/parry Cold Blood // Restore spell mods for a miss/dodge/parry Cold Blood
/// @todo: check how broad this rule should be /// @todo: check how broad this rule should be
if (m_caster->GetTypeId() == TYPEID_PLAYER && (missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY)) if (m_caster->IsPlayer() && (missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY))
m_caster->ToPlayer()->RestoreSpellMods(this, 14177); m_caster->ToPlayer()->RestoreSpellMods(this, 14177);
} }
@@ -2890,7 +2890,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
Unit::ProcDamageAndSpell(caster, unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell.spellInfo, Unit::ProcDamageAndSpell(caster, unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell.spellInfo,
m_triggeredByAuraSpell.effectIndex, this, &dmgInfo); m_triggeredByAuraSpell.effectIndex, this, &dmgInfo);
if (caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && if (caster->IsPlayer() && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 &&
m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
} }
@@ -2912,7 +2912,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Xinef: eg. rogue poisons can proc off cheap shot, etc. so this block should be here also // Xinef: eg. rogue poisons can proc off cheap shot, etc. so this block should be here also
// Xinef: ofc count only spells that HIT the target, little hack used to fool the system // Xinef: ofc count only spells that HIT the target, little hack used to fool the system
if ((procEx & PROC_EX_NORMAL_HIT || procEx & PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && if ((procEx & PROC_EX_NORMAL_HIT || procEx & PROC_EX_CRITICAL_HIT) && caster->IsPlayer() && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 &&
m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim | PROC_FLAG_TAKEN_DAMAGE, procEx); caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim | PROC_FLAG_TAKEN_DAMAGE, procEx);
} }
@@ -2985,7 +2985,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// if target is fallged for pvp also flag caster if a player // if target is fallged for pvp also flag caster if a player
// xinef: do not flag spells with aura bind sight (no special attribute) // xinef: do not flag spells with aura bind sight (no special attribute)
if (effectUnit->IsPvP() && effectUnit != m_caster && effectUnit->GetOwnerGUID() != m_caster->GetGUID() && if (effectUnit->IsPvP() && effectUnit != m_caster && effectUnit->GetOwnerGUID() != m_caster->GetGUID() &&
m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) m_caster->IsPlayer() && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG))
{ {
m_caster->ToPlayer()->UpdatePvP(true); m_caster->ToPlayer()->UpdatePvP(true);
} }
@@ -3033,14 +3033,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
if (!effectMask) if (!effectMask)
return returnVal; return returnVal;
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
{ {
unit->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id); unit->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id);
unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster); unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster);
unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id, 0, m_caster); unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id, 0, m_caster);
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
m_caster->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id); m_caster->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id);
m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
@@ -3067,14 +3067,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
{ {
// for delayed spells ignore negative spells (after duel end) for friendly targets // for delayed spells ignore negative spells (after duel end) for friendly targets
/// @todo: this cause soul transfer bugged /// @todo: this cause soul transfer bugged
if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->IsPlayer() && !m_spellInfo->IsPositive())
return SPELL_MISS_EVADE; return SPELL_MISS_EVADE;
// assisting case, healing and resurrection // assisting case, healing and resurrection
if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER))
{ {
m_caster->SetContestedPvP(); m_caster->SetContestedPvP();
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) if (m_caster->IsPlayer() && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG))
m_caster->ToPlayer()->UpdatePvP(true); m_caster->ToPlayer()->UpdatePvP(true);
} }
@@ -3549,7 +3549,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
// for example bladestorm aura should be removed on disarm as of patch 3.3.5 // for example bladestorm aura should be removed on disarm as of patch 3.3.5
// channeled periodic spells should be affected by this (arcane missiles, penance, etc) // channeled periodic spells should be affected by this (arcane missiles, penance, etc)
// a possible alternative sollution for those would be validating aura target on unit state change // a possible alternative sollution for those would be validating aura target on unit state change
if (m_caster->GetTypeId() == TYPEID_PLAYER && triggeredByAura && triggeredByAura->IsPeriodic() && !triggeredByAura->GetBase()->IsPassive()) if (m_caster->IsPlayer() && triggeredByAura && triggeredByAura->IsPeriodic() && !triggeredByAura->GetBase()->IsPassive())
{ {
SendChannelUpdate(0); SendChannelUpdate(0);
triggeredByAura->GetBase()->SetDuration(0); triggeredByAura->GetBase()->SetDuration(0);
@@ -3571,13 +3571,13 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = HasTriggeredCastFlag(TRIGGERED_CAST_DIRECTLY) ? 0 : m_spellInfo->CalcCastTime(m_caster, this); m_casttime = HasTriggeredCastFlag(TRIGGERED_CAST_DIRECTLY) ? 0 : m_spellInfo->CalcCastTime(m_caster, this);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME)) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
m_casttime = 0; m_casttime = 0;
// don't allow channeled spells / spells with cast time to be casted while moving // don't allow channeled spells / spells with cast time to be casted while moving
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT && !IsTriggered()) if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->IsPlayer() && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT && !IsTriggered())
{ {
// 1. Has casttime, 2. Or doesn't have flag to allow action during channel // 1. Has casttime, 2. Or doesn't have flag to allow action during channel
if (m_casttime || !m_spellInfo->IsActionAllowedChannel()) if (m_casttime || !m_spellInfo->IsActionAllowedChannel())
@@ -3722,7 +3722,7 @@ void Spell::cancel(bool bySelf)
CancelGlobalCooldown(); CancelGlobalCooldown();
SendCastResult(SPELL_FAILED_INTERRUPTED); SendCastResult(SPELL_FAILED_INTERRUPTED);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (m_caster->ToPlayer()->NeedSendSpectatorData()) if (m_caster->ToPlayer()->NeedSendSpectatorData())
ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
@@ -3739,15 +3739,14 @@ void Spell::cancel(bool bySelf)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID)) if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL); unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer() && m_spellInfo->IsCooldownStartedOnEvent())
if (m_spellInfo->HasAttribute(SPELL_ATTR0_COOLDOWN_ON_EVENT))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
SendChannelUpdate(0); SendChannelUpdate(0);
SendInterrupted(SPELL_FAILED_INTERRUPTED); SendInterrupted(SPELL_FAILED_INTERRUPTED);
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) if (m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData())
ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
// spell is canceled-take mods and clear list // spell is canceled-take mods and clear list
@@ -3816,7 +3815,7 @@ void Spell::_cast(bool skipCheck)
// Xinef: implement attribute SPELL_ATTR1_DISMISS_PET_FIRST, on spell cast current pet is dismissed and charms are removed // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET_FIRST, on spell cast current pet is dismissed and charms are removed
if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET_FIRST)) if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET_FIRST))
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET)) if (m_caster->IsPlayer() && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET))
if (Pet* pet = m_caster->ToPlayer()->GetPet()) if (Pet* pet = m_caster->ToPlayer()->GetPet())
m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_AS_CURRENT); m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_AS_CURRENT);
@@ -3869,7 +3868,7 @@ void Spell::_cast(bool skipCheck)
// if trade not complete then remember it in trade data // if trade not complete then remember it in trade data
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM) if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData()) if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData())
{ {
@@ -3921,7 +3920,7 @@ void Spell::_cast(bool skipCheck)
// set to real guid to be sent later to the client // set to real guid to be sent later to the client
m_targets.UpdateTradeSlotItem(); m_targets.UpdateTradeSlotItem();
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CAST_ITEM) && m_CastItem) if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CAST_ITEM) && m_CastItem)
{ {
@@ -4092,11 +4091,11 @@ void Spell::_cast(bool skipCheck)
// xinef: start combat at cast for delayed spells, only for explicit target // xinef: start combat at cast for delayed spells, only for explicit target
if (Unit* target = m_targets.GetUnitTarget()) if (Unit* target = m_targets.GetUnitTarget())
if (m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->IsPet() && m_caster->IsControlledByPlayer())) if (m_caster->IsPlayer() || (m_caster->IsPet() && m_caster->IsControlledByPlayer()))
if (GetDelayMoment() > 0 && !m_caster->IsFriendlyTo(target) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) if (GetDelayMoment() > 0 && !m_caster->IsFriendlyTo(target) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
@@ -4300,7 +4299,7 @@ void Spell::_handle_finish_phase()
{ {
// Xinef: Properly clear infinite cooldowns in some cases // Xinef: Properly clear infinite cooldowns in some cases
if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE) if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->IsCooldownStartedOnEvent()) if (m_caster->IsPlayer() && m_spellInfo->IsCooldownStartedOnEvent())
m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo); m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo);
} }
@@ -4408,7 +4407,7 @@ void Spell::update(uint32 difftime)
// check if the player caster has moved before the spell finished // check if the player caster has moved before the spell finished
// xinef: added preparing state (real cast, skip channels as they have other flags for this) // xinef: added preparing state (real cast, skip channels as they have other flags for this)
if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && if ((m_caster->IsPlayer() && m_timer != 0) &&
m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && m_spellState == SPELL_STATE_PREPARING && m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && m_spellState == SPELL_STATE_PREPARING &&
(m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))) (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)))
{ {
@@ -4486,7 +4485,7 @@ void Spell::finish(bool ok)
m_caster->ClearUnitState(UNIT_STATE_CASTING); m_caster->ClearUnitState(UNIT_STATE_CASTING);
// Unsummon summon as possessed creatures on spell cancel // Unsummon summon as possessed creatures on spell cancel
if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER) if (m_spellInfo->IsChanneled() && m_caster->IsPlayer())
{ {
if (Unit* charm = m_caster->GetCharm()) if (Unit* charm = m_caster->GetCharm())
if (charm->GetTypeId() == TYPEID_UNIT if (charm->GetTypeId() == TYPEID_UNIT
@@ -4498,9 +4497,14 @@ void Spell::finish(bool ok)
if (Creature* creatureCaster = m_caster->ToCreature()) if (Creature* creatureCaster = m_caster->ToCreature())
creatureCaster->ReleaseFocus(this); creatureCaster->ReleaseFocus(this);
if (!ok) if (ok)
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer() && m_spellInfo->IsChanneled() && m_spellInfo->IsCooldownStartedOnEvent())
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
}
else
{
if (m_caster->IsPlayer())
{ {
// Xinef: Restore spell mods in case of fail cast // Xinef: Restore spell mods in case of fail cast
m_caster->ToPlayer()->RestoreSpellMods(this); m_caster->ToPlayer()->RestoreSpellMods(this);
@@ -4530,7 +4534,7 @@ void Spell::finish(bool ok)
} }
// potions disabled by client, send event "not in combat" if need // potions disabled by client, send event "not in combat" if need
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell) if (m_caster->IsPlayer() && !m_triggeredByAuraSpell)
m_caster->ToPlayer()->UpdatePotionCooldown(this); m_caster->ToPlayer()->UpdatePotionCooldown(this);
// Take mods after trigger spell (needed for 14177 to affect 48664) // Take mods after trigger spell (needed for 14177 to affect 48664)
@@ -4715,7 +4719,7 @@ void Spell::SendSpellStart()
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA)) if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE; castFlags |= CAST_FLAG_PROJECTILE;
if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet()) if (m_caster->IsPlayer() || m_caster->IsPet())
{ {
switch (m_spellInfo->PowerType) switch (m_spellInfo->PowerType)
{ {
@@ -4776,7 +4780,7 @@ void Spell::SendSpellStart()
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
if (!m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) if (!m_spellInfo->IsChanneled() && m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData())
ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, m_timer); ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, m_timer);
} }
@@ -4798,7 +4802,7 @@ void Spell::SendSpellGo()
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
// should only be sent to self, but the current messaging doesn't make that possible // should only be sent to self, but the current messaging doesn't make that possible
if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet()) if (m_caster->IsPlayer() || m_caster->IsPet())
{ {
switch (m_spellInfo->PowerType) switch (m_spellInfo->PowerType)
{ {
@@ -4816,7 +4820,7 @@ void Spell::SendSpellGo()
} }
} }
if ((m_caster->GetTypeId() == TYPEID_PLAYER) if ((m_caster->IsPlayer())
&& (m_caster->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY)) && (m_caster->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
&& m_spellInfo->RuneCostID && m_spellInfo->RuneCostID
&& m_spellInfo->PowerType == POWER_RUNE) && m_spellInfo->PowerType == POWER_RUNE)
@@ -4916,7 +4920,7 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
uint32 ammoInventoryType = 0; uint32 ammoInventoryType = 0;
uint32 ammoDisplayID = 0; uint32 ammoDisplayID = 0;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
if (pItem) if (pItem)
@@ -5203,7 +5207,7 @@ void Spell::SendChannelStart(uint32 duration)
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) if (m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData())
ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, -((int32)duration)); ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, -((int32)duration));
m_timer = duration; m_timer = duration;
@@ -5217,7 +5221,7 @@ void Spell::SendResurrectRequest(Player* target)
{ {
// get resurrector name for creature resurrections, otherwise packet will be not accepted // get resurrector name for creature resurrections, otherwise packet will be not accepted
// for player resurrections the name is looked up by guid // for player resurrections the name is looked up by guid
std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER std::string const sentName(m_caster->IsPlayer()
? "" ? ""
: m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex())); : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()));
@@ -5228,7 +5232,7 @@ void Spell::SendResurrectRequest(Player* target)
data << sentName; data << sentName;
data << uint8(0); // null terminator data << uint8(0); // null terminator
data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); // "you'll be afflicted with resurrection sickness" data << uint8(m_caster->IsPlayer() ? 0 : 1); // "you'll be afflicted with resurrection sickness"
// override delay sent with SMSG_CORPSE_RECLAIM_DELAY, set instant resurrection for spells with this attribute // override delay sent with SMSG_CORPSE_RECLAIM_DELAY, set instant resurrection for spells with this attribute
if (m_spellInfo->HasAttribute(SPELL_ATTR3_NO_RES_TIMER)) if (m_spellInfo->HasAttribute(SPELL_ATTR3_NO_RES_TIMER))
data << uint32(0); data << uint32(0);
@@ -5304,13 +5308,13 @@ void Spell::TakePower()
return; return;
//Don't take power if the spell is cast while .cheat power is enabled. //Don't take power if the spell is cast while .cheat power is enabled.
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER)) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
return; return;
Powers PowerType = Powers(m_spellInfo->PowerType); Powers PowerType = Powers(m_spellInfo->PowerType);
bool hit = true; bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (PowerType == POWER_RAGE || PowerType == POWER_ENERGY || PowerType == POWER_RUNE || PowerType == POWER_RUNIC_POWER) if (PowerType == POWER_RAGE || PowerType == POWER_ENERGY || PowerType == POWER_RUNE || PowerType == POWER_RUNIC_POWER)
if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID()) if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID())
@@ -5364,7 +5368,7 @@ void Spell::TakePower()
void Spell::TakeAmmo() void Spell::TakeAmmo()
{ {
if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) if (m_attackType == RANGED_ATTACK && m_caster->IsPlayer())
{ {
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
@@ -5643,7 +5647,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_CASTER_DEAD; return SPELL_FAILED_CASTER_DEAD;
// Spectator check // Spectator check
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (((Player const*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT) if (((Player const*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT)
return SPELL_FAILED_NOT_HERE; return SPELL_FAILED_NOT_HERE;
@@ -5657,7 +5661,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// check cooldowns to prevent cheating // check cooldowns to prevent cheating
if (!m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE)) if (!m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE))
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
//can cast triggered (by aura only?) spells while have this flag //can cast triggered (by aura only?) spells while have this flag
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY) && !IsNextMeleeSwingSpell()) if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY) && !IsNextMeleeSwingSpell())
@@ -5690,12 +5694,12 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NOT_READY; return SPELL_FAILED_NOT_READY;
// only triggered spells can be processed an ended battleground // only triggered spells can be processed an ended battleground
if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_PLAYER) if (!IsTriggered() && m_caster->IsPlayer())
if (Battleground* bg = m_caster->ToPlayer()->GetBattleground()) if (Battleground* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() == STATUS_WAIT_LEAVE) if (bg->GetStatus() == STATUS_WAIT_LEAVE)
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
if (m_caster->GetTypeId() == TYPEID_PLAYER /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented) if (m_caster->IsPlayer() /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented)
{ {
if (m_spellInfo->HasAttribute(SPELL_ATTR0_ONLY_OUTDOORS) && if (m_spellInfo->HasAttribute(SPELL_ATTR0_ONLY_OUTDOORS) &&
!m_caster->IsOutdoors()) !m_caster->IsOutdoors())
@@ -5774,7 +5778,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Xinef: exploit protection // Xinef: exploit protection
if (reqCombat && !m_spellInfo->CanBeUsedInCombat() && (m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT) || m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT_NEW))) if (reqCombat && !m_spellInfo->CanBeUsedInCombat() && (m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT) || m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT_NEW)))
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetMap()->IsDungeon()) if (m_caster->IsPlayer() && m_caster->GetMap()->IsDungeon())
if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) if (InstanceScript* instanceScript = m_caster->GetInstanceScript())
if (instanceScript->IsEncounterInProgress()) if (instanceScript->IsEncounterInProgress())
{ {
@@ -5795,7 +5799,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// cancel autorepeat spells if cast start when moving // cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() && !IsTriggered()) if (m_caster->IsPlayer() && m_caster->ToPlayer()->isMoving() && !IsTriggered())
{ {
// skip stuck spell to allow use it in falling case and apply spell limitations at movement // skip stuck spell to allow use it in falling case and apply spell limitations at movement
if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) && if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) &&
@@ -5828,7 +5832,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// All creatures should be able to cast as passengers freely, restriction and attribute are only for players // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(m_caster); VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(m_caster);
if (!m_spellInfo->HasAttribute(SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE) && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED) if (!m_spellInfo->HasAttribute(SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE) && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED)
&& (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->GetTypeId() == TYPEID_PLAYER) && (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->IsPlayer())
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
} }
@@ -5968,7 +5972,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
} }
// Spell casted only on battleground // Spell casted only on battleground
if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_BATTLEGROUNDS) && m_caster->GetTypeId() == TYPEID_PLAYER) if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_BATTLEGROUNDS) && m_caster->IsPlayer())
if (!m_caster->ToPlayer()->InBattleground()) if (!m_caster->ToPlayer()->InBattleground())
return SPELL_FAILED_ONLY_BATTLEGROUNDS; return SPELL_FAILED_ONLY_BATTLEGROUNDS;
@@ -5988,13 +5992,13 @@ SpellCastResult Spell::CheckCast(bool strict)
m_caster->GetZoneAndAreaId(zone, area); m_caster->GetZoneAndAreaId(zone, area);
SpellCastResult locRes = m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area, SpellCastResult locRes = m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area,
m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : nullptr); m_caster->IsPlayer() ? m_caster->ToPlayer() : nullptr);
if (locRes != SPELL_CAST_OK) if (locRes != SPELL_CAST_OK)
return locRes; return locRes;
} }
// not let players cast spells at mount (and let do it to creatures) // not let players cast spells at mount (and let do it to creatures)
if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE) && if (m_caster->IsMounted() && m_caster->IsPlayer() && !HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE) &&
!m_spellInfo->IsPassive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED)) !m_spellInfo->IsPassive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
{ {
if (m_caster->IsInFlight()) if (m_caster->IsInFlight())
@@ -6189,7 +6193,7 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_POWER_DRAIN: case SPELL_EFFECT_POWER_DRAIN:
{ {
// Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (Unit* target = m_targets.GetUnitTarget()) if (Unit* target = m_targets.GetUnitTarget())
if (target != m_caster && !target->HasActivePowerType(Powers(m_spellInfo->Effects[i].MiscValue))) if (target != m_caster && !target->HasActivePowerType(Powers(m_spellInfo->Effects[i].MiscValue)))
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
@@ -6216,7 +6220,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_ROOTED; return SPELL_FAILED_ROOTED;
} }
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (Unit* target = m_targets.GetUnitTarget()) if (Unit* target = m_targets.GetUnitTarget())
if (!target->IsAlive()) if (!target->IsAlive())
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
@@ -6426,7 +6430,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_ALREADY_HAVE_CHARM; return SPELL_FAILED_ALREADY_HAVE_CHARM;
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET) && strict) if (m_caster->IsPlayer() && m_caster->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET) && strict)
if (Pet* pet = m_caster->ToPlayer()->GetPet()) if (Pet* pet = m_caster->ToPlayer()->GetPet())
pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player) pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
@@ -6526,7 +6530,7 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER: case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER:
{ {
//Do not allow to cast it before BG starts. //Do not allow to cast it before BG starts.
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground()) if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() != STATUS_IN_PROGRESS) if (bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN; return SPELL_FAILED_TRY_AGAIN;
@@ -6560,7 +6564,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{ {
if (m_caster->HasUnitState(UNIT_STATE_ROOT)) if (m_caster->HasUnitState(UNIT_STATE_ROOT))
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
return SPELL_FAILED_ROOTED; return SPELL_FAILED_ROOTED;
else else
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
@@ -6579,7 +6583,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!sScriptMgr->CanSelectSpecTalent(this)) if (!sScriptMgr->CanSelectSpecTalent(this))
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
// can't change during already started arena/battleground // can't change during already started arena/battleground
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground()) if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() == STATUS_IN_PROGRESS) if (bg->GetStatus() == STATUS_IN_PROGRESS)
return SPELL_FAILED_NOT_IN_BATTLEGROUND; return SPELL_FAILED_NOT_IN_BATTLEGROUND;
@@ -6665,7 +6669,7 @@ SpellCastResult Spell::CheckCast(bool strict)
InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId()); InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId());
if (it) if (it)
allowMount = it->AllowMount; allowMount = it->AllowMount;
if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId) if (m_caster->IsPlayer() && !allowMount && !m_spellInfo->AreaGroupId)
return SPELL_FAILED_NO_MOUNTS_ALLOWED; return SPELL_FAILED_NO_MOUNTS_ALLOWED;
if (m_caster->IsInDisallowedMountForm()) if (m_caster->IsInDisallowedMountForm())
@@ -6700,7 +6704,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// not allow cast fly spells if not have req. skills (all spells is self target) // not allow cast fly spells if not have req. skills (all spells is self target)
// allow always ghost flight spells // allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive()) if (m_originalCaster && m_originalCaster->IsPlayer() && m_originalCaster->IsAlive())
{ {
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
if (AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId())) if (AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId()))
@@ -7088,7 +7092,7 @@ SpellCastResult Spell::CheckRange(bool strict)
return SPELL_FAILED_TOO_CLOSE; return SPELL_FAILED_TOO_CLOSE;
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target)) if (m_caster->IsPlayer() && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target))
return SPELL_FAILED_UNIT_NOT_INFRONT; return SPELL_FAILED_UNIT_NOT_INFRONT;
} }
@@ -7123,7 +7127,7 @@ SpellCastResult Spell::CheckPower()
return SPELL_CAST_OK; return SPELL_CAST_OK;
//While .cheat power is enabled dont check if we need power to cast the spell //While .cheat power is enabled dont check if we need power to cast the spell
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER)) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
{ {
@@ -7264,7 +7268,7 @@ SpellCastResult Spell::CheckItems()
{ {
// Xinef: this is not true in my opinion, in eg bladestorm will not be canceled after disarm // Xinef: this is not true in my opinion, in eg bladestorm will not be canceled after disarm
//if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT)) //if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT))
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo)) if (m_caster->IsPlayer() && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS; return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
} }
@@ -7358,7 +7362,7 @@ SpellCastResult Spell::CheckItems()
{ {
// m_targets.GetUnitTarget() means explicit cast, otherwise we dont check for possible equip error // m_targets.GetUnitTarget() means explicit cast, otherwise we dont check for possible equip error
Unit* target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : player; Unit* target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : player;
if (target->GetTypeId() == TYPEID_PLAYER && !IsTriggered()) if (target->IsPlayer() && !IsTriggered())
{ {
// SPELL_EFFECT_CREATE_ITEM_2 differs from SPELL_EFFECT_CREATE_ITEM in that it picks the random item to create from a pool of potential items, // SPELL_EFFECT_CREATE_ITEM_2 differs from SPELL_EFFECT_CREATE_ITEM in that it picks the random item to create from a pool of potential items,
// so we need to make sure there is at least one free space in the player's inventory // so we need to make sure there is at least one free space in the player's inventory
@@ -7855,7 +7859,7 @@ bool Spell::UpdatePointers()
m_originalCaster = nullptr; m_originalCaster = nullptr;
} }
if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER) if (m_castItemGUID && m_caster->IsPlayer())
{ {
m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID); m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID);
// cast item not found, somehow the item is no longer where we expected // cast item not found, somehow the item is no longer where we expected
@@ -8118,7 +8122,7 @@ SpellEvent::~SpellEvent()
else else
{ {
LOG_ERROR("spells", "~SpellEvent: {} {} tried to delete non-deletable spell {}. Was not deleted, causes memory leak.", LOG_ERROR("spells", "~SpellEvent: {} {} tried to delete non-deletable spell {}. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString(), m_Spell->m_spellInfo->Id); (m_Spell->GetCaster()->IsPlayer() ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString(), m_Spell->m_spellInfo->Id);
ABORT(); ABORT();
} }
} }
@@ -8308,7 +8312,7 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsTargetingArea() || (m_spellInfo->Effects[i].ChainTarget > 1 && m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC)) if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsTargetingArea() || (m_spellInfo->Effects[i].ChainTarget > 1 && m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC))
{ {
m_damage = unit->CalculateAOEDamageReduction(m_damage, m_spellInfo->SchoolMask, m_caster); m_damage = unit->CalculateAOEDamageReduction(m_damage, m_spellInfo->SchoolMask, m_caster);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
uint32 targetAmount = m_UniqueTargetInfo.size(); uint32 targetAmount = m_UniqueTargetInfo.size();
if (targetAmount > 10) if (targetAmount > 10)
@@ -8817,7 +8821,7 @@ bool Spell::HasGlobalCooldown() const
// Only player or controlled units have global cooldown // Only player or controlled units have global cooldown
if (m_caster->GetCharmInfo()) if (m_caster->GetCharmInfo())
return m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo); return m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
else if (m_caster->GetTypeId() == TYPEID_PLAYER) else if (m_caster->IsPlayer())
return m_caster->ToPlayer()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo); return m_caster->ToPlayer()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
else else
return false; return false;
@@ -8835,7 +8839,7 @@ void Spell::TriggerGlobalCooldown()
return; return;
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
return; return;
@@ -8845,7 +8849,7 @@ void Spell::TriggerGlobalCooldown()
if (m_spellInfo->StartRecoveryTime >= MIN_GCD && m_spellInfo->StartRecoveryTime <= MAX_GCD) if (m_spellInfo->StartRecoveryTime >= MIN_GCD && m_spellInfo->StartRecoveryTime <= MAX_GCD)
{ {
// gcd modifier auras are applied only to own spells and only players have such mods // gcd modifier auras are applied only to own spells and only players have such mods
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this); m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this);
// Apply haste rating // Apply haste rating
@@ -8864,7 +8868,7 @@ void Spell::TriggerGlobalCooldown()
// Only players or controlled units have global cooldown // Only players or controlled units have global cooldown
if (m_caster->GetCharmInfo()) if (m_caster->GetCharmInfo())
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd); m_caster->GetCharmInfo()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
else if (m_caster->GetTypeId() == TYPEID_PLAYER) else if (m_caster->IsPlayer())
m_caster->ToPlayer()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd); m_caster->ToPlayer()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
} }
@@ -8880,7 +8884,7 @@ void Spell::CancelGlobalCooldown()
// Only players or controlled units have global cooldown // Only players or controlled units have global cooldown
if (m_caster->GetCharmInfo()) if (m_caster->GetCharmInfo())
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo); m_caster->GetCharmInfo()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
else if (m_caster->GetTypeId() == TYPEID_PLAYER) else if (m_caster->IsPlayer())
m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo); m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
} }
@@ -9035,7 +9039,7 @@ namespace Acore
if (!target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range)) if (!target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range))
return false; return false;
} }
else if (!target->IsInDist(_position, _range)) else if (!target->IsWithinDist3d(_position, _range))
return false; return false;
else if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsAvoidingAOE()) // pussywizard else if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsAvoidingAOE()) // pussywizard
return false; return false;
+31 -31
View File
@@ -283,7 +283,7 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/)
if (!unitTarget || !unitTarget->IsAlive() || unitTarget->HasAura(27827)) // Spirit of redemption doesn't make you death, but can cause infinite loops if (!unitTarget || !unitTarget->IsAlive() || unitTarget->HasAura(27827)) // Spirit of redemption doesn't make you death, but can cause infinite loops
return; return;
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
if (unitTarget->ToPlayer()->GetCommandStatus(CHEAT_GOD)) if (unitTarget->ToPlayer()->GetCommandStatus(CHEAT_GOD))
return; return;
@@ -473,7 +473,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
case SPELLFAMILY_DRUID: case SPELLFAMILY_DRUID:
{ {
// Ferocious Bite // Ferocious Bite
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0] == 6587) if (m_caster->IsPlayer() && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0] == 6587)
{ {
// converts each extra point of energy into ($f1+$AP/410) additional damage // converts each extra point of energy into ($f1+$AP/410) additional damage
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
@@ -545,7 +545,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Eviscerate // Eviscerate
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00020000) else if (m_spellInfo->SpellFamilyFlags[0] & 0x00020000)
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (uint32 combo = m_caster->ToPlayer()->GetComboPoints()) if (uint32 combo = m_caster->ToPlayer()->GetComboPoints())
{ {
@@ -712,7 +712,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
// HoL, Arc Weld // HoL, Arc Weld
case 59086: case 59086:
{ {
if( m_caster && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) if( m_caster && m_caster->IsPlayer() && m_caster->ToPlayer()->isMoving() )
m_caster->CastSpell(m_caster, 59097, true); m_caster->CastSpell(m_caster, 59097, true);
return; return;
@@ -934,7 +934,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
} }
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) if (m_caster->IsPlayer() && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory())
{ {
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
} }
@@ -988,7 +988,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
} }
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) if (m_caster->IsPlayer() && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory())
{ {
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
} }
@@ -1085,7 +1085,7 @@ void Spell::EffectJump(SpellEffIndex effIndex)
CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(unitTarget), speedXY, speedZ); CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(unitTarget), speedXY, speedZ);
m_caster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ); m_caster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
@@ -1124,7 +1124,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
player->SetCanTeleport(true); player->SetCanTeleport(true);
} }
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
@@ -1148,7 +1148,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
} }
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
@@ -1173,7 +1173,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->IsInFlight()) if (!unitTarget || unitTarget->IsInFlight())
return; return;
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
} }
@@ -1215,13 +1215,13 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
unitTarget->GetVehicleKit()->TeleportVehicle(x, y, z, orientation); unitTarget->GetVehicleKit()->TeleportVehicle(x, y, z, orientation);
else else
{ {
bool withPet = unitTarget->GetTypeId() == TYPEID_PLAYER && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f; bool withPet = unitTarget->IsPlayer() && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f;
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster, false, withPet, true); unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster, false, withPet, true);
if (unitTarget->GetTypeId() == TYPEID_PLAYER) // pussywizard: for units it's done inside NearTeleportTo if (unitTarget->IsPlayer()) // pussywizard: for units it's done inside NearTeleportTo
unitTarget->UpdateObjectVisibility(true); unitTarget->UpdateObjectVisibility(true);
} }
} }
else if (unitTarget->GetTypeId() == TYPEID_PLAYER) else if (unitTarget->IsPlayer())
unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
else else
{ {
@@ -1878,7 +1878,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION if (unitTarget->IsPlayer() && !unitTarget->HasActivePowerType(power) && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION
&& !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
return; return;
@@ -1983,7 +1983,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue);
if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) if (unitTarget->IsPlayer() && !unitTarget->HasActivePowerType(power) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED))
return; return;
uint32 maxPower = unitTarget->GetMaxPower(power); uint32 maxPower = unitTarget->GetMaxPower(power);
@@ -2725,7 +2725,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return; return;
if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER) if (!unitTarget || m_caster->IsPlayer())
return; return;
if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster
@@ -3108,7 +3108,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
pet->InitTalentForLevel(); pet->InitTalentForLevel();
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->SavePetToDB(PET_SAVE_AS_CURRENT);
m_caster->ToPlayer()->PetSpellInitialize(); m_caster->ToPlayer()->PetSpellInitialize();
@@ -3187,7 +3187,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
return; return;
} }
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->IsPlayer())
owner->ToPlayer()->RemovePet(OldSummon, PET_SAVE_NOT_IN_SLOT, false); owner->ToPlayer()->RemovePet(OldSummon, PET_SAVE_NOT_IN_SLOT, false);
else else
return; return;
@@ -3367,7 +3367,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
AddComboPointGain(unitTarget, 1); AddComboPointGain(unitTarget, 1);
} }
// 50% more damage with daggers // 50% more damage with daggers
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true)) if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
if (item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) if (item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
AddPct(totalDamagePercentMod, 50.0f); AddPct(totalDamagePercentMod, 50.0f);
@@ -4018,7 +4018,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
if (m_spellInfo->Id != 59646) if (m_spellInfo->Id != 59646)
unitTarget->getHostileRefMgr().addThreatPercent(-100); unitTarget->getHostileRefMgr().addThreatPercent(-100);
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
unitTarget->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel unitTarget->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
} }
else else
@@ -4669,7 +4669,7 @@ void Spell::EffectParry(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return; return;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
m_caster->ToPlayer()->SetCanParry(true); m_caster->ToPlayer()->SetCanParry(true);
} }
@@ -4678,7 +4678,7 @@ void Spell::EffectBlock(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return; return;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
m_caster->ToPlayer()->SetCanBlock(true); m_caster->ToPlayer()->SetCanBlock(true);
} }
@@ -4949,7 +4949,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
@@ -5007,7 +5007,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
unitTarget->KnockbackFrom(x, y, speedxy, speedz); unitTarget->KnockbackFrom(x, y, speedxy, speedz);
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
} }
@@ -5026,13 +5026,13 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
//1891: Disengage //1891: Disengage
m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER); m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER);
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
// xinef: changes fall time // xinef: changes fall time
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ()); m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ());
} }
@@ -5125,7 +5125,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex)
unitTarget->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); unitTarget->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
{ {
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
} }
@@ -5421,7 +5421,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
} }
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
{ {
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
pGameObj->AddUniqueUse(m_caster->ToPlayer()); pGameObj->AddUniqueUse(m_caster->ToPlayer());
m_caster->AddGameObject(pGameObj); // will be removed at spell cancel m_caster->AddGameObject(pGameObj); // will be removed at spell cancel
@@ -5836,7 +5836,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
pet->InitTalentForLevel(); pet->InitTalentForLevel();
if (unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget->IsPlayer())
{ {
pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->SavePetToDB(PET_SAVE_AS_CURRENT);
unitTarget->ToPlayer()->PetSpellInitialize(); unitTarget->ToPlayer()->PetSpellInitialize();
@@ -5867,7 +5867,7 @@ void Spell::EffectTitanGrip(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return; return;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->IsPlayer())
{ {
if (Aura* aur = m_caster->GetAura(49152)) if (Aura* aur = m_caster->GetAura(49152))
aur->RecalculateAmountOfEffects(); aur->RecalculateAmountOfEffects();
@@ -5942,7 +5942,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
uint8 summonLevel = caster->GetLevel(); uint8 summonLevel = caster->GetLevel();
// level of pet summoned using engineering item based at engineering skill level // level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER) if (m_CastItem && caster->IsPlayer())
if (ItemTemplate const* proto = m_CastItem->GetTemplate()) if (ItemTemplate const* proto = m_CastItem->GetTemplate())
{ {
// xinef: few special cases // xinef: few special cases
+13 -4
View File
@@ -880,6 +880,15 @@ bool SpellInfo::HasEffect(SpellEffects effect) const
return false; return false;
} }
bool SpellInfo::HasEffectMechanic(Mechanics mechanic) const
{
for (auto const& effect : Effects)
if (effect.Mechanic == mechanic)
return true;
return false;
}
bool SpellInfo::HasAura(AuraType aura) const bool SpellInfo::HasAura(AuraType aura) const
{ {
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -1775,7 +1784,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (caster != unitTarget) if (caster != unitTarget)
{ {
if (caster->GetTypeId() == TYPEID_PLAYER) if (caster->IsPlayer())
{ {
// Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells) // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
if (AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED) if (AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED)
@@ -1871,14 +1880,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (!CheckTargetCreatureType(unitTarget)) if (!CheckTargetCreatureType(unitTarget))
{ {
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
return SPELL_FAILED_TARGET_IS_PLAYER; return SPELL_FAILED_TARGET_IS_PLAYER;
else else
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
} }
// check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER) if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->IsPlayer())
{ {
if (!unitTarget->ToPlayer()->IsVisible()) if (!unitTarget->ToPlayer()->IsVisible())
return SPELL_FAILED_BM_OR_INVISGOD; return SPELL_FAILED_BM_OR_INVISGOD;
@@ -1965,7 +1974,7 @@ bool SpellInfo::CheckTargetCreatureType(Unit const* target) const
if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179) if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
{ {
// not allow cast at player // not allow cast at player
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
return false; return false;
else else
return true; return true;
+1
View File
@@ -407,6 +407,7 @@ public:
uint32 GetCategory() const; uint32 GetCategory() const;
bool HasEffect(SpellEffects effect) const; bool HasEffect(SpellEffects effect) const;
bool HasEffectMechanic(Mechanics mechanic) const;
bool HasAura(AuraType aura) const; bool HasAura(AuraType aura) const;
bool HasAnyAura() const; bool HasAnyAura() const;
bool HasAreaAuraEffect() const; bool HasAreaAuraEffect() const;
@@ -4806,6 +4806,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].MiscValue = 124; spellInfo->Effects[EFFECT_0].MiscValue = 124;
}); });
// Power of the Guardian
ApplySpellFix({ 28142, 28143, 28144, 28145 }, [](SpellInfo* spellInfo)
{
spellInfo->AttributesEx3 |= SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{ {
SpellInfo* spellInfo = mSpellInfoMap[i]; SpellInfo* spellInfo = mSpellInfoMap[i];
+1 -1
View File
@@ -1134,7 +1134,7 @@ public:
return true; return true;
// check index // check index
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
{ {
if (index >= PLAYER_END) if (index >= PLAYER_END)
return true; return true;
+7 -7
View File
@@ -1130,7 +1130,7 @@ public:
return false; return false;
} }
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (handler->HasLowerSecurity(target->ToPlayer())) if (handler->HasLowerSecurity(target->ToPlayer()))
{ {
@@ -2659,7 +2659,7 @@ public:
return false; return false;
} }
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString()); handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->IsPlayer() ? "Player" : "Creature"), unit->GetGUID().ToString());
MotionMaster* motionMaster = unit->GetMotionMaster(); MotionMaster* motionMaster = unit->GetMotionMaster();
float x, y, z; float x, y, z;
@@ -2694,7 +2694,7 @@ public:
case CHASE_MOTION_TYPE: case CHASE_MOTION_TYPE:
{ {
Unit* target = nullptr; Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
{ {
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
} }
@@ -2707,7 +2707,7 @@ public:
{ {
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
} }
else if (target->GetTypeId() == TYPEID_PLAYER) else if (target->IsPlayer())
{ {
handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString()); handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString());
} }
@@ -2720,7 +2720,7 @@ public:
case FOLLOW_MOTION_TYPE: case FOLLOW_MOTION_TYPE:
{ {
Unit* target = nullptr; Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->IsPlayer())
{ {
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
} }
@@ -2733,7 +2733,7 @@ public:
{ {
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
} }
else if (target->GetTypeId() == TYPEID_PLAYER) else if (target->IsPlayer())
{ {
handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString()); handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString());
} }
@@ -2809,7 +2809,7 @@ public:
return false; return false;
} }
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
if (handler->HasLowerSecurity(target->ToPlayer())) if (handler->HasLowerSecurity(target->ToPlayer()))
{ {
+7 -7
View File
@@ -355,7 +355,7 @@ public:
return false; return false;
} }
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
// check online security // check online security
if (handler->HasLowerSecurity(target->ToPlayer())) if (handler->HasLowerSecurity(target->ToPlayer()))
@@ -370,7 +370,7 @@ public:
else if (target->IsPet()) else if (target->IsPet())
{ {
Unit* owner = target->GetOwner(); Unit* owner = target->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer())) if (owner && owner->IsPlayer() && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
{ {
// check online security // check online security
if (handler->HasLowerSecurity(owner->ToPlayer())) if (handler->HasLowerSecurity(owner->ToPlayer()))
@@ -666,7 +666,7 @@ public:
} }
// check online security // check online security
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer()))
{ {
return false; return false;
} }
@@ -843,7 +843,7 @@ public:
{ {
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
} }
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{ {
return false; return false;
} }
@@ -860,7 +860,7 @@ public:
{ {
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
} }
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{ {
return false; return false;
} }
@@ -873,7 +873,7 @@ public:
{ {
Player* target = handler->getSelectedPlayerOrSelf(); Player* target = handler->getSelectedPlayerOrSelf();
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
return false; return false;
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty()) if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
@@ -892,7 +892,7 @@ public:
{ {
target = handler->GetSession()->GetPlayer(); target = handler->GetSession()->GetPlayer();
} }
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{ {
return false; return false;
} }
+1 -1
View File
@@ -54,7 +54,7 @@ public:
Player* player = handler->GetSession()->GetPlayer(); Player* player = handler->GetSession()->GetPlayer();
Creature* creatureTarget = handler->getSelectedCreature(); Creature* creatureTarget = handler->getSelectedCreature();
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
{ {
handler->SendErrorMessage(LANG_SELECT_CREATURE); handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false; return false;
@@ -245,4 +245,3 @@ void AddSC_boss_gyth()
new boss_gyth(); new boss_gyth();
RegisterSpellScript(spell_gyth_chromatic_protection); RegisterSpellScript(spell_gyth_chromatic_protection);
} }
@@ -275,4 +275,3 @@ void AddSC_boss_broodlord()
new go_suppression_device(); new go_suppression_device();
RegisterSpellScript(spell_suppression_aura); RegisterSpellScript(spell_suppression_aura);
} }
@@ -365,4 +365,3 @@ void AddSC_boss_chromaggus()
RegisterSpellScript(spell_gen_elemental_shield); RegisterSpellScript(spell_gen_elemental_shield);
RegisterSpellScript(spell_gen_brood_power); RegisterSpellScript(spell_gen_brood_power);
} }
@@ -673,7 +673,7 @@ struct boss_nefarian : public BossAI
{ {
for (auto& ref : me->GetThreatMgr().GetThreatList()) for (auto& ref : me->GetThreatMgr().GetThreatList())
{ {
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER) if (ref->getTarget() && ref->getTarget()->IsPlayer())
{ {
classesPresent.insert(ref->getTarget()->getClass()); classesPresent.insert(ref->getTarget()->getClass());
} }
@@ -1277,4 +1277,3 @@ void AddSC_boss_nefarian()
RegisterSpellScript(spell_shadowblink); RegisterSpellScript(spell_shadowblink);
RegisterSpellScript(spell_spawn_drakonid); RegisterSpellScript(spell_spawn_drakonid);
} }
@@ -338,4 +338,3 @@ void AddSC_boss_razorgore()
new go_orb_of_domination(); new go_orb_of_domination();
RegisterSpellScript(spell_egg_event); RegisterSpellScript(spell_egg_event);
} }
@@ -328,4 +328,3 @@ void AddSC_boss_vaelastrasz()
new boss_vaelastrasz(); new boss_vaelastrasz();
RegisterSpellScript(spell_vael_burning_adrenaline); RegisterSpellScript(spell_vael_burning_adrenaline);
} }
@@ -531,4 +531,3 @@ void AddSC_instance_blackwing_lair()
RegisterSpellScript(spell_bwl_shadowflame); RegisterSpellScript(spell_bwl_shadowflame);
new at_orb_of_command(); new at_orb_of_command();
} }
@@ -229,4 +229,3 @@ void AddSC_boss_baron_geddon()
RegisterSpellScript(spell_geddon_inferno_aura); RegisterSpellScript(spell_geddon_inferno_aura);
RegisterSpellScript(spell_geddon_armageddon_aura); RegisterSpellScript(spell_geddon_armageddon_aura);
} }
@@ -230,4 +230,3 @@ void AddSC_boss_garr()
RegisterSpellScript(spell_garr_separation_anxiety_aura); RegisterSpellScript(spell_garr_separation_anxiety_aura);
RegisterSpellScript(spell_garr_frenzy); RegisterSpellScript(spell_garr_frenzy);
} }
@@ -167,4 +167,3 @@ void AddSC_boss_magmadar()
// Spells // Spells
RegisterSpellScript(spell_magmadar_lava_bomb); RegisterSpellScript(spell_magmadar_lava_bomb);
} }
@@ -661,4 +661,3 @@ void AddSC_boss_majordomo()
RegisterSpellScript(spell_majordomo_separation_anxiety_aura); RegisterSpellScript(spell_majordomo_separation_anxiety_aura);
RegisterSpellScript(spell_summon_ragnaros); RegisterSpellScript(spell_summon_ragnaros);
} }
@@ -564,4 +564,3 @@ void AddSC_boss_ragnaros()
RegisterSpellScript(spell_ragnaros_lava_burst_randomizer); RegisterSpellScript(spell_ragnaros_lava_burst_randomizer);
RegisterSpellScript(spell_ragnaros_summon_sons_of_flame); RegisterSpellScript(spell_ragnaros_summon_sons_of_flame);
} }
@@ -187,4 +187,3 @@ void AddSC_boss_shazzrah()
// Spells // Spells
RegisterSpellScript(spell_shazzrah_gate_dummy); RegisterSpellScript(spell_shazzrah_gate_dummy);
} }
@@ -268,4 +268,3 @@ void AddSC_molten_core()
// Spells // Spells
RegisterSpellScript(spell_mc_play_dead_aura); RegisterSpellScript(spell_mc_play_dead_aura);
} }
@@ -186,4 +186,3 @@ void AddSC_instance_gnomeregan()
new npc_kernobee(); new npc_kernobee();
new spell_gnomeregan_radiation_bolt(); new spell_gnomeregan_radiation_bolt();
} }
@@ -2084,4 +2084,3 @@ void AddSC_boss_chess_event()
RegisterSpellScript(spell_control_piece); RegisterSpellScript(spell_control_piece);
} }
@@ -69,7 +69,7 @@ struct boss_curator : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
{ {
Talk(SAY_KILL); Talk(SAY_KILL);
} }
@@ -72,7 +72,7 @@ struct boss_maiden_of_virtue : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
{ {
Talk(SAY_SLAY); Talk(SAY_SLAY);
} }
@@ -139,7 +139,7 @@ struct boss_attumen : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
{ {
Talk(SAY_KILL); Talk(SAY_KILL);
} }
@@ -416,4 +416,3 @@ void AddSC_boss_attumen()
RegisterKarazhanCreatureAI(boss_attumen); RegisterKarazhanCreatureAI(boss_attumen);
RegisterSpellScript(spell_midnight_fixate); RegisterSpellScript(spell_midnight_fixate);
} }
@@ -178,7 +178,7 @@ struct boss_moroes : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER) if (!_recentlySpoken && victim->IsPlayer())
{ {
Talk(SAY_KILL); Talk(SAY_KILL);
_recentlySpoken = true; _recentlySpoken = true;
@@ -283,4 +283,3 @@ void AddSC_boss_moroes()
RegisterKarazhanCreatureAI(boss_moroes); RegisterKarazhanCreatureAI(boss_moroes);
RegisterSpellScript(spell_moroes_vanish); RegisterSpellScript(spell_moroes_vanish);
} }
@@ -149,7 +149,7 @@ struct boss_netherspite : public BossAI
} }
} }
// buff the target // buff the target
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
target->AddAura(PlayerBuff[j], target); target->AddAura(PlayerBuff[j], target);
} }
@@ -177,7 +177,7 @@ struct boss_netherspite : public BossAI
} }
} }
// aggro target if Red Beam // aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER) if (j == RED_PORTAL && me->GetVictim() != target && target->IsPlayer())
{ {
me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim())); me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
} }
@@ -336,4 +336,3 @@ void AddSC_boss_netherspite()
RegisterKarazhanCreatureAI(boss_netherspite); RegisterKarazhanCreatureAI(boss_netherspite);
RegisterSpellScript(spell_nether_portal_perseverence); RegisterSpellScript(spell_nether_portal_perseverence);
} }
@@ -397,4 +397,3 @@ void AddSC_boss_malchezaar()
RegisterKarazhanCreatureAI(npc_netherspite_infernal); RegisterKarazhanCreatureAI(npc_netherspite_infernal);
RegisterSpellScript(spell_malchezaar_enfeeble); RegisterSpellScript(spell_malchezaar_enfeeble);
} }
@@ -502,4 +502,3 @@ void AddSC_boss_shade_of_aran()
RegisterSpellScript(spell_flamewreath_aura); RegisterSpellScript(spell_flamewreath_aura);
new at_karazhan_atiesh_aran(); new at_karazhan_atiesh_aran();
} }
@@ -224,7 +224,7 @@ struct boss_terestian_illhoof : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
{ {
Talk(SAY_SLAY); Talk(SAY_SLAY);
} }
@@ -609,4 +609,3 @@ void AddSC_instance_karazhan()
RegisterSpellScript(spell_karazhan_overload_aura); RegisterSpellScript(spell_karazhan_overload_aura);
RegisterSpellScript(spell_karazhan_blink); RegisterSpellScript(spell_karazhan_blink);
} }
@@ -142,7 +142,7 @@ struct boss_felblood_kaelthas : public ScriptedAI
void MoveInLineOfSight(Unit* who) override void MoveInLineOfSight(Unit* who) override
{ {
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER) if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->IsPlayer())
{ {
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
introSpeak = true; introSpeak = true;
@@ -313,4 +313,3 @@ void AddSC_boss_felblood_kaelthas()
RegisterMagistersTerraceCreatureAI(boss_felblood_kaelthas); RegisterMagistersTerraceCreatureAI(boss_felblood_kaelthas);
RegisterSpellScript(spell_mt_phoenix_burn); RegisterSpellScript(spell_mt_phoenix_burn);
} }
@@ -292,7 +292,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
for (ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{ {
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit)) if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
{ {
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100); me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);
@@ -116,7 +116,7 @@ struct boss_selin_fireheart : public ScriptedAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
Talk(SAY_KILL); Talk(SAY_KILL);
} }
@@ -82,7 +82,7 @@ struct boss_vexallus : public BossAI
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->IsPlayer())
Talk(SAY_KILL); Talk(SAY_KILL);
} }
@@ -1257,4 +1257,3 @@ void AddSC_the_scarlet_enclave_c1()
RegisterSpellScript(spell_death_knight_initiate_visual); RegisterSpellScript(spell_death_knight_initiate_visual);
} }
@@ -77,7 +77,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override void SpellHit(Unit* caster, SpellInfo const* spell) override
{ {
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->IsAlive() && !speechCounter) if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->IsPlayer() && me->IsAlive() && !speechCounter)
{ {
if (Player* player = caster->ToPlayer()) if (Player* player = caster->ToPlayer())
{ {
@@ -39,4 +39,3 @@ void AddSC_the_scarlet_enclave_c3()
{ {
RegisterSpellScript(spell_q12779_an_end_to_all_things); RegisterSpellScript(spell_q12779_an_end_to_all_things);
} }
@@ -1249,4 +1249,3 @@ void AddSC_the_scarlet_enclave_c5()
new spell_chapter5_light_of_dawn_aura(); new spell_chapter5_light_of_dawn_aura();
new spell_chapter5_rebuke(); new spell_chapter5_rebuke();
} }
@@ -213,4 +213,3 @@ void AddSC_boss_kormok()
RegisterSpellScript(spell_kormok_summon_bone_mages); RegisterSpellScript(spell_kormok_summon_bone_mages);
RegisterSpellScript(spell_kormok_summon_bone_minions); RegisterSpellScript(spell_kormok_summon_bone_minions);
} }
@@ -464,4 +464,3 @@ void AddSC_instance_scholomance()
new spell_scholomance_boon_of_life(); new spell_scholomance_boon_of_life();
new npc_scholomance_occultist(); new npc_scholomance_occultist();
} }
@@ -531,4 +531,3 @@ void AddSC_boss_apothecary_hummel()
RegisterSpellScript(spell_apothecary_perfume_spill); RegisterSpellScript(spell_apothecary_perfume_spill);
RegisterSpellScript(spell_apothecary_cologne_spill); RegisterSpellScript(spell_apothecary_cologne_spill);
} }
@@ -237,4 +237,3 @@ void AddSC_instance_shadowfang_keep()
new spell_shadowfang_keep_haunting_spirits(); new spell_shadowfang_keep_haunting_spirits();
new spell_shadowfang_keep_forsaken_skills(); new spell_shadowfang_keep_forsaken_skills();
} }

Some files were not shown because too many files have changed in this diff Show More