diff options
261 files changed, 3588 insertions, 2451 deletions
diff --git a/contrib/conf_merge/confdiffmerge.php b/contrib/conf_merge/confdiffmerge.php new file mode 100644 index 00000000000..7bcaef5042e --- /dev/null +++ b/contrib/conf_merge/confdiffmerge.php @@ -0,0 +1,169 @@ +<!-- + @title Configuration file merger/differ. + @about This script allows you to diff two config files and select which value to pick between the two. + It will then give you an updated configuration file with the settings you chose. + How-to: a) Paste both versions of your config file, submit the form. + b) Select values you want to keep in the next form, then submit said form. + c) Copy the output'd config file and profit! + Note: if either one of your config file has custom values, make sure that it is set to be the NEW + config file on the first step (right hand textarea). This will be adressed at a later date. + @author Warpten + @date 05/17/2014 + @license GNU GPL v2(GPL) + @version 0.0.1 +--> +<!DOCTYPE html> +<html> +<head> + <title><world/auth>server.conf diff</title> + <style type="text/css"> + form * { font-family: Verdana; font-size: 11px; } + form#step1 { position: relative; width: 800px; } + form#step2 { width: 500px; } + form > div { position: absolute; width: 50%; height: 500px; } + form > div:nth-child(1) { right: 0px; } + textarea { width: 90%; height: 500px; } + h3 { display: block; margin: 3px; padding: auto; text-align: center; } + input.valueName { border: 0px; background-color: white; } + form > p { margin: 0; padding: 3px; border-bottom: 1px solid black; } + textarea#result { width: 1000px; } + </style> +</head> + +<body> +<?php + +function printIndent($string, $indent = 1) +{ + echo str_pad("\r\n" . $string, $indent, " "); +} + +if (!isset($_POST['step'])) +{ +?> + <form action="" method="POST" id="step1"> + <div> + <h3>Paste the new configuration file</h3> + <textarea name="leftFile"></textarea> + </div><div> + <h3>Paste the old configuration file</h3> + <textarea name="rightFile"></textarea> + <input type="submit" value="Compare files" /> + </div> + <input type="hidden" name="step" value="0" /> + </form> +<?php +} +else if ($_POST['step'] == 0) +{ + if (@empty($_POST['leftFile']) || @empty($_POST['rightFile'])) + printf("You did not provide either the old or the new configuration file.<br />"); + + define('EOL', "\n\n"); + $settingsData = array(); + + // Process them + $newFile = explode(EOL, $_POST['leftFile']); + $oldFile = explode(EOL, $_POST['rightFile']); + + for ($i = 0, $o = count($oldFile); $i < $o; ++$i) + { + $oldFile[$i] = explode(PHP_EOL, $oldFile[$i]); + for ($j = 0, $p = count($oldFile[$i]); $j < $p; ++$j) + { + $currentLine = $oldFile[$i][$j]; + if (preg_match("#^([A-Z.]+) = (?:\"?)(.*)(?:\"?)$#iU", $currentLine, $data) !== false) + if (strlen($data[1]) != 0) + $settingsData[$data[1]]["oldValue"] = str_replace('"', '', trim($data[2])); + } + } + + for ($i = 0, $o = count($newFile); $i < $o; ++$i) + { + $newFile[$i] = explode(PHP_EOL, $newFile[$i]); + for ($j = 0, $p = count($newFile[$i]); $j < $p; ++$j) + { + $currentLine = $newFile[$i][$j]; + if (preg_match("#^([A-Z.]+) = (?:\"?)(.*)(?:\"?)$#iU", $currentLine, $data) !== false) + if (strlen($data[1]) != 0) + $settingsData[$data[1]]["newValue"] = str_replace('"', '', trim($data[2])); + } + } + + printIndent("<p>Please select values you want to keep. Note the script will default to new values, unless said <i>new</i> value does not exist.<br />You also can take advantage of this form and edit fields.</p>", 1); + printIndent('<form action="" method="POST" id="step2">', 1); + + foreach ($settingsData as $itemName => &$values) + { + $displayOld = isset($values['oldValue']) ? $values['oldValue'] : "Value missing"; + $displayNew = isset($values['newValue']) ? $values['newValue'] : "Value missing"; + + if ($displayOld == $displayNew) + continue; + + $line = '<p><input type="text" class="valueName" name="nameCross[]" value="' . $itemName . '" />'; + $line .= '<input type="radio" name="optionSelector[' . $itemName . ']" value="oldValue" ' . ($displayOld != "Value missing" ? "checked" : "") . '/>'; + $line .= '<input type="text" name="oldValue[]" value="' . $displayOld . '" /> '; + $line .= '<input type="radio" name="optionSelector[' . $itemName . ']" value="newValue" ' . ($displayNew != "Value missing" ? "checked" : "") . '/>'; + $line .= '<input type="text" name="newValue[]" value="' . $displayNew . '" /></p>'; + printIndent($line, 2); + } + printIndent('<input type="hidden" name="step" value="1" />', 2); + printIndent('<input type="submit" value="Gief resulting configuration file" />', 2); + printIndent('<input type="hidden" name="file" value="' . htmlspecialchars($_POST['rightFile']) . '" />', 2); + printIndent('</form>', 1); +} +else if ($_POST['step'] == 1) +{ + $errors = array(); + + $confFile = $_POST['file']; + + foreach ($_POST['optionSelector'] as $valueName => &$keyName) + { + $definiteValueIndex = -1; + foreach ($_POST['nameCross'] as $index => &$key) + { + if ($key == $valueName) + { + $definiteValueIndex = $index; + break; + } + } + + if ($definiteValueIndex == -1) + { + // TODO: Handle custom values that get lost + continue; + } + + $newStr = $_POST[$keyName][$definiteValueIndex]; + $oldStr = $_POST[$keyName == "oldValue" ? "newValue" : "oldValue"][$definiteValueIndex]; + if (!ctype_digit($newStr)) + $newStr = '"' . $newStr . '"'; + if (!ctype_digit($oldStr)) + $oldStr = '"' . $oldStr . '"'; + + $newValueString = $valueName . " = " . $newStr; + $oldValueString = $valueName . " = " . $oldStr; + $confFile = str_replace($oldValueString, $newValueString, $confFile); + } + echo "<p>Here is your new configuration file:</p>"; + echo '<form><textarea id="result">'; + printf('%s', $confFile); + echo '</textarea></form>'; + + if (!empty($errors)) + { + echo "<p>The following errors happened during processing:</p><ul><li>"; + echo implode("</li><li>", $errors); + echo "</li>"; + } +} +?> + +<script type="text/javascript"> + +</script> +</body> +</html> diff --git a/sql/updates/world/2014_05_13_00_world_conditions.sql b/sql/updates/world/2014_05_13_00_world_conditions.sql new file mode 100644 index 00000000000..75fd2e1a950 --- /dev/null +++ b/sql/updates/world/2014_05_13_00_world_conditions.sql @@ -0,0 +1,2 @@ +-- +UPDATE `conditions` SET `SourceEntry`=46763 WHERE `SourceEntry`=46753; diff --git a/sql/updates/world/2014_05_18_00_world_misc.sql b/sql/updates/world/2014_05_18_00_world_misc.sql new file mode 100644 index 00000000000..fe0b59dc32f --- /dev/null +++ b/sql/updates/world/2014_05_18_00_world_misc.sql @@ -0,0 +1,17 @@ +-- +UPDATE `creature_template` SET `npcflag`=3, `AIName`='SmartAI' WHERE `entry`=37120; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10910 AND `id`=1; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`) VALUES +(10910, 1, 'I must ask that you reforge Shadow''s Edge for me, Highlord Mograine.', 37855, 1, 1); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=37120; +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 +(37120, 0, 0, 0, 62, 0, 100, 0, 10910, 1, 0, 0, 11, 72995, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Gossip Option 1 Selected - Cast Shadow''s Edge'), +(37120, 0, 1, 0, 62, 0, 100, 0, 10910, 1, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Gossip Option 1 Selected - Close Gossip'); + +DELETE FROM `conditions` WHERE `SourceGroup`=10910; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(15, 10910, 1, 0, 0, 8, 0, 24912, 0, 0, 1, 0, 0, '', 'Highlord Darion Mograine: Hide Gossip option if player has quest 24912 rewarded'), +(15, 10910, 1, 0, 0, 8, 0, 24743, 0, 0, 0, 0, 0, '', 'Highlord Darion Mograine: Show Gossip option if player has quest 24743 rewarded'), +(15, 10910, 1, 0, 0, 2, 0, 49888, 1, 0, 1, 0, 0, '', 'Highlord Darion Mograine: Show Gossip option if player does not have Shadow''s Edge'); diff --git a/sql/updates/world/2014_05_18_01_world_misc.sql b/sql/updates/world/2014_05_18_01_world_misc.sql new file mode 100644 index 00000000000..66df66dc7b5 --- /dev/null +++ b/sql/updates/world/2014_05_18_01_world_misc.sql @@ -0,0 +1,37 @@ +-- +SET @ENTRY := 27914; +UPDATE `creature_template` SET `gossip_menu_id`=9619, `npcflag`=129 WHERE `entry`=@ENTRY; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=9619; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES +(9619, 0, 0, 'How does this work?', 27298, 1, 1, 9620, 0, 0, 0, '', 0), +(9619, 1, 1, 'Show me what you have to trade.', 27299, 3, 128, 0, 0, 0, 0, '', 0); + +DELETE FROM `gossip_menu` WHERE `entry` IN (9619,9620) AND `text_id` IN (13005,13006); +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(9619, 13005), +(9620, 13006); + +DELETE FROM `creature_text` WHERE `entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(@ENTRY, 0, 0, 'I have arrived. Shall we set to work, then?', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27295), +(@ENTRY, 1, 0, 'Ah, more essence to capture...', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27336), +(@ENTRY, 2, 0, 'Here is your share.', 12, 0, 100, 0, 0, 0, 'Ethereal Soul-Trader', 27341); + +DELETE FROM `npc_text` WHERE `ID` IN (13005,13006); +INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `prob0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `prob1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `prob2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `prob3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `prob4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `prob5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `prob6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `prob7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES +(13005, 'How may this one help you, $gsir:madame;?', '', 27296, 0, 1, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 18019), +(13006, 'My business partner slays things; I drain a portion of their essence... a pittance, really; the slightest of slivers. It won''t be missed.$B$BStill, to fulfil my portion of the contract, I pay in Ethereal Credits.$B$BOne may redeem these credits for items I sell at any time. I''m bound to have something that will interest you...', '', 27300, 0, 1, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 18019); + +DELETE FROM `npc_vendor` WHERE `entry`=@ENTRY; +INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `incrtime`, `ExtendedCost`) VALUES +(@ENTRY, 0, 38308, 0, 0, 2411), -- Ethereal Essence Sphere +(@ENTRY, 1, 38300, 0, 0, 2411), -- Diluted Ethereum Essence +(@ENTRY, 2, 38294, 0, 0, 2412), -- Ethereal Liqueur +(@ENTRY, 3, 38291, 0, 0, 2408), -- Ethereal Mutagen +(@ENTRY, 4, 38163, 0, 0, 2408), -- Soul-Trader's Head Wrap +(@ENTRY, 5, 38160, 0, 0, 2410), -- Soul-trader's Bindings +(@ENTRY, 6, 38286, 0, 0, 2407), -- Soul-Trader's Pauldrons +(@ENTRY, 7, 38285, 0, 0, 2408), -- Soul-Trader's Waistband +(@ENTRY, 8, 38161, 0, 0, 2409), -- Soul-Trader's Gloves +(@ENTRY, 9, 38162, 0, 0, 2409); -- Soul-Trader's Boots diff --git a/sql/updates/world/2014_05_18_02_world_gameobject.sql b/sql/updates/world/2014_05_18_02_world_gameobject.sql new file mode 100644 index 00000000000..0d3357de2a1 --- /dev/null +++ b/sql/updates/world/2014_05_18_02_world_gameobject.sql @@ -0,0 +1,4 @@ +-- +UPDATE `gameobject` SET `position_x`=914.3752, `position_y`=-146.9912, `position_z`=-49.75655, `orientation`=3.68265, `VerifiedBuild`=15595 WHERE `guid`=43097; +UPDATE `gameobject` SET `position_x`=915.7144, `position_y`=-149.2887, `position_z`=-49.75705, `orientation`=3.647741, `VerifiedBuild`=15595 WHERE `guid`=43098; +UPDATE `gameobject` SET `position_x`=917.0272, `position_y`=-151.5825, `position_z`=-49.75756, `orientation`=3.647741, `VerifiedBuild`=15595 WHERE `guid`=43099; diff --git a/sql/updates/world/2014_05_18_03_world_misc.sql b/sql/updates/world/2014_05_18_03_world_misc.sql new file mode 100644 index 00000000000..86d018dd7b0 --- /dev/null +++ b/sql/updates/world/2014_05_18_03_world_misc.sql @@ -0,0 +1,48 @@ +-- +-- Nesingwary Lackey Ear (35188) drop chance fix by nelegalno +-- Needed for Can't Get Ear-nough... (11867) "turn in only" repeatable quest +SET @EAR := 35188; + +UPDATE `creature_loot_template` SET `ChanceOrQuestChance` = ABS(`ChanceOrQuestChance`) WHERE `item`=@EAR; + +-- Clam Master K +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25800 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25800,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Clam Master K only if Ears of Our Enemies quest taken"), +(1,25800,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Clam Master K only if Ears of Our Enemies quest rewarded"); + +-- Loot Crazed Poacher +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25806 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25806,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Poacher only if Ears of Our Enemies quest taken"), +(1,25806,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Poacher only if Ears of Our Enemies quest rewarded"); + +-- Loot Crazed Diver +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25836 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25836,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Diver only if Ears of Our Enemies quest taken"), +(1,25836,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Diver only if Ears of Our Enemies quest rewarded"); + +-- Northsea Mercenary +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25839 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25839,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Mercenary only if Ears of Our Enemies quest taken"), +(1,25839,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Mercenary only if Ears of Our Enemies quest rewarded"); + +-- Northsea Thug +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25843 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25843,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Thug only if Ears of Our Enemies quest taken"), +(1,25843,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Northsea Thug only if Ears of Our Enemies quest rewarded"); + + -- Minion of Kaw +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25880 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25880,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Minion of Kaw only if Ears of Our Enemies quest taken"), +(1,25880,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Minion of Kaw only if Ears of Our Enemies quest rewarded"); + + -- Loot Crazed Hunter +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=25979 AND `SourceEntry`=@EAR; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(1,25979,@EAR,0,0,9,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Hunter only if Ears of Our Enemies quest taken"), +(1,25979,@EAR,0,1,8,0,11866,0,0,0,0,'',"Nesingwary Lackey Ear drops from Loot Crazed Hunter only if Ears of Our Enemies quest rewarded"); diff --git a/sql/updates/world/2014_05_18_04_world_misc.sql b/sql/updates/world/2014_05_18_04_world_misc.sql new file mode 100644 index 00000000000..89dc227f7ca --- /dev/null +++ b/sql/updates/world/2014_05_18_04_world_misc.sql @@ -0,0 +1,28 @@ +-- +SET @CGUID := 68279; -- set by TDB team (3) +SET @OGUID := 6134; -- set by TDB team (2) + +DELETE FROM `spell_area` WHERE `spell`=71314; +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES +(71314, 4862, 24559, 24562, 0, 0, 2, 1, 74, 11); + +DELETE FROM `creature_addon` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2; +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +(@CGUID+0, 0, 0, 0x10000, 0x1, 0, '71312'), +(@CGUID+1, 0, 0, 0x10000, 0x1, 0, '71312'), +(@CGUID+2, 0, 0, 0x10000, 0x1, 0, '71312'); + +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+2; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(@CGUID+0, 36657, 571, 1, 1, 5630.028, 2082.906, 798.1375, 0, 120, 0, 0), -- Sunreaver War Mage (Area: 210) +(@CGUID+1, 36642, 571, 1, 1, 5630.374, 2087.88, 798.1375, 6.213372, 120, 0, 0), -- Myralion Sunblaze (Area: 210) +(@CGUID+2, 36657, 571, 1, 1, 5631.038, 2092.561, 798.1375, 6.143559, 120, 0, 0); -- Sunreaver War Mage (Area: 210) + +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+1; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +(@OGUID+0, 202192, 571, 1, 1, 5628.946, 2079.644, 798.0542, 0.6457717, 0, 0, 0, 1, 120, 255, 1), -- Sunreaver Banner (Area: 210) +(@OGUID+1, 202192, 571, 1, 1, 5630.607, 2096.247, 798.0542, 5.881761, 0, 0, 0, 1, 120, 255, 1); -- Sunreaver Banner (Area: 210) + +DELETE FROM `gameobject_template` WHERE `entry`=202192; +INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES +(202192, 5, 6794, 'Sunreaver Banner', '', '', '', 0, 0, 0.8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 16992); diff --git a/sql/updates/world/2014_05_19_00_world_misc.sql b/sql/updates/world/2014_05_19_00_world_misc.sql new file mode 100644 index 00000000000..7879aca132d --- /dev/null +++ b/sql/updates/world/2014_05_19_00_world_misc.sql @@ -0,0 +1,10 @@ +-- +UPDATE `smart_scripts` SET `event_phase_mask`=0 WHERE `entryorguid`=24539 AND `source_type`=0 AND `id` IN(5,6) AND `link`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=2453900 AND `source_type`=9 AND `id`=5 AND `link`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=2453901 AND `source_type`=9 AND `id`=4 AND `link`=0; +UPDATE `smart_scripts` SET `event_param3`=0, `event_param4`=0 WHERE `entryorguid`=24539 AND `source_type`=0 AND `id`=4 AND `link`=0; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=24539; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 6, 24539, 0, 0, 38, 1, 50, 4, 0, 0, 0, 0, '', 'Silvermoon Harry - Only run SAI if silvermoon harry hp at 50% or lower'), +(22, 6, 24539, 0, 0, 9, 0, 11464, 0, 0, 0, 0, 0, '', 'Silvermoon Harry - Only run SAI if player has gambling debt taken'); diff --git a/sql/updates/world/2014_05_19_01_world_misc.sql b/sql/updates/world/2014_05_19_01_world_misc.sql new file mode 100644 index 00000000000..d25e73f245e --- /dev/null +++ b/sql/updates/world/2014_05_19_01_world_misc.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid`=26737 AND `source_type`=0 AND `id`=5; +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 +(26737, 0, 5, 0, 25, 0, 100, 0, 0, 0, 0, 0, 19, 537133824, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Crazed Mana-Surge - On Reset - Remove Unit Flags (UNK_29 / STUNNED / IMMUNE TO NPC / IMMUNE TO PC)'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=26737; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 6, 26737, 0, 0, 1, 1, 29266, 0, 0, 1, 0, 0, '', 'Crazed Mana Surge only run SAI if Crazed mana surge does not have aura Permanent Feign Death'); diff --git a/sql/updates/world/2014_05_23_00_world_spell_script_names.sql b/sql/updates/world/2014_05_23_00_world_spell_script_names.sql new file mode 100644 index 00000000000..22d792e6f72 --- /dev/null +++ b/sql/updates/world/2014_05_23_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=69232; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(69232,'spell_tyrannus_rimefang_icy_blast'); diff --git a/sql/updates/world/2014_05_23_01_world_trinity_string.sql b/sql/updates/world/2014_05_23_01_world_trinity_string.sql new file mode 100644 index 00000000000..e05d36f601c --- /dev/null +++ b/sql/updates/world/2014_05_23_01_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=11008; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(11008, 'InhabitType: %u'); diff --git a/sql/updates/world/2014_05_30_00_world_quest_update.sql b/sql/updates/world/2014_05_30_00_world_quest_update.sql new file mode 100644 index 00000000000..a44baf75074 --- /dev/null +++ b/sql/updates/world/2014_05_30_00_world_quest_update.sql @@ -0,0 +1 @@ +UPDATE `quest_template` SET `NextQuestId`=1106,`ExclusiveGroup`=-1104 WHERE `Id` IN (1104,1105); diff --git a/sql/updates/world/2014_06_01_00_world_phases_434.sql b/sql/updates/world/2014_06_01_00_world_phases_434.sql new file mode 100644 index 00000000000..a073498d745 --- /dev/null +++ b/sql/updates/world/2014_06_01_00_world_phases_434.sql @@ -0,0 +1,6 @@ +ALTER TABLE `creature` + ADD `PhaseId` INT(10) DEFAULT '0' AFTER `phaseMask`, + ADD `PhaseGroup` INT(10) DEFAULT '0' AFTER `PhaseId`; +ALTER TABLE `gameobject` + ADD `PhaseId` INT(10) DEFAULT '0' AFTER `phaseMask`, + ADD `PhaseGroup` INT(10) DEFAULT '0' AFTER `PhaseId`; diff --git a/sql/updates/world/2014_06_03_world_creature.sql b/sql/updates/world/2014_06_03_world_creature.sql new file mode 100644 index 00000000000..81953785fd5 --- /dev/null +++ b/sql/updates/world/2014_06_03_world_creature.sql @@ -0,0 +1 @@ +UPDATE `creature` SET `phaseMask`=1 WHERE `id`=21347; diff --git a/sql/updates/world/2014_06_06_00_world_misc.sql b/sql/updates/world/2014_06_06_00_world_misc.sql new file mode 100644 index 00000000000..a1d4dd621c0 --- /dev/null +++ b/sql/updates/world/2014_06_06_00_world_misc.sql @@ -0,0 +1,92 @@ + +UPDATE creature_template SET ScriptName="npc_imp_in_a_ball" WHERE entry=23224; + +SET @COUNT := 0; +DELETE FROM creature_text WHERE entry=23224; +INSERT INTO creature_text (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `BroadcastTextID`) VALUES +(23224, 0, @COUNT := @COUNT + 1, 'Yes, unless I have anything to do with it.', 15, 0, 100, 0, 0, 0, '', 21157), +(23224, 0, @COUNT := @COUNT + 1, 'I see that happening sometime between tomorrow and the next decade. Definitely.', 15, 0, 100, 0, 0, 0, '', 21158), +(23224, 0, @COUNT := @COUNT + 1, 'Looks good for you...and bad for me.', 15, 0, 100, 0, 0, 0, '', 21160), +(23224, 0, @COUNT := @COUNT + 1, 'I\'ve consulted my fellow imps, and we think YES, except for that one imp.', 15, 0, 100, 0, 0, 0, '', 21161), +(23224, 0, @COUNT := @COUNT + 1, 'The outlook is positive, but I\'m still negative.', 15, 0, 100, 0, 0, 0, '', 21162), +(23224, 0, @COUNT := @COUNT + 1, 'It pains me to say this, but "Yes".', 15, 0, 100, 0, 0, 0, '', 21163), +(23224, 0, @COUNT := @COUNT + 1, 'When dwarves fly! They do? Then yes!', 15, 0, 100, 0, 0, 0, '', 21164), +(23224, 0, @COUNT := @COUNT + 1, 'Sure, but you\'re not going to like it.', 15, 0, 100, 0, 0, 0, '', 21165), +(23224, 0, @COUNT := @COUNT + 1, 'Be quiet \'bout what you hear and see around here, $r.', 15, 0, 100, 0, 0, 0, '', 21166), +(23224, 0, @COUNT := @COUNT + 1, 'Unfortunately... yes.', 15, 0, 100, 0, 0, 0, '', 21169), +(23224, 0, @COUNT := @COUNT + 1, 'I can\'t see why not, although, I can\'t see a lot of things right now.', 15, 0, 100, 0, 0, 0, '', 21170), +(23224, 0, @COUNT := @COUNT + 1, 'I would bet your soul on it.', 15, 0, 100, 0, 0, 0, '', 21171), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, but if anyone asks... It wasn\'t me who told you.', 15, 0, 100, 0, 0, 0, '', 21172), +(23224, 0, @COUNT := @COUNT + 1, 'Didn\'t you already ask that once? Yes already!', 15, 0, 100, 0, 0, 0, '', 21173), +(23224, 0, @COUNT := @COUNT + 1, 'Please... Is Kil\'jaeden red?', 15, 0, 100, 0, 0, 0, '', 21175), +(23224, 0, @COUNT := @COUNT + 1, 'Yeah, sure. You just keep thinking that.', 15, 0, 100, 0, 0, 0, '', 21176), +(23224, 0, @COUNT := @COUNT + 1, 'I suppose.', 15, 0, 100, 0, 0, 0, '', 21177), +(23224, 0, @COUNT := @COUNT + 1, 'Definitely.', 15, 0, 100, 0, 0, 0, '', 21178), +(23224, 0, @COUNT := @COUNT + 1, 'Jump three times and dance for ten minutes and it will definitely happen!', 15, 0, 100, 0, 0, 0, '', 21179), +(23224, 0, @COUNT := @COUNT + 1, 'Word on the peninsula is YES!', 15, 0, 100, 0, 0, 0, '', 21180), +(23224, 0, @COUNT := @COUNT + 1, 'Oh, that one\'s for sure.', 15, 0, 100, 0, 0, 0, '', 21181), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, but not in the way you imagine.', 15, 0, 100, 0, 0, 0, '', 21182), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, yes, a thousand times, yes already!', 15, 0, 100, 0, 0, 0, '', 21183), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, now stop pestering me!', 15, 0, 100, 0, 0, 0, '', 21184), +(23224, 0, @COUNT := @COUNT + 1, 'The answer will be a yes if you let me out of here.', 15, 0, 100, 0, 0, 0, '', 21185), +(23224, 0, @COUNT := @COUNT + 1, 'It\'s as sure as the warts on my backside!', 15, 0, 100, 0, 0, 0, '', 21186), +(23224, 0, @COUNT := @COUNT + 1, 'The answer is yes in here, I don\'t see why it would be any different out there.', 15, 0, 100, 0, 0, 0, '', 21187), +(23224, 0, @COUNT := @COUNT + 1, 'Three words - "ab - so - lutely"!', 15, 0, 100, 0, 0, 0, '', 21188), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, but I hoped I would never have to answer that.', 15, 0, 100, 0, 0, 0, '', 21189), +(23224, 0, @COUNT := @COUNT + 1, 'Ask me again later - I\'m trying to scratch my nose and it\'s hard to concentrate.', 15, 0, 100, 0, 0, 0, '', 21190), +(23224, 0, @COUNT := @COUNT + 1, 'Why should I answer that? Do you tell fortunes when people shake YOU?', 15, 0, 100, 0, 0, 0, '', 21191), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, it will rain. That\'s not what you asked? Too bad!', 15, 0, 100, 0, 0, 0, '', 21192), +(23224, 0, @COUNT := @COUNT + 1, 'I\'m sorry, I can only speak Demonic.', 15, 0, 100, 0, 0, 0, '', 21193), +(23224, 0, @COUNT := @COUNT + 1, 'Yes! I mean no! I mean... which answer gets me out of here?', 15, 0, 100, 0, 0, 0, '', 21194), +(23224, 0, @COUNT := @COUNT + 1, 'Yes, No, Maybe so.', 15, 0, 100, 0, 0, 0, '', 21195), +(23224, 0, @COUNT := @COUNT + 1, 'It won\'t matter, you\'ll be dead by tomorrow.', 15, 0, 100, 0, 0, 0, '', 21196), +(23224, 0, @COUNT := @COUNT + 1, 'You should be asking "Is that rogue behind me going to kill me?"', 15, 0, 100, 0, 0, 0, '', 21197), +(23224, 0, @COUNT := @COUNT + 1, 'It\'s times like these that I wish I had a longer cooldown.', 15, 0, 100, 0, 0, 0, '', 21198), +(23224, 0, @COUNT := @COUNT + 1, '%s shrugs. Who knows?', 15, 0, 100, 0, 0, 0, '', 21199), +(23224, 0, @COUNT := @COUNT + 1, 'It\'s like my mother always said: [Demonic] "Razxx khaj jhashxx xashjx."', 15, 0, 100, 0, 0, 0, '', 21205), +(23224, 0, @COUNT := @COUNT + 1, '%s is ignoring you.', 15, 0, 100, 0, 0, 0, '', 21206), +(23224, 0, @COUNT := @COUNT + 1, 'Why me? Why not a goblin, or a gnome...', 15, 0, 100, 0, 0, 0, '', 21207), +(23224, 0, @COUNT := @COUNT + 1, 'What happens in the twisting nether, stays in the twisting nether.', 15, 0, 100, 0, 0, 0, '', 21208), +(23224, 0, @COUNT := @COUNT + 1, 'Avoid taking unnecessary gambles. Your lucky numbers are two, two and half, and eleven-teen.', 15, 0, 100, 0, 0, 0, '', 21209), +(23224, 0, @COUNT := @COUNT + 1, 'Wouldn\'t you like to know?', 15, 0, 100, 0, 0, 0, '', 21210), +(23224, 0, @COUNT := @COUNT + 1, 'Oh, oh, oh! I can see this one clearly... Nah, lost it.', 15, 0, 100, 0, 0, 0, '', 21211), +(23224, 0, @COUNT := @COUNT + 1, 'This was NOT in my contract!', 15, 0, 100, 0, 0, 0, '', 21212), +(23224, 0, @COUNT := @COUNT + 1, 'XRA RAHKI MAZIZRA!', 15, 0, 100, 0, 0, 0, '', 21213), +(23224, 0, @COUNT := @COUNT + 1, '4 8 15 16 23 42', 15, 0, 100, 0, 0, 0, '', 21214), +(23224, 0, @COUNT := @COUNT + 1, 'Are you making fun of me?', 15, 0, 100, 0, 0, 0, '', 21215), +(23224, 0, @COUNT := @COUNT + 1, 'What kind of imp do you think I am?', 15, 0, 100, 0, 0, 0, '', 21216), +(23224, 0, @COUNT := @COUNT + 1, 'Say please.', 15, 0, 100, 0, 0, 0, '', 21217), +(23224, 0, @COUNT := @COUNT + 1, 'Want to trade places?', 15, 0, 100, 0, 0, 0, '', 21218), +(23224, 0, @COUNT := @COUNT + 1, 'Do you ask this question to everything that\'s trapped in a ball?', 15, 0, 100, 0, 0, 0, '', 21219), +(23224, 0, @COUNT := @COUNT + 1, 'Hey! You try arranging furniture with some jerk shaking your house!', 15, 0, 100, 0, 0, 0, '', 21220), +(23224, 0, @COUNT := @COUNT + 1, 'I can make that happen. Just sign below the dotted line...', 15, 0, 100, 0, 0, 0, '', 21221), +(23224, 0, @COUNT := @COUNT + 1, 'Reply hazy and slightly damp. Dry thoroughly and try again.', 15, 0, 100, 0, 0, 0, '', 21222), +(23224, 0, @COUNT := @COUNT + 1, 'Concentrate (on releasing me from this infernal prison) and try again later.', 15, 0, 100, 0, 0, 0, '', 21223), +(23224, 0, @COUNT := @COUNT + 1, 'Please insert 25 silver pieces and try again.', 15, 0, 100, 0, 0, 0, '', 21224), +(23224, 0, @COUNT := @COUNT + 1, 'Are you my pal, Danny?', 15, 0, 100, 0, 0, 0, '', 21225), +(23224, 0, @COUNT := @COUNT + 1, 'You remember the time you tried to drill that hole in your head?', 15, 0, 100, 0, 0, 0, '', 21226), +(23224, 0, @COUNT := @COUNT + 1, 'Oh that\'s right, don\'t make any effort to make your own fortune!', 15, 0, 100, 0, 0, 0, '', 21227), +(23224, 0, @COUNT := @COUNT + 1, 'Two words - imp-possible!', 15, 0, 100, 0, 0, 0, '', 21228), +(23224, 0, @COUNT := @COUNT + 1, 'You need Arcane Intellect, because that answer is obvious! NO!', 15, 0, 100, 0, 0, 0, '', 21229), +(23224, 0, @COUNT := @COUNT + 1, 'Not on your life!', 15, 0, 100, 0, 0, 0, '', 21230), +(23224, 0, @COUNT := @COUNT + 1, 'I don\'t have to be a fortune-telling imp to know the answer to that one - NO!', 15, 0, 100, 0, 0, 0, '', 21231), +(23224, 0, @COUNT := @COUNT + 1, 'The odds are 32.33 (repeating of course) percent chance of success.', 15, 0, 100, 0, 0, 0, '', 21232), +(23224, 0, @COUNT := @COUNT + 1, 'When Blackrock freezes over!', 15, 0, 100, 0, 0, 0, '', 21233), +(23224, 0, @COUNT := @COUNT + 1, 'Hahahaha, you\'re kidding right?', 15, 0, 100, 0, 0, 0, '', 21234), +(23224, 0, @COUNT := @COUNT + 1, 'Inconceivable!', 15, 0, 100, 0, 0, 0, '', 21235), +(23224, 0, @COUNT := @COUNT + 1, 'My sources say "no". Before the torture, that is.', 15, 0, 100, 0, 0, 0, '', 21236), +(23224, 0, @COUNT := @COUNT + 1, 'That\'s about as likely as me getting out of this ball.', 15, 0, 100, 0, 0, 0, '', 21237), +(23224, 0, @COUNT := @COUNT + 1, 'You picked the wrong time to shake me today, buddy! Prepare for disappointment.', 15, 0, 100, 0, 0, 0, '', 21238), +(23224, 0, @COUNT := @COUNT + 1, 'Not unless you\'re some kind of super-person. And don\'t kid yourself, you\'re not.', 15, 0, 100, 0, 0, 0, '', 21239), +(23224, 0, @COUNT := @COUNT + 1, 'That\'s about as likely as me getting a date with a succubus.', 15, 0, 100, 0, 0, 0, '', 21240), +(23224, 0, @COUNT := @COUNT + 1, 'My fortune telling powers are immeasurable - your chances are though: NO CHANCE', 15, 0, 100, 0, 0, 0, '', 21241), +(23224, 0, @COUNT := @COUNT + 1, 'NO - and don\'t try shaking me again for a better answer!', 15, 0, 100, 0, 0, 0, '', 21242), +(23224, 0, @COUNT := @COUNT + 1, 'Yes is my answer...', 15, 0, 100, 0, 0, 0, '', 21243), +(23224, 0, @COUNT := @COUNT + 1, '...NOT!', 15, 0, 100, 0, 0, 0, '', 21244), +(23224, 0, @COUNT := @COUNT + 1, 'I\'m gonna have to give this one the big N-O.', 15, 0, 100, 0, 0, 0, '', 21245), +(23224, 0, @COUNT := @COUNT + 1, 'The outlook is very bad - for YOU that is! Haha, take it!', 15, 0, 100, 0, 0, 0, '', 21246), +(23224, 0, @COUNT := @COUNT + 1, 'Survey says: BZZZT!', 15, 0, 100, 0, 0, 0, '', 21247); + +DELETE FROM spell_linked_spell WHERE spell_trigger=40527 AND spell_effect=40528; +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(40527, 40528, 0, 'Imp in a Bottle'); diff --git a/sql/updates/world/2014_06_06_00_world_quest_template.sql b/sql/updates/world/2014_06_06_00_world_quest_template.sql new file mode 100644 index 00000000000..6d174f9a7b0 --- /dev/null +++ b/sql/updates/world/2014_06_06_00_world_quest_template.sql @@ -0,0 +1,4 @@ +-- +UPDATE `quest_template` SET `RequestItemsText` = 'Supposedly this Malcin is outside Razorfen Downs. There''s no question - he has to die.$b$bMy contacts in Orgrimmar tell me their scouts have found signs of the Plague down there. The quilboar are showing signs of being plagued, too; they''re much more powerful. Whatever the Scourge are doing down there needs to end. Now.$b$bFind this Malcin and kill him. Report back here when he''s dead.' WHERE `id` = 14353; +UPDATE `quest_template` SET `OfferRewardText` = 'Good work, $C!$b$bYou''ve done the Horde proud by stopping the Scourge from setting down roots on our soil. An act like that deserves a reward, and the Forsaken have enough lying around that I''m sure they can spare a few things.$b$bWe may not know everything they''ve done in the Downs, but we''ll find out. They can''t slink around in the dark forever.' WHERE `id` = 14353; +UPDATE `quest_template` SET `OfferRewardText` = 'I''m sure Sylvanas will be glad to have that problem taken care of, $N. The task I gave you wasn''t easy, but here you stand, victorious. That commands respect, and what you''ve done won''t be forgotten.' WHERE `id` = 14355; diff --git a/sql/updates/world/2014_06_07_00_world_misc.sql b/sql/updates/world/2014_06_07_00_world_misc.sql new file mode 100644 index 00000000000..ff09f8f552e --- /dev/null +++ b/sql/updates/world/2014_06_07_00_world_misc.sql @@ -0,0 +1,31 @@ +UPDATE `creature_template` SET `gossip_menu_id`=3310 WHERE `entry`=11216; + +DELETE FROM `gossip_menu_option` WHERE `menu_id` in(3310,3309,3308,3307,3306,3305,3304,3303,3302,3301); +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextID`) VALUES +(3310, 0, 0, 'The pleasure is mine, madam. Might I ask what it is that you are doing here?', 6645, 1, 1, 3309, 0, 0, 0, '', 0), +(3310, 1, 0, 'Eva, I have lost the Spectral Essence. I need another.', 6799, 1, 1, 0, 0, 0, 0, '', 0), +(3309, 0, 0, 'Until what, Eva? I must know.', 6647, 1, 1, 3308, 0, 0, 0, '', 0), +(3308, 0, 0, 'What do you mean?', 6649, 1, 1, 3307, 0, 0, 0, '', 0), +(3307, 0, 0, 'Why didn''t you just leave?', 6651, 1, 1, 3306, 0, 0, 0, '', 0), +(3306, 0, 0, 'So what happened?', 6653, 1, 1, 3305, 0, 0, 0, '', 0), +(3305, 0, 0, 'No restraints? Just a circle?', 6655, 1, 1, 3304, 0, 0, 0, '', 0), +(3304, 0, 0, 'Tell me more', 6657, 1, 1, 3303, 0, 0, 0, '', 0), +(3303, 0, 0, 'This is an atrocity.', 6659, 1, 1, 3302, 0, 0, 0, '', 0), +(3302, 0, 0, 'I feel sick', 6661, 1, 1, 3301, 0, 0, 0, '', 0), +(3301, 0, 0, 'What can I do to help?', 45678, 1, 1, 0, 0, 0, 0, '', 0); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (3310); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(15, 3310, 0, 0, 0, 8, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not rewarded'), +(15, 3310, 0, 0, 0, 9, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not taken'), +(15, 3310, 0, 0, 0, 28, 0, 5382, 0, 0, 1, 0, 0, '', 'Gossip Option requires Doctor Theolen Krastinov, the Butcher not complete'), +(15, 3310, 1, 0, 0, 8, 0, 5384, 0, 0, 0, 0, 0, '', 'Gossip Option requires Kirtonos the Herald Rewarded'), +(15, 3310, 1, 0, 0, 2, 0, 13544, 1, 0, 1, 0, 0, '', 'Gossip Option requires Player does not have Spectral Essence'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (11216); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(11216) AND `source_type`=0; +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 +(11216,0,0,1,62,0,100,0,3310,1,0,0,85,17672,2,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - On Gossip Option 1 Selected - Cast Summon Spectral Essence'), +(11216,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,'Eva Sarkhoff - Link - Close Gossip'), +(11216,0,3,4,62,0,100,0,3301,0,0,0,7,5382,0,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - On Gossip Option 0 Selected - Add Quest Doctor Theolen Krastinov, the Butcher'), +(11216,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Eva Sarkhoff - Link - Close Gossip'); diff --git a/sql/updates/world/2014_06_08_00_world_conditions.sql b/sql/updates/world/2014_06_08_00_world_conditions.sql new file mode 100644 index 00000000000..a0a885d5def --- /dev/null +++ b/sql/updates/world/2014_06_08_00_world_conditions.sql @@ -0,0 +1 @@ +UPDATE `conditions` SET `ConditionTypeOrReference`=2,`ConditionValue2`=1,`NegativeCondition`=1 WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9422 AND `ConditionTypeOrReference`=26 AND `ConditionValue1`=36734; diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp index 7a4998f7028..44921f6a1cd 100644 --- a/src/server/authserver/Authentication/AuthCodes.cpp +++ b/src/server/authserver/Authentication/AuthCodes.cpp @@ -84,4 +84,4 @@ namespace AuthHelper { return build >= 15595; } -}; +} diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h index a6113b0d26d..eb9f443f624 100644 --- a/src/server/authserver/Authentication/AuthCodes.h +++ b/src/server/authserver/Authentication/AuthCodes.h @@ -183,6 +183,6 @@ namespace AuthHelper bool IsPostBCAcceptedClientBuild(int build); bool IsPreBCAcceptedClientBuild(int build); bool IsBuildSupportingBattlenet(int build); -}; +} #endif diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index bb57079c389..d592d795125 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -157,8 +157,7 @@ namespace VMAP { float maxDist = (pos2 - pos1).magnitude(); // return false if distance is over max float, in case of cheater teleporting to the end of the universe - if (maxDist == std::numeric_limits<float>::max() || - maxDist == std::numeric_limits<float>::infinity()) + if (maxDist == std::numeric_limits<float>::max() || !std::isfinite(maxDist)) return false; // valid map coords should *never ever* produce float overflow, but this would produce NaNs too diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 1b99e282132..de97943bb37 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -140,6 +140,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn } #endif + owner = &go; return true; } @@ -161,7 +162,7 @@ GameObjectModel* GameObjectModel::Create(const GameObject& go) bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const { - if (!(phasemask & ph_mask)) + if (!(phasemask & ph_mask) || !owner->isSpawned()) return false; float time = ray.intersectionTime(iBound); diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h index 6088b924343..99c9b1337b3 100644 --- a/src/server/collision/Models/GameObjectModel.h +++ b/src/server/collision/Models/GameObjectModel.h @@ -44,8 +44,9 @@ class GameObjectModel /*, public Intersectable*/ float iInvScale; float iScale; VMAP::WorldModel* iModel; + GameObject const* owner; - GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL) { } + GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL), owner(NULL) { } bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); public: diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index e2eeaf880ad..7c640f9a66d 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -89,7 +89,8 @@ void PetAI::UpdateAI(uint32 diff) if (me->GetVictim() && me->EnsureVictim()->IsAlive()) { // is only necessary to stop casting, the pet must not exit combat - if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) + if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL) && // ignore channeled spells (Pin, Seduction) + me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) { me->InterruptNonMeleeSpells(false); return; @@ -459,9 +460,6 @@ void PetAI::DoAttack(Unit* target, bool chase) if (me->Attack(target, true)) { - if (Unit* owner = me->GetOwner()) - owner->SetInCombatWith(target); - // Play sound to let the player know the pet is attacking something it picked on its own if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack()) me->SendPetAIReaction(me->GetGUID()); diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 9631b75fe06..cb32740e068 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -103,7 +103,7 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid) ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (unit->GetTypeId() == TYPEID_PLAYER) me->AddAura(spellid, unit); } @@ -117,7 +117,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered) ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (unit->GetTypeId() == TYPEID_PLAYER) me->CastSpell(unit, spellid, triggered); } diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index dd8b42deb9f..ac9de00cd10 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -43,6 +43,11 @@ void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= NULL*/) sCreatureTextMgr->SendChat(me, id, whisperTarget); } +void CreatureAI::TalkToMap(uint8 id, WorldObject const* whisperTarget /*= NULL*/) +{ + sCreatureTextMgr->SendChat(me, id, whisperTarget, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); +} + void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/) { if (!creature) diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 6357ac33f1e..209995d359d 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -79,6 +79,7 @@ class CreatureAI : public UnitAI public: void Talk(uint8 id, WorldObject const* whisperTarget = NULL); + void TalkToMap(uint8 id, WorldObject const* whisperTarget = NULL); explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { } virtual ~CreatureAI() { } diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 7447e290ba9..838171a544e 100644 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -311,359 +311,6 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, c } } -class EventMap -{ - /** - * Internal storage type. - * Key: Time as uint32 when the event should occur. - * Value: The event data as uint32. - * - * Structure of event data: - * - Bit 0 - 15: Event Id. - * - Bit 16 - 23: Group - * - Bit 24 - 31: Phase - * - Pattern: 0xPPGGEEEE - */ - typedef std::multimap<uint32, uint32> EventStore; - - public: - EventMap() : _time(0), _phase(0) { } - - /** - * @name Reset - * @brief Removes all scheduled events and resets time and phase. - */ - void Reset() - { - _eventMap.clear(); - _time = 0; - _phase = 0; - } - - /** - * @name Update - * @brief Updates the timer of the event map. - * @param time Value to be added to time. - */ - void Update(uint32 time) - { - _time += time; - } - - /** - * @name GetTimer - * @return Current timer value. - */ - uint32 GetTimer() const - { - return _time; - } - - /** - * @name GetPhaseMask - * @return Active phases as mask. - */ - uint8 GetPhaseMask() const - { - return _phase; - } - - /** - * @name Empty - * @return True, if there are no events scheduled. - */ - bool Empty() const - { - return _eventMap.empty(); - } - - /** - * @name SetPhase - * @brief Sets the phase of the map (absolute). - * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase. - */ - void SetPhase(uint8 phase) - { - if (!phase) - _phase = 0; - else if (phase <= 8) - _phase = (1 << (phase - 1)); - } - - /** - * @name AddPhase - * @brief Activates the given phase (bitwise). - * @param phase Phase which should be activated. Values: 1 - 8 - */ - void AddPhase(uint8 phase) - { - if (phase && phase <= 8) - _phase |= (1 << (phase - 1)); - } - - /** - * @name RemovePhase - * @brief Deactivates the given phase (bitwise). - * @param phase Phase which should be deactivated. Values: 1 - 8. - */ - void RemovePhase(uint8 phase) - { - if (phase && phase <= 8) - _phase &= ~(1 << (phase - 1)); - } - - /** - * @name ScheduleEvent - * @brief Creates new event entry in map. - * @param eventId The id of the new event. - * @param time The time in milliseconds until the event occurs. - * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. - * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. - */ - void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0) - { - if (group && group <= 8) - eventId |= (1 << (group + 15)); - - if (phase && phase <= 8) - eventId |= (1 << (phase + 23)); - - _eventMap.insert(EventStore::value_type(_time + time, eventId)); - } - - /** - * @name RescheduleEvent - * @brief Cancels the given event and reschedules it. - * @param eventId The id of the event. - * @param time The time in milliseconds until the event occurs. - * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. - * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. - */ - void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0) - { - CancelEvent(eventId); - ScheduleEvent(eventId, time, group, phase); - } - - /** - * @name RepeatEvent - * @brief Cancels the closest event and reschedules it. - * @param time Time until the event occurs. - */ - void RepeatEvent(uint32 time) - { - if (Empty()) - return; - - uint32 eventId = _eventMap.begin()->second; - _eventMap.erase(_eventMap.begin()); - ScheduleEvent(eventId, time); - } - - /** - * @name PopEvent - * @brief Remove the first event in the map. - */ - void PopEvent() - { - if (!Empty()) - _eventMap.erase(_eventMap.begin()); - } - - /** - * @name ExecuteEvent - * @brief Returns the next event to execute and removes it from map. - * @return Id of the event to execute. - */ - uint32 ExecuteEvent() - { - while (!Empty()) - { - EventStore::iterator itr = _eventMap.begin(); - - if (itr->first > _time) - return 0; - else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase)) - _eventMap.erase(itr); - else - { - uint32 eventId = (itr->second & 0x0000FFFF); - _eventMap.erase(itr); - return eventId; - } - } - - return 0; - } - - /** - * @name GetEvent - * @brief Returns the next event to execute. - * @return Id of the event to execute. - */ - uint32 GetEvent() - { - while (!Empty()) - { - EventStore::iterator itr = _eventMap.begin(); - - if (itr->first > _time) - return 0; - else if (_phase && (itr->second & 0xFF000000) && !(itr->second & (_phase << 24))) - _eventMap.erase(itr); - else - return (itr->second & 0x0000FFFF); - } - - return 0; - } - - /** - * @name DelayEvents - * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0. - * @param delay Amount of delay. - */ - void DelayEvents(uint32 delay) - { - _time = delay < _time ? _time - delay : 0; - } - - /** - * @name DelayEvents - * @brief Delay all events of the same group. - * @param delay Amount of delay. - * @param group Group of the events. - */ - void DelayEvents(uint32 delay, uint32 group) - { - if (!group || group > 8 || Empty()) - return; - - EventStore delayed; - - for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) - { - if (itr->second & (1 << (group + 15))) - { - delayed.insert(EventStore::value_type(itr->first + delay, itr->second)); - _eventMap.erase(itr++); - } - else - ++itr; - } - - _eventMap.insert(delayed.begin(), delayed.end()); - } - - /** - * @name CancelEvent - * @brief Cancels all events of the specified id. - * @param eventId Event id to cancel. - */ - void CancelEvent(uint32 eventId) - { - if (Empty()) - return; - - for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) - { - if (eventId == (itr->second & 0x0000FFFF)) - _eventMap.erase(itr++); - else - ++itr; - } - } - - /** - * @name CancelEventGroup - * @brief Cancel events belonging to specified group. - * @param group Group to cancel. - */ - void CancelEventGroup(uint32 group) - { - if (!group || group > 8 || Empty()) - return; - - for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) - { - if (itr->second & (1 << (group + 15))) - _eventMap.erase(itr++); - else - ++itr; - } - } - - /** - * @name GetNextEventTime - * @brief Returns closest occurence of specified event. - * @param eventId Wanted event id. - * @return Time of found event. - */ - uint32 GetNextEventTime(uint32 eventId) const - { - if (Empty()) - return 0; - - for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr) - if (eventId == (itr->second & 0x0000FFFF)) - return itr->first; - - return 0; - } - - /** - * @name GetNextEventTime - * @return Time of next event. - */ - uint32 GetNextEventTime() const - { - return Empty() ? 0 : _eventMap.begin()->first; - } - - /** - * @name IsInPhase - * @brief Returns wether event map is in specified phase or not. - * @param phase Wanted phase. - * @return True, if phase of event map contains specified phase. - */ - bool IsInPhase(uint8 phase) - { - return phase <= 8 && (!phase || _phase & (1 << (phase - 1))); - } - - private: - /** - * @name _time - * @brief Internal timer. - * - * This does not represent the real date/time value. - * It's more like a stopwatch: It can run, it can be stopped, - * it can be resetted and so on. Events occur when this timer - * has reached their time value. Its value is changed in the - * Update method. - */ - uint32 _time; - - /** - * @name _phase - * @brief Phase mask of the event map. - * - * Contains the phases the event map is in. Multiple - * phases from 1 to 8 can be set with SetPhase or - * AddPhase. RemovePhase deactives a phase. - */ - uint8 _phase; - - /** - * @name _eventMap - * @brief Internal event storage map. Contains the scheduled events. - * - * See typedef at the beginning of the class for more - * details. - */ - EventStore _eventMap; -}; - enum AITarget { AITARGET_SELF, diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 48870a12a25..614f5826824 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -37,7 +37,7 @@ void SummonList::DoZoneInCombat(uint32 entry) { for (StorageType::iterator i = storage_.begin(); i != storage_.end();) { - Creature* summon = Unit::GetCreature(*me, *i); + Creature* summon = ObjectAccessor::GetCreature(*me, *i); ++i; if (summon && summon->IsAIEnabled && (!entry || summon->GetEntry() == entry)) @@ -51,7 +51,7 @@ void SummonList::DespawnEntry(uint32 entry) { for (StorageType::iterator i = storage_.begin(); i != storage_.end();) { - Creature* summon = Unit::GetCreature(*me, *i); + Creature* summon = ObjectAccessor::GetCreature(*me, *i); if (!summon) i = storage_.erase(i); else if (summon->GetEntry() == entry) @@ -68,7 +68,7 @@ void SummonList::DespawnAll() { while (!storage_.empty()) { - Creature* summon = Unit::GetCreature(*me, storage_.front()); + Creature* summon = ObjectAccessor::GetCreature(*me, storage_.front()); storage_.pop_front(); if (summon) summon->DespawnOrUnsummon(); @@ -79,7 +79,7 @@ void SummonList::RemoveNotExisting() { for (StorageType::iterator i = storage_.begin(); i != storage_.end();) { - if (Unit::GetCreature(*me, *i)) + if (ObjectAccessor::GetCreature(*me, *i)) ++i; else i = storage_.erase(i); @@ -90,7 +90,7 @@ bool SummonList::HasEntry(uint32 entry) const { for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i) { - Creature* summon = Unit::GetCreature(*me, *i); + Creature* summon = ObjectAccessor::GetCreature(*me, *i); if (summon && summon->GetEntry() == entry) return true; } @@ -271,7 +271,7 @@ void ScriptedAI::DoResetThreat() for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && DoGetThreat(unit)) DoModifyThreatPercent(unit, -100); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 4d49fcf4449..e03bbd8c6a2 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -98,7 +98,7 @@ public: Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max); for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); ) { - Creature* summon = Unit::GetCreature(*me, *i++); + Creature* summon = ObjectAccessor::GetCreature(*me, *i++); if (summon && summon->IsAIEnabled) summon->AI()->DoAction(info); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 098f3130fed..ecaa20284d7 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -437,8 +437,11 @@ void SmartAI::EnterEvadeMode() } else if (mFollowGuid) { - if (Unit* target = me->GetUnit(*me, mFollowGuid)) + if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid)) me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); + + // evade is not cleared in MoveFollow, so we can't keep it + me->ClearUnitState(UNIT_STATE_EVADE); } else me->GetMotionMaster()->MoveTargetedHome(); @@ -618,10 +621,7 @@ void SmartAI::DamageTaken(Unit* doneBy, uint32& damage) { GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage); if (mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel)) - { - damage = 0; - me->SetHealth(mInvincibilityHpLevel); - } + damage = me->GetHealth() - mInvincibilityHpLevel; // damage should not be nullified, because of player damage req. } void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 6c250fdfba6..97fe3b80f10 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -429,7 +429,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) { - if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) + if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) { me->getThreatManager().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i", @@ -2601,7 +2601,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) - if (Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid())) + if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) l->push_back(temp); } break; @@ -3461,16 +3461,10 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at) void SmartScript::OnMoveInLineOfSight(Unit* who) { - ProcessEventsFor(SMART_EVENT_OOC_LOS, who); - if (!me) return; - if (me->GetVictim()) - return; - - ProcessEventsFor(SMART_EVENT_IC_LOS, who); - + ProcessEventsFor(me->IsInCombat() ? SMART_EVENT_IC_LOS : SMART_EVENT_OOC_LOS, who); } /* diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index adb9c55a7ac..59a8f046a6b 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -504,7 +504,7 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea return false; } - rbac::RBACData rbac(accountId, "", realmId); + rbac::RBACData rbac(accountId, "", realmId, GetSecurity(accountId)); rbac.LoadFromDB(); bool hasPermission = rbac.HasPermission(permissionId); diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index a136ed8a438..a797f6109ca 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -55,7 +55,7 @@ Battlefield::Battlefield() m_uiKickAfkPlayersTimer = 1000; - m_LastResurectTimer = 30 * IN_MILLISECONDS; + m_LastResurrectTimer = 30 * IN_MILLISECONDS; m_StartGroupingTimer = 0; m_StartGrouping = false; StalkerGuid = 0; @@ -185,15 +185,15 @@ bool Battlefield::Update(uint32 diff) } - if (m_LastResurectTimer <= diff) + if (m_LastResurrectTimer <= diff) { for (uint8 i = 0; i < m_GraveyardList.size(); i++) if (GetGraveyardById(i)) m_GraveyardList[i]->Resurrect(); - m_LastResurectTimer = RESURRECTION_INTERVAL; + m_LastResurrectTimer = RESURRECTION_INTERVAL; } else - m_LastResurectTimer -= diff; + m_LastResurrectTimer -= diff; return objective_changed; } @@ -634,7 +634,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid) void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid) { WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); - uint32 time = m_LastResurectTimer; // resurrect every 30 seconds + uint32 time = m_LastResurrectTimer; // resurrect every 30 seconds data << guid << time; ASSERT(player && player->GetSession()); @@ -713,7 +713,7 @@ void BfGraveyard::Resurrect() if (Creature* spirit = m_Bf->GetCreature(m_SpiritGuide[m_ControlTeam])) spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true); - // Resurect player + // Resurrect player player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true); player->ResurrectPlayer(1.0f); player->CastSpell(player, 6962, true); diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 4e2e28f124c..1b142d1c89f 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -174,7 +174,7 @@ class BfGraveyard // Check if this graveyard has a spirit guide bool HasNpc(uint64 guid); - // Check if a player is in this graveyard's ressurect queue + // Check if a player is in this graveyard's resurrect queue bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } // Get the graveyard's ID. @@ -387,7 +387,7 @@ class Battlefield : public ZoneScript // Graveyard variables GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle - uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec + uint32 m_LastResurrectTimer; // Timer for resurrect player every 30 sec uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle bool m_StartGrouping; // bool for know if all players in area has been invited diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 24e01cf5b37..dff99280e73 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -273,7 +273,7 @@ void Battleground::Update(uint32 diff) } else { - _ProcessRessurect(diff); + _ProcessResurrect(diff); if (sBattlegroundMgr->GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam())) _ProcessProgress(diff); else if (m_PrematureCountDown) @@ -342,10 +342,10 @@ inline void Battleground::_ProcessOfflineQueue() } } -inline void Battleground::_ProcessRessurect(uint32 diff) +inline void Battleground::_ProcessResurrect(uint32 diff) { // ********************************************************* - // *** BATTLEGROUND RESSURECTION SYSTEM *** + // *** BATTLEGROUND RESURRECTION SYSTEM *** // ********************************************************* // this should be handled by spell system m_LastResurrectTime += diff; diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 2feb15e2ee6..205d03c1e61 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -561,7 +561,7 @@ class Battleground Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const; void _ProcessOfflineQueue(); - void _ProcessRessurect(uint32 diff); + void _ProcessResurrect(uint32 diff); void _ProcessProgress(uint32 diff); void _ProcessLeave(uint32 diff); void _ProcessJoin(uint32 diff); diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 8c2d60aac5f..7354be4a9b4 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -17,7 +17,6 @@ #include "CalendarMgr.h" #include "QueryResult.h" -#include "DatabaseEnv.h" #include "Log.h" #include "Player.h" #include "GuildMgr.h" @@ -128,6 +127,12 @@ void CalendarMgr::AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType s void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite) { + SQLTransaction dummy; + AddInvite(calendarEvent, invite, dummy); +} + +void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans) +{ if (!calendarEvent->IsGuildAnnouncement()) SendCalendarEventInvite(*invite); @@ -137,7 +142,7 @@ void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite if (!calendarEvent->IsGuildAnnouncement()) { _invites[invite->GetEventId()].push_back(invite); - UpdateInvite(invite); + UpdateInvite(invite, trans); } } @@ -221,7 +226,6 @@ void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent) { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT); stmt->setUInt64(0, calendarEvent->GetEventId()); stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID())); @@ -232,13 +236,17 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent) stmt->setUInt32(6, uint32(calendarEvent->GetEventTime())); stmt->setUInt32(7, calendarEvent->GetFlags()); stmt->setUInt32(8, calendarEvent->GetTimeZoneTime()); // correct? - trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans); + CharacterDatabase.Execute(stmt); } void CalendarMgr::UpdateInvite(CalendarInvite* invite) { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + SQLTransaction dummy; + UpdateInvite(invite, dummy); +} + +void CalendarMgr::UpdateInvite(CalendarInvite* invite, SQLTransaction& trans) +{ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE); stmt->setUInt64(0, invite->GetInviteId()); stmt->setUInt64(1, invite->GetEventId()); @@ -248,8 +256,7 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite) stmt->setUInt32(5, uint32(invite->GetStatusTime())); stmt->setUInt8(6, invite->GetRank()); stmt->setString(7, invite->GetText()); - trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans); + CharacterDatabase.ExecuteOrAppend(trans, stmt); } void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid) diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h index bdc49ad8e09..eceeda62581 100644 --- a/src/server/game/Calendar/CalendarMgr.h +++ b/src/server/game/Calendar/CalendarMgr.h @@ -20,6 +20,7 @@ #include <ace/Singleton.h> #include "Common.h" +#include "DatabaseEnv.h" #include "WorldPacket.h" enum CalendarMailAnswers @@ -306,8 +307,10 @@ class CalendarMgr void UpdateEvent(CalendarEvent* calendarEvent); void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite); + void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite, SQLTransaction& trans); void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover); void UpdateInvite(CalendarInvite* invite); + void UpdateInvite(CalendarInvite* invite, SQLTransaction& trans); void RemoveAllPlayerEventsAndInvites(uint64 guid); void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId); diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index 9ad6877d929..115e340762e 100644 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -25,7 +25,7 @@ #include "Common.h" -#include "Opcodes.h" +#include "WorldSession.h" #include "WorldPacket.h" class Player; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 57eb0ad3490..f7fd43d7212 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -169,6 +169,7 @@ DBCStorage <NumTalentsAtLevelEntry> sNumTalentsAtLevelStore(NumTalentsAtLevelfmt DBCStorage <OverrideSpellDataEntry> sOverrideSpellDataStore(OverrideSpellDatafmt); +DBCStorage <PowerDisplayEntry> sPowerDisplayStore(PowerDisplayfmt); DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt); DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt); @@ -252,7 +253,10 @@ DBCStorage <WMOAreaTableEntry> sWMOAreaTableStore(WMOAreaTableEntryfmt); DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore(WorldMapAreaEntryfmt); DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore(WorldMapOverlayEntryfmt); DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt); -DBCStorage <PhaseEntry> sPhaseStores(PhaseEntryfmt); +DBCStorage <PhaseEntry> sPhaseStore(PhaseEntryfmt); +DBCStorage <PhaseGroupEntry> sPhaseGroupStore(PhaseGroupfmt); + +PhaseGroupContainer sPhasesByGroup; typedef std::list<std::string> StoreProblemList; @@ -467,7 +471,6 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc"); //15595 LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc");//15595 - LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseStores, dbcPath, "Phase.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sMapStore, dbcPath, "Map.dbc");//15595 @@ -493,7 +496,18 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sOverrideSpellDataStore, dbcPath, "OverrideSpellData.dbc");//15595 + LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseStore, dbcPath, "Phase.dbc"); // 15595 + LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseGroupStore, dbcPath, "PhaseXPhaseGroup.dbc"); // 15595 + + for (uint32 i = 0; i < sPhaseGroupStore.GetNumRows(); ++i) + if (PhaseGroupEntry const* group = sPhaseGroupStore.LookupEntry(i)) + if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseId)) + sPhasesByGroup[group->GroupId].insert(phase->ID); + + LoadDBC(availableDbcLocales, bad_dbc_files, sPowerDisplayStore, dbcPath, "PowerDisplay.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc");//15595 + for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS) @@ -1295,3 +1309,8 @@ uint32 GetDefaultMapLight(uint32 mapId) return 0; } + +std::set<uint32> const& GetPhasesForGroup(uint32 group) +{ + return sPhasesByGroup[group]; +} diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index af7007a17ae..c8a2897b183 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -83,6 +83,8 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty); uint32 GetDefaultMapLight(uint32 mapId); +std::set<uint32> const& GetPhasesForGroup(uint32 group); + extern DBCStorage <AchievementEntry> sAchievementStore; extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore; extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions @@ -173,10 +175,12 @@ extern DBCStorage <MountTypeEntry> sMountTypeStore; extern DBCStorage <NameGenEntry> sNameGenStore; extern DBCStorage <NumTalentsAtLevelEntry> sNumTalentsAtLevelStore; extern DBCStorage <PhaseEntry> sPhaseStore; +extern DBCStorage <PhaseGroupEntry> sPhaseGroupStore; //extern DBCStorage <MapDifficultyEntry> sMapDifficultyStore; -- use GetMapDifficultyData insteed extern MapDifficultyMap sMapDifficultyMap; extern DBCStorage <MovieEntry> sMovieStore; extern DBCStorage <OverrideSpellDataEntry> sOverrideSpellDataStore; +extern DBCStorage <PowerDisplayEntry> sPowerDisplayStore; extern DBCStorage <QuestSortEntry> sQuestSortStore; extern DBCStorage <QuestXPEntry> sQuestXPStore; extern DBCStorage <QuestFactionRewEntry> sQuestFactionRewardStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 1e5c2093b53..feb473958b5 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1472,6 +1472,13 @@ struct PhaseEntry uint32 flag; // 2 }; +struct PhaseGroupEntry +{ + uint32 ID; + uint32 PhaseId; + uint32 GroupId; +}; + struct MailTemplateEntry { uint32 ID; // 0 @@ -1595,6 +1602,16 @@ struct OverrideSpellDataEntry //char* SpellBarName; // 12 }; +struct PowerDisplayEntry +{ + uint32 Id; // 0 + uint32 PowerType; // 1 + //char* Name; // 2 + //uint32 R; // 3 + //uint32 G; // 4 + //uint32 B; // 5 +}; + struct PvPDifficultyEntry { //uint32 id; // 0 m_ID @@ -2281,7 +2298,7 @@ struct VehicleEntry uint32 m_uiLocomotionType; // 34 float m_msslTrgtImpactTexRadius; // 35 uint32 m_uiSeatIndicatorType; // 36 - uint32 m_powerType; // 37, new in 3.1 + uint32 m_powerDisplayId; // 37, new in 3.1 // 38, new in 3.1 // 39, new in 3.1 }; @@ -2505,4 +2522,6 @@ typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath; #define TaxiMaskSize 114 typedef uint8 TaxiMask[TaxiMaskSize]; + +typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer; #endif diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 41dc6afd4f7..31ae5d41fce 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -102,6 +102,7 @@ char const LightEntryfmt[] = "nifffxxxxxxxxxx"; char const LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; char const PhaseEntryfmt[] = "nsi"; +char const PhaseGroupfmt[] = "nii"; char const MailTemplateEntryfmt[] = "nxs"; char const MapEntryfmt[] = "nxiixxsixxixiffxiiii"; char const MapDifficultyEntryfmt[] = "diisiix"; @@ -114,6 +115,7 @@ char const OverrideSpellDatafmt[] = "niiiiiiiiiixx"; char const QuestFactionRewardfmt[] = "niiiiiiiiii"; char const QuestSortEntryfmt[] = "nx"; char const QuestXPfmt[] = "niiiiiiiiii"; +char const PowerDisplayfmt[] = "nixxxx"; char const PvPDifficultyfmt[] = "diiiii"; char const RandomPropertiesPointsfmt[] = "niiiiiiiiiiiiiii"; char const ScalingStatDistributionfmt[] = "niiiiiiiiiiiiiiiiiiiixi"; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 03e32028232..517464fef4a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -111,11 +111,11 @@ uint32 CreatureTemplate::GetFirstValidModelId() const bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { - if (Unit* victim = Unit::GetUnit(m_owner, m_victim)) + if (Unit* victim = ObjectAccessor::GetUnit(m_owner, m_victim)) { while (!m_assistants.empty()) { - Creature* assistant = Unit::GetCreature(m_owner, *m_assistants.begin()); + Creature* assistant = ObjectAccessor::GetCreature(m_owner, *m_assistants.begin()); m_assistants.pop_front(); if (assistant && assistant->CanAssistTo(&m_owner, victim)) @@ -570,7 +570,7 @@ void Creature::Update(uint32 diff) if (getPowerType() == POWER_ENERGY) { - if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerType != POWER_PYRITE) + if (!IsVehicle() || GetVehicleKit()->GetVehicleInfo()->m_powerDisplayId != POWER_PYRITE) Regenerate(POWER_ENERGY); } else diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index c21d730b04c..9e72a124ae0 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -513,7 +513,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << uint32(quest->GetRewHonorAddition()); data << float(quest->GetRewHonorMultiplier()); data << uint32(quest->GetSrcItemId()); // source item id - data << uint32(quest->GetFlags() & 0xFFFF); // quest flags + data << uint32(quest->GetFlags()); // quest flags data << uint32(quest->GetMinimapTargetMark()); // minimap target mark (skull, etc. missing enum) data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(quest->GetPlayersSlain()); // players slain diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index acfc8da9bc8..f473428d41b 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -562,7 +562,7 @@ void GameObject::Update(uint32 diff) CastSpell(NULL, goInfo->trap.spellId); SetLootState(GO_JUST_DEACTIVATED); } - else if (Unit* target = Unit::GetUnit(*this, m_lootStateUnitGUID)) + else if (Unit* target = ObjectAccessor::GetUnit(*this, m_lootStateUnitGUID)) { // Some traps do not have a spell but should be triggered if (goInfo->trap.spellId) @@ -1101,7 +1101,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f SwitchDoorOrButton(true, alternative); SetLootState(GO_ACTIVATED, user); - m_cooldownTime = time(NULL) + time_to_restore; + m_cooldownTime = time_to_restore ? (time(NULL) + time_to_restore) : 0; } void GameObject::SetGoArtKit(uint8 kit) @@ -1405,6 +1405,7 @@ void GameObject::Use(Unit* user) // prevent removing GO at spell cancel RemoveFromOwner(); SetOwnerGUID(player->GetGUID()); + SetSpellId(0); // prevent removing unintended auras at Unit::RemoveGameObject /// @todo find reasonable value for fishing hole search GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); @@ -2014,6 +2015,10 @@ void GameObject::SetLootState(LootState state, Unit* unit) m_lootStateUnitGUID = unit ? unit->GetGUID() : 0; AI()->OnStateChanged(state, unit); sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); + + if (GetGoType() == GAMEOBJECT_TYPE_DOOR) // only set collision for doors on SetGoState + return; + if (m_model) { bool collision = false; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index a7ebde51372..a2fd19c443c 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -551,9 +551,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const //if (true) // Has time, controlled by bit just after HasTransport *data << uint32(getMSTime()); - *data << self->GetSpeed(MOVE_FLIGHT_BACK); - data->WriteByteSeq(guid[6]); *data << self->GetSpeed(MOVE_TURN_RATE); + data->WriteByteSeq(guid[6]); + *data << self->GetSpeed(MOVE_FLIGHT); if (!G3D::fuzzyEq(self->GetOrientation(), 0.0f)) *data << float(self->GetOrientation()); @@ -561,7 +561,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const if (hasPitch) *data << float(self->m_movementInfo.pitch); - *data << self->GetSpeed(MOVE_FLIGHT); + *data << self->GetSpeed(MOVE_FLIGHT_BACK); } if (flags & UPDATEFLAG_VEHICLE) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2a8217d2028..3f455b69a37 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -150,6 +150,8 @@ uint32 const MasterySpells[MAX_CLASSES] = 87491, // Druid }; +uint64 const MAX_MONEY_AMOUNT = static_cast<uint64>(std::numeric_limits<int64>::max()); + // == PlayerTaxi ================================================ PlayerTaxi::PlayerTaxi() @@ -707,6 +709,8 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this) m_areaUpdateId = 0; m_team = 0; + m_needsZoneUpdate = false; + m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); _resurrectionData = NULL; @@ -5926,31 +5930,30 @@ float Player::OCTRegenMPPerSpirit() void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) { - m_baseRatingValue[cr] +=(apply ? value : -value); + m_baseRatingValue[cr] += (apply ? value : -value); // explicit affected values + float const mult = GetRatingMultiplier(cr); + float const oldVal = m_baseRatingValue[cr] * mult; + float const newVal = m_baseRatingValue[cr] * mult; + switch (cr) { case CR_HASTE_MELEE: - { - float RatingChange = value * GetRatingMultiplier(cr); - ApplyAttackTimePercentMod(BASE_ATTACK, RatingChange, apply); - ApplyAttackTimePercentMod(OFF_ATTACK, RatingChange, apply); - if (getClass() == CLASS_DEATH_KNIGHT) - UpdateAllRunesRegen(); + ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false); + ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false); + ApplyAttackTimePercentMod(BASE_ATTACK, newVal, true); + ApplyAttackTimePercentMod(OFF_ATTACK, newVal, true); break; - } case CR_HASTE_RANGED: - { - ApplyAttackTimePercentMod(RANGED_ATTACK, value * GetRatingMultiplier(cr), apply); + ApplyAttackTimePercentMod(RANGED_ATTACK, oldVal, false); + ApplyAttackTimePercentMod(RANGED_ATTACK, newVal, true); break; - } case CR_HASTE_SPELL: - { - ApplyCastTimePercentMod(value * GetRatingMultiplier(cr), apply); + ApplyCastTimePercentMod(oldVal, false); + ApplyCastTimePercentMod(newVal, true); break; - } - default: + default: // shut up compiler warnings break; } @@ -6727,6 +6730,15 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t // mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING); //AURA_INTERRUPT_FLAG_JUMP not sure + // Update player zone if needed + if (m_needsZoneUpdate) + { + uint32 newZone, newArea; + GetZoneAndAreaId(newZone, newArea); + UpdateZone(newZone, newArea); + m_needsZoneUpdate = false; + } + // group update if (GetGroup()) SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); @@ -7802,6 +7814,19 @@ void Player::UpdateArea(uint32 newArea) else RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); + uint32 const areaRestFlag = (GetTeam() == ALLIANCE) ? AREA_FLAG_REST_ZONE_ALLIANCE : AREA_FLAG_REST_ZONE_HORDE; + if (area && area->flags & areaRestFlag) + { + SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); + SetRestType(REST_TYPE_IN_FACTION_AREA); + InnEnter(time(0), GetMapId(), 0, 0, 0); + } + else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_FACTION_AREA) + { + RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); + SetRestType(REST_TYPE_NO); + } + phaseMgr.RemoveUpdateFlag(PHASE_UPDATE_FLAG_AREA_UPDATE); } @@ -7890,8 +7915,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) SetRestType(REST_TYPE_NO); } } - else // Recently left a capital city + else if (GetRestType() != REST_TYPE_IN_FACTION_AREA) // handled in UpdateArea { + // Recently left a capital city RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); } @@ -8488,7 +8514,12 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType att { HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply); if (unitModType == TOTAL_VALUE) - ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply); + { + if (aura->GetAmount() > 0) + ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply); + else + ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, aura->GetAmount(), apply); + } } } @@ -14832,7 +14863,7 @@ void Player::SendPreparedQuest(uint64 guid) if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true)) AddQuestAndCheckCompletion(quest, object); - if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) + if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanCompleteRepeatableQuest(quest), true); else PlayerTalkClass->SendQuestGiverQuestDetails(quest, guid, true); @@ -14900,7 +14931,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest) switch (GUID_HIPART(guid)) { case HIGHGUID_PLAYER: - ASSERT(quest->HasFlag(QUEST_FLAGS_AUTO_SUBMIT)); + ASSERT(quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)); return sObjectMgr->GetQuestTemplate(nextQuestID); case HIGHGUID_UNIT: case HIGHGUID_PET: @@ -15001,7 +15032,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) return false; // not allow re-complete quest // auto complete quest - if ((qInfo->IsAutoComplete() || qInfo->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && CanTakeQuest(qInfo, false)) + if (qInfo->IsAutoComplete() && CanTakeQuest(qInfo, false)) return true; QuestStatusMap::iterator itr = m_QuestStatus.find(quest_id); @@ -15081,7 +15112,7 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest) bool Player::CanRewardQuest(Quest const* quest, bool msg) { // not auto complete quest and not completed quest (only cheating case, then ignore without message) - if (!quest->IsDFQuest() && !quest->IsAutoComplete() && !(quest->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE) + if (!quest->IsDFQuest() && !quest->IsAutoComplete() && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE) return false; // daily quest can't be rewarded (25 daily quest already completed) @@ -16455,9 +16486,7 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) uint16 curitemcount = q_status.ItemCount[j]; if (curitemcount < reqitemcount) { - uint16 additemcount = curitemcount + count <= reqitemcount ? count : reqitemcount - curitemcount; - q_status.ItemCount[j] += additemcount; - + q_status.ItemCount[j] = std::min<uint16>(q_status.ItemCount[j] + count, reqitemcount); m_QuestStatusSave[questid] = true; //SendQuestUpdateAddItem(qInfo, j, additemcount); @@ -16479,9 +16508,11 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) uint32 questid = GetQuestSlotQuestId(i); if (!questid) continue; + Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid); if (!qInfo) continue; + if (!qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) continue; @@ -16493,18 +16524,17 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) QuestStatusData& q_status = m_QuestStatus[questid]; uint32 reqitemcount = qInfo->RequiredItemCount[j]; - uint16 curitemcount; - if (q_status.Status != QUEST_STATUS_COMPLETE) - curitemcount = q_status.ItemCount[j]; - else - curitemcount = GetItemCount(entry, true); - if (curitemcount < reqitemcount + count) - { - uint16 remitemcount = curitemcount <= reqitemcount ? count : count + reqitemcount - curitemcount; - q_status.ItemCount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount; + uint16 curitemcount = q_status.ItemCount[j]; - m_QuestStatusSave[questid] = true; + if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows + curitemcount = GetItemCount(entry, false); + uint16 newItemCount = (count > curitemcount) ? 0 : curitemcount - count; + newItemCount = std::min<uint16>(newItemCount, reqitemcount); + if (newItemCount != q_status.ItemCount[j]) + { + q_status.ItemCount[j] = newItemCount; + m_QuestStatusSave[questid] = true; IncompleteQuest(questid); } return; @@ -22682,7 +22712,7 @@ void Player::UpdatePotionCooldown(Spell* spell) void Player::SetResurrectRequestData(Unit* caster, uint32 health, uint32 mana, uint32 appliedAura) { - ASSERT(!IsRessurectRequested()); + ASSERT(!IsResurrectRequested()); _resurrectionData = new ResurrectionData(); _resurrectionData->GUID = caster->GetGUID(); _resurrectionData->Location.WorldRelocate(*caster); @@ -23250,7 +23280,7 @@ bool Player::ModifyMoney(int64 amount, bool sendError /*= true*/) SetMoney(GetMoney() > uint64(-amount) ? GetMoney() + amount : 0); else { - if (GetMoney() < uint64(MAX_MONEY_AMOUNT - amount)) + if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint64>(amount)) SetMoney(GetMoney() + amount); else { @@ -24518,7 +24548,7 @@ bool Player::IsAtRecruitAFriendDistance(WorldObject const* pOther) const return pOther->GetDistance(player) <= sWorld->getFloatConfig(CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE); } -void Player::ResurectUsingRequestData() +void Player::ResurrectUsingRequestData() { /// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse float x, y, z, o; @@ -27575,6 +27605,11 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy return pet; } +bool Player::IsLoading() const +{ + return GetSession()->PlayerLoading(); +} + bool Player::CanUseMastery() const { return HasSpell(MasterySpells[getClass()]); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index e417d24f793..94d90de8813 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -32,6 +32,7 @@ #include "Opcodes.h" #include "WorldSession.h" +#include <limits> #include <string> #include <vector> @@ -801,9 +802,10 @@ class InstanceSave; enum RestType { - REST_TYPE_NO = 0, - REST_TYPE_IN_TAVERN = 1, - REST_TYPE_IN_CITY = 2 + REST_TYPE_NO = 0, + REST_TYPE_IN_TAVERN = 1, + REST_TYPE_IN_CITY = 2, + REST_TYPE_IN_FACTION_AREA = 3 // used with AREA_FLAG_REST_ZONE_* }; enum TeleportToOptions @@ -902,7 +904,8 @@ enum PlayerDelayedOperations // Player summoning auto-decline time (in secs) #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) -#define MAX_MONEY_AMOUNT (UI64LIT(9999999999)) // TODO: Move this restriction to worldserver.conf, default to this value, hardcap at uint64.max +// Maximum money amount : 2^31 - 1 +extern uint64 const MAX_MONEY_AMOUNT; struct InstancePlayerBind { @@ -1867,16 +1870,16 @@ class Player : public Unit, public GridObject<Player> _resurrectionData = NULL; } - bool IsRessurectRequestedBy(uint64 guid) const + bool IsResurrectRequestedBy(uint64 guid) const { - if (!IsRessurectRequested()) + if (!IsResurrectRequested()) return false; return _resurrectionData->GUID == guid; } - bool IsRessurectRequested() const { return _resurrectionData != NULL; } - void ResurectUsingRequestData(); + bool IsResurrectRequested() const { return _resurrectionData != NULL; } + void ResurrectUsingRequestData(); uint8 getCinematic() { return m_cinematic; } void setCinematic(uint8 cine) { m_cinematic = cine; } @@ -1894,6 +1897,7 @@ class Player : public Unit, public GridObject<Player> void UpdatePvP(bool state, bool override=false); void UpdateZone(uint32 newZone, uint32 newArea); void UpdateArea(uint32 newArea); + void SetNeedsZoneUpdate(bool needsUpdate) { m_needsZoneUpdate = needsUpdate; } void UpdateZoneDependentAuras(uint32 zone_id); // zones void UpdateAreaDependentAuras(uint32 area_id); // subzones @@ -2521,6 +2525,8 @@ class Player : public Unit, public GridObject<Player> std::string GetMapAreaAndZoneString(); std::string GetCoordsMapAreaAndZoneString(); + bool IsLoading() const; + // Void Storage bool IsVoidStorageUnlocked() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); } void UnlockVoidStorage() { SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); } @@ -2812,6 +2818,8 @@ class Player : public Unit, public GridObject<Player> uint8 m_grantableLevels; + bool m_needsZoneUpdate; + CUFProfile* _CUFProfiles[MAX_CUF_PROFILES]; private: diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index f505c8dd64d..6e593951f2c 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -19,7 +19,7 @@ #include "SocialMgr.h" #include "DatabaseEnv.h" -#include "Opcodes.h" +#include "WorldSession.h" #include "WorldPacket.h" #include "Player.h" #include "ObjectMgr.h" diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index afc2856fb32..8d5aa293d06 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -754,7 +754,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (damagetype != NODAMAGE && damage) { - if (victim != this && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back + if (victim != this && victim->GetTypeId() == TYPEID_PLAYER && // does not support creature push_back + (!spellProto || !(spellProto->AttributesEx7 & SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE))) { if (damagetype != DOT) if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL]) @@ -956,79 +957,85 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask); - if (IsDamageReducedByArmor(damageSchoolMask, spellInfo)) - damage = CalcArmorReducedDamage(victim, damage, spellInfo, attackType); - - bool blocked = false; - // Per-school calc - switch (spellInfo->DmgClass) + // Spells with SPELL_ATTR4_FIXED_DAMAGE ignore resilience because their damage is based off another spell's damage. + if (!(spellInfo->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE)) { - // Melee and Ranged Spells - case SPELL_DAMAGE_CLASS_RANGED: - case SPELL_DAMAGE_CLASS_MELEE: + if (IsDamageReducedByArmor(damageSchoolMask, spellInfo)) + damage = CalcArmorReducedDamage(victim, damage, spellInfo, attackType); + + bool blocked = false; + // Per-school calc + switch (spellInfo->DmgClass) { - // Physical Damage - if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) + // Melee and Ranged Spells + case SPELL_DAMAGE_CLASS_RANGED: + case SPELL_DAMAGE_CLASS_MELEE: { - // Get blocked status - blocked = isSpellBlocked(victim, spellInfo, attackType); - } + // Physical Damage + if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) + { + // Get blocked status + blocked = isSpellBlocked(victim, spellInfo, attackType); + } - if (crit) - { - damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; - - // Calculate crit bonus - uint32 crit_bonus = damage; - // Apply crit_damage bonus for melee spells - if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); - damage += crit_bonus; - - // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE - float critPctDamageMod = 0.0f; - if (attackType == RANGED_ATTACK) - critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE); - else - critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE); + if (crit) + { + damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; + + // Calculate crit bonus + uint32 crit_bonus = damage; + // Apply crit_damage bonus for melee spells + if (Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); + damage += crit_bonus; + + // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE + float critPctDamageMod = 0.0f; + if (attackType == RANGED_ATTACK) + critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE); + else + critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE); - // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS - critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()) - 1.0f) * 100; + // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS + critPctDamageMod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()) - 1.0f) * 100; - if (critPctDamageMod != 0) - AddPct(damage, critPctDamageMod); - } + if (critPctDamageMod != 0) + AddPct(damage, critPctDamageMod); + } - // Spell weapon based damage CAN BE crit & blocked at same time - if (blocked) - { - // double blocked amount if block is critical - uint32 value = victim->GetBlockPercent(); - if (victim->isBlockCritical()) - value *= 2; // double blocked percent - damageInfo->blocked = CalculatePct(damage, value); - damage -= damageInfo->blocked; - } + // Spell weapon based damage CAN BE crit & blocked at same time + if (blocked) + { + // double blocked amount if block is critical + uint32 value = victim->GetBlockPercent(); + if (victim->isBlockCritical()) + value *= 2; // double blocked percent + damageInfo->blocked = CalculatePct(damage, value); + damage -= damageInfo->blocked; + } - ApplyResilience(victim, &damage); - break; - } - // Magical Attacks - case SPELL_DAMAGE_CLASS_NONE: - case SPELL_DAMAGE_CLASS_MAGIC: - { - // If crit add critical bonus - if (crit) - { - damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; - damage = SpellCriticalDamageBonus(spellInfo, damage, victim); + ApplyResilience(victim, &damage); + break; } + // Magical Attacks + case SPELL_DAMAGE_CLASS_NONE: + case SPELL_DAMAGE_CLASS_MAGIC: + { + // If crit add critical bonus + if (crit) + { + damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; + damage = SpellCriticalDamageBonus(spellInfo, damage, victim); - ApplyResilience(victim, &damage); - break; + } + + ApplyResilience(victim, &damage); + break; + + } + default: + break; } - default: - break; } // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations @@ -1735,14 +1742,15 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage())); dmgInfo.AbsorbDamage(splitDamage); - uint32 splitted = splitDamage; uint32 split_absorb = 0; - DealDamageMods(caster, splitted, &split_absorb); + DealDamageMods(caster, splitDamage, &split_absorb); - SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false); + SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitDamage, schoolMask, split_absorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL); - DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false); + CleanDamage cleanDamage = CleanDamage(splitDamage, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + DealDamage(caster, splitDamage, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false); + // break 'Fear' and similar auras + caster->ProcDamageAndSpellFor(true, this, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_NORMAL_HIT, BASE_ATTACK, (*itr)->GetSpellInfo(), splitDamage); } } @@ -8407,11 +8415,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS) return pdamage; - // small exception for Deep Wounds, can't find any general rule - // should ignore ALL damage mods, they already calculated in trigger spell - if (spellProto->Id == 12721) // Deep Wounds - return pdamage; - // For totems get damage bonus from owner if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem()) if (Unit* owner = GetOwner()) @@ -8427,7 +8430,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); // Some spells don't benefit from pct done mods - if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS) && !spellProto->IsRankOf(sSpellMgr->GetSpellInfo(12162))) + if (!(spellProto->AttributesEx6 & SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS)) { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) @@ -8678,18 +8681,15 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui float TakenTotalMod = 1.0f; float TakenTotalCasterMod = 0.0f; - // get all auras from caster that allow the spell to ignore resistance (sanctified wrath) - AuraEffectList const& IgnoreResistAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) + // Mod damage from spell mechanic + if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) { - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) - TakenTotalCasterMod += (float((*i)->GetAmount())); + AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) + if (mechanicMask & uint32(1 << ((*i)->GetMiscValue()))) + AddPct(TakenTotalMod, (*i)->GetAmount()); } - // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN - // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) - TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask()); - //.. taken pct: dummy auras AuraEffectList const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) @@ -8707,45 +8707,47 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui break; } } - - // From caster spells - AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectingSpell(spellProto)) - AddPct(TakenTotalMod, (*i)->GetAmount()); - - // Mod damage from spell mechanic - if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) + // Spells with SPELL_ATTR4_FIXED_DAMAGE should only benefit from mechanic damage mod auras. + if (!(spellProto->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE)) { - AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); - for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) - if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) - AddPct(TakenTotalMod, (*i)->GetAmount()); - } + // get all auras from caster that allow the spell to ignore resistance (sanctified wrath) + AuraEffectList const& IgnoreResistAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator i = IgnoreResistAuras.begin(); i != IgnoreResistAuras.end(); ++i) + { + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + TakenTotalCasterMod += (float((*i)->GetAmount())); + } - int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask()); + // From caster spells + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectingSpell(spellProto)) + AddPct(TakenTotalMod, (*i)->GetAmount()); - // Check for table values - float coeff = 0; - SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); - if (bonus) - coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; + int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask()); - // Default calculation - if (TakenAdvertisedBenefit) - { - if (!bonus || coeff < 0) - coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + // Check for table values + float coeff = 0; + SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); + if (bonus) + coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; - float factorMod = CalculateLevelPenalty(spellProto) * stack; - // level penalty still applied on Taken bonus - is it blizzlike? - if (Player* modOwner = GetSpellModOwner()) + // Default calculation + if (TakenAdvertisedBenefit) { - coeff *= 100.0f; - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); - coeff /= 100.0f; + if (!bonus || coeff < 0) + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + + float factorMod = CalculateLevelPenalty(spellProto) * stack; + // level penalty still applied on Taken bonus - is it blizzlike? + if (Player* modOwner = GetSpellModOwner()) + { + coeff *= 100.0f; + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff); + coeff /= 100.0f; + } + TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); } - TakenTotal+= int32(TakenAdvertisedBenefit * coeff * factorMod); } float tmpDamage = 0.0f; @@ -9471,8 +9473,7 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons // Check for immune to application of harmful magical effects AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL); for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) - if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff - ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school + if (((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school !spellInfo->IsPositiveEffect(index)) // Harmful return true; } @@ -11257,21 +11258,6 @@ float Unit::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spell return spellInfo->GetMinRange(!IsHostileTo(target)); } -Unit* Unit::GetUnit(WorldObject& object, uint64 guid) -{ - return ObjectAccessor::GetUnit(object, guid); -} - -Player* Unit::GetPlayer(WorldObject& object, uint64 guid) -{ - return ObjectAccessor::GetPlayer(object, guid); -} - -Creature* Unit::GetCreature(WorldObject& object, uint64 guid) -{ - return object.GetMap()->GetCreature(guid); -} - uint32 Unit::GetCreatureType() const { if (GetTypeId() == TYPEID_PLAYER) @@ -13589,8 +13575,8 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // update get killing blow achievements, must be done before setDeathState to be able to require auras on target // and before Spirit of Redemption as it also removes auras - if (player) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, 0, victim); + if (Player* killerPlayer = GetCharmerOrOwnerPlayerOrPlayerItself()) + killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, 0, victim); // if talent known but not triggered (check priest class for speedup check) bool spiritOfRedemption = false; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 1cf44bb5ca7..21c55ffe700 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2036,9 +2036,6 @@ class Unit : public WorldObject void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ } - static Unit* GetUnit(WorldObject& object, uint64 guid); - static Player* GetPlayer(WorldObject& object, uint64 guid); - static Creature* GetCreature(WorldObject& object, uint64 guid); MotionMaster* GetMotionMaster() { return i_motionMaster; } const MotionMaster* GetMotionMaster() const { return i_motionMaster; } diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index e40f23fc25c..930c4721f62 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -76,42 +76,9 @@ Vehicle::~Vehicle() void Vehicle::Install() { - if (Creature* creature = _me->ToCreature()) - { - switch (_vehicleInfo->m_powerType) - { - case POWER_STEAM: - case POWER_HEAT: - case POWER_BLOOD: - case POWER_OOZE: - case POWER_WRATH: - _me->setPowerType(POWER_ENERGY); - _me->SetMaxPower(POWER_ENERGY, 100); - break; - case POWER_PYRITE: - _me->setPowerType(POWER_ENERGY); - _me->SetMaxPower(POWER_ENERGY, 50); - break; - default: - for (uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i) - { - if (!creature->m_spells[i]) - continue; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[i]); - if (!spellInfo) - continue; - - if (spellInfo->PowerType == POWER_ENERGY && spellInfo->CalcPowerCost(_me, spellInfo->GetSchoolMask()) > 0) - { - _me->setPowerType(POWER_ENERGY); - _me->SetMaxPower(POWER_ENERGY, 100); - break; - } - } - break; - } - } + if (_me->GetTypeId() == TYPEID_UNIT) + if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(_vehicleInfo->m_powerDisplayId)) + _me->setPowerType(Powers(powerDisplay->PowerType)); _status = STATUS_INSTALLED; if (GetBase()->GetTypeId() == TYPEID_UNIT) diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index a586b389630..5fb10feccf0 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -786,7 +786,7 @@ int32 Guild::Member::GetBankWithdrawValue(uint8 tabId) const { // Guild master has unlimited amount. if (IsRank(GR_GUILDMASTER)) - return tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED; + return static_cast<int32>(tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED); return m_bankWithdraw[tabId]; } @@ -3025,7 +3025,7 @@ inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId) { uint8 rankId = member->GetRankId(); if (rankId == GR_GUILDMASTER) - return GUILD_WITHDRAW_SLOT_UNLIMITED; + return static_cast<int32>(GUILD_WITHDRAW_SLOT_UNLIMITED); if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != 0) { int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId); @@ -3042,7 +3042,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const { uint8 rankId = member->GetRankId(); if (rankId == GR_GUILDMASTER) - return GUILD_WITHDRAW_MONEY_UNLIMITED; + return static_cast<int32>(GUILD_WITHDRAW_MONEY_UNLIMITED); if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != 0) { diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 89e09484458..2f1a726f9cf 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -259,7 +259,14 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) uint32 inviteCount; recvData >> inviteCount; - for (uint32 i = 0; i < inviteCount; ++i) + SQLTransaction trans; + if (inviteCount > 1) + trans = CharacterDatabase.BeginTransaction(); + + // client limits the amount of players to be invited to 100 + const uint32 MaxPlayerInvites = 100; + + for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { uint64 invitee = 0; uint8 status = 0; @@ -269,8 +276,11 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) // 946684800 is 01/01/2000 00:00:00 - default response time CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent.GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), ""); - sCalendarMgr->AddInvite(&calendarEvent, invite); + sCalendarMgr->AddInvite(&calendarEvent, invite, trans); } + + if (inviteCount > 1) + CharacterDatabase.CommitTransaction(trans); } sCalendarMgr->AddEvent(new CalendarEvent(calendarEvent, calendarEvent.GetEventId()), CALENDAR_SENDTYPE_ADD); @@ -354,10 +364,15 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) sCalendarMgr->AddEvent(newEvent, CALENDAR_SENDTYPE_COPY); CalendarInviteStore invites = sCalendarMgr->GetEventInvites(eventId); + SQLTransaction trans; + if (invites.size() > 1) + trans = CharacterDatabase.BeginTransaction(); for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr) - sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId())); + sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()), trans); + if (invites.size() > 1) + CharacterDatabase.CommitTransaction(trans); // should we change owner when somebody makes a copy of event owned by another person? } else diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 97433fc53c3..5345113d106 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -268,8 +268,6 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, false); - // remove expired bans PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS); CharacterDatabase.Execute(stmt); @@ -706,7 +704,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); std::string IP_str = GetRemoteAddress(); TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); @@ -784,8 +781,6 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) WorldPacket data(SMSG_CHAR_DELETE, 1); data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); - - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); } void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) @@ -793,6 +788,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) if (PlayerLoading() || GetPlayer() != NULL) { TC_LOG_ERROR("network", "Player tries to login again, AccountId = %d", GetAccountId()); + KickPlayer(); return; } @@ -1282,7 +1278,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); if (!result) { WorldPacket data(SMSG_CHAR_RENAME, 1); @@ -1533,8 +1528,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); stmt->setUInt32(0, GUID_LOPART(guid)); // TODO: Make async with callback - // TODO 2: Allow opcode at end of callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1789,8 +1782,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint8 playerClass = nameData->m_class; uint8 level = nameData->m_level; - // TO Do: Make async and allow opcode on callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); + // TO Do: Make async PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES); stmt->setUInt32(0, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 214a77ed6ef..422d0d9c7d2 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -327,7 +327,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } Player* receiver = sObjectAccessor->FindPlayerByName(to); - if (!receiver || (!receiver->isAcceptWhispers() && receiver->GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) + if (!receiver || (lang != LANG_ADDON && !receiver->isAcceptWhispers() && receiver->GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) { SendPlayerNotFoundNotice(to); return; diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index b72d79539aa..741dec9bfec 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -87,6 +87,18 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData) return; } + if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + + if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); @@ -139,6 +151,18 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData) return; } + if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + + if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + _player->SwapItem(src, dst); } @@ -780,15 +804,11 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) uint64 guid; recvPacket >> guid; - // cheating protection - /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command. - Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); - if (!creature) + if (!CanUseBank(guid)) { - TC_LOG_DEBUG("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } - */ uint32 slot = _player->GetBankBagSlotCount(); @@ -834,6 +854,12 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + if (!CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) return; @@ -865,6 +891,12 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + if (!CanUseBank()) + { + TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID))); + return; + } + Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) return; @@ -1463,6 +1495,12 @@ void WorldSession::HandleTransmogrifyItems(WorldPacket& recvData) } else { + if (itemTransmogrifier->GetEntry() != newEntries[i]) + { + TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) tried to transmogrify with an invalid entry (entry: %u) for item (lowguid: %u).", player->GetGUIDLow(), player->GetName().c_str(), newEntries[i], GUID_LOPART(itemGuids[i])); + return; + } + if (!Item::CanTransmogrifyItemWithItem(itemTransmogrified, itemTransmogrifier)) { TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - Player (GUID: %u, name: %s) failed CanTransmogrifyItemWithItem (%u with %u).", player->GetGUIDLow(), player->GetName().c_str(), itemTransmogrified->GetEntry(), itemTransmogrifier->GetEntry()); @@ -1549,6 +1587,13 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData) if (!reforgeEntry) { + if (!item->GetEnchantmentId(REFORGE_ENCHANTMENT_SLOT)) + { + TC_LOG_ERROR("network", "WORLD: HandleReforgeItemOpcode - Player (Guid: %u Name: %s) tried to remove reforge from non-reforged item (Entry: %u)", player->GetGUIDLow(), player->GetName().c_str(), item->GetEntry()); + SendReforgeResult(false); + return; + } + // Reset the item if (item->IsEquipped()) player->ApplyReforgeEnchantment(item, false); @@ -1557,6 +1602,13 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData) return; } + if (item->GetEnchantmentId(REFORGE_ENCHANTMENT_SLOT)) + { + TC_LOG_ERROR("network", "WORLD: HandleReforgeItemOpcode - Player (Guid: %u Name: %s) tried to reforge an already reforged item (Entry: %u)", player->GetGUIDLow(), player->GetName().c_str(), item->GetEntry()); + SendReforgeResult(false); + return; + } + ItemReforgeEntry const* stats = sItemReforgeStore.LookupEntry(reforgeEntry); if (!stats) { @@ -1586,3 +1638,21 @@ void WorldSession::HandleReforgeItemOpcode(WorldPacket& recvData) if (item->IsEquipped()) player->ApplyReforgeEnchantment(item, true); } + +bool WorldSession::CanUseBank(uint64 bankerGUID) const +{ + // bankerGUID parameter is optional, set to 0 by default. + if (!bankerGUID) + bankerGUID = m_currentBankerGUID; + + bool isUsingBankCommand = (bankerGUID == GetPlayer()->GetGUID() && bankerGUID == m_currentBankerGUID); + + if (!isUsingBankCommand) + { + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(bankerGUID, UNIT_NPC_FLAG_BANKER); + if (!creature) + return false; + } + + return true; +} diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 866a99bcfb7..9f7f79fc915 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -187,11 +187,6 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message"); - time_t now = time(NULL); - if (now - timeLastWhoCommand < 5) - return; - else timeLastWhoCommand = now; - uint32 matchcount = 0; uint32 level_min, level_max, racemask, classmask, zones_count, str_count; @@ -499,10 +494,9 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData) TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone); - // use server size data - uint32 newzone, newarea; - GetPlayer()->GetZoneAndAreaId(newzone, newarea); - GetPlayer()->UpdateZone(newzone, newarea); + // use server side data, but only after update the player position. See Player::UpdatePosition(). + GetPlayer()->SetNeedsZoneUpdate(true); + //GetPlayer()->SendInitWorldStates(true, newZone); } @@ -795,10 +789,10 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData) return; } - if (!GetPlayer()->IsRessurectRequestedBy(guid)) + if (!GetPlayer()->IsResurrectRequestedBy(guid)) return; - GetPlayer()->ResurectUsingRequestData(); + GetPlayer()->ResurrectUsingRequestData(); } void WorldSession::SendAreaTriggerMessage(const char* Text, ...) diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 59ab27968f4..0a77a941b5f 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -101,6 +101,7 @@ void WorldSession::SendShowBank(uint64 guid) { WorldPacket data(SMSG_SHOW_BANK, 8); data << guid; + m_currentBankerGUID = guid; SendPacket(&data); } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 974f06975fa..301e9a7d2c8 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -874,7 +874,10 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) uint32 talentId, talentRank; - for (uint32 i = 0; i < talentsCount; ++i) + // Client has max 19 talents, rounded up : 25 + uint32 const MaxTalentsCount = 25; + + for (uint32 i = 0; i < talentsCount && i < MaxTalentsCount; ++i) { recvData >> talentId >> talentRank; @@ -882,4 +885,6 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) } _player->SendTalentsInfoData(true); + + recvData.rfinish(); } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index b2eb89efb31..ea30bcbab9b 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -411,19 +411,23 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData) uint32 count; recvData >> count; // quest count, max=25 - if (count >= MAX_QUEST_LOG_SIZE) + if (count > MAX_QUEST_LOG_SIZE) { recvData.rfinish(); return; } - WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count); - data << uint32(count); // count - + // Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times + std::unordered_set<uint32> questIds; for (uint32 i = 0; i < count; ++i) + questIds.insert(recvData.read<uint32>()); // quest id + + WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4 + (4 + 4)*questIds.size()); + data << uint32(questIds.size()); // count + + for (auto itr = questIds.begin(); itr != questIds.end(); ++itr) { - uint32 questId; - recvData >> questId; // quest id + uint32 questId = *itr; bool questOk = false; diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 206238cbea2..19473edb6b4 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -273,7 +273,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) Object* object = _player; - if (!quest->HasFlag(QUEST_FLAGS_AUTO_SUBMIT)) + if (!quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) { object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) @@ -469,26 +469,43 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) { uint32 questId; - uint64 playerGuid; + uint64 guid; // NPC / GameObject guid for normal quest completion. Player guid for self-completed quests bool autoCompleteMode; // 0 - standart complete quest mode with npc, 1 - auto-complete mode - recvData >> playerGuid >> questId >> autoCompleteMode; + recvData >> guid >> questId >> autoCompleteMode; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, questId = %u", uint32(GUID_LOPART(playerGuid)), questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, questId = %u self-complete: %u", uint32(GUID_LOPART(guid)), questId, autoCompleteMode ? 1 : 0); Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) return; - Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, playerGuid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); - if (!object || !object->hasInvolvedQuest(questId)) + if (autoCompleteMode && !quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) + return; + + Object* object = nullptr; + if (autoCompleteMode) + object = _player; + else + object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); + + if (!object) return; if (autoCompleteMode == 0) { + if (!object->hasInvolvedQuest(questId)) + return; + // some kind of WPE protection if (!_player->CanInteractWithQuestGiver(object)) return; } + else + { + // Do not allow completing quests on other players. + if (guid != _player->GetGUID()) + return; + } if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) { @@ -503,16 +520,16 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE) { if (quest->IsRepeatable()) - _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanCompleteRepeatableQuest(quest), false); + _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanCompleteRepeatableQuest(quest), false); else - _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false); + _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false); } else { if (quest->GetReqItemsCount()) // some items required - _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false); + _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false); else // no items required - _player->PlayerTalkClass->SendQuestGiverOfferReward(quest, playerGuid, true); + _player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true); } if (Creature* creature = object->ToCreature()) @@ -586,7 +603,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) if (quest->IsAutoAccept() && receiver->CanAddQuest(quest, true) && receiver->CanTakeQuest(quest, true)) receiver->AddQuestAndCheckCompletion(quest, sender); - if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) + if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true); else { diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 2108b654d6b..67c36b1940e 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -61,7 +61,10 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) uint32 talentId, talentRank; - for (uint32 i = 0; i < talentsCount; ++i) + // Client has max 21 talents for tree for 3 trees, rounded up : 70 + uint32 const MaxTalentsCount = 70; + + for (uint32 i = 0; i < talentsCount && i < MaxTalentsCount; ++i) { recvPacket >> talentId >> talentRank; @@ -73,6 +76,8 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) } _player->SendTalentsInfoData(false); + + recvPacket.rfinish(); } void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData) diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 4ea4d835ae9..53cde5e8e5a 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -187,6 +187,8 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) uint32 mainSurvey; // GMSurveyCurrentSurvey.dbc, column 1 (all 9) ref to GMSurveySurveys.dbc recvData >> mainSurvey; + std::unordered_set<uint32> surveyIds; + SQLTransaction trans = CharacterDatabase.BeginTransaction(); // sub_survey1, r1, comment1, sub_survey2, r2, comment2, sub_survey3, r3, comment3, sub_survey4, r4, comment4, sub_survey5, r5, comment5, sub_survey6, r6, comment6, sub_survey7, r7, comment7, sub_survey8, r8, comment8, sub_survey9, r9, comment9, sub_survey10, r10, comment10, for (uint8 i = 0; i < 15; i++) { @@ -200,12 +202,16 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) std::string comment; // comment ("Usage: GMSurveyAnswerSubmit(question, rank, comment)") recvData >> comment; + // make sure the same sub survey is not added to DB twice + if (!surveyIds.insert(subSurveyId).second) + continue; + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SUBSURVEY); stmt->setUInt32(0, nextSurveyID); stmt->setUInt32(1, subSurveyId); stmt->setUInt32(2, rank); stmt->setString(3, comment); - CharacterDatabase.Execute(stmt); + trans->Append(stmt); } std::string comment; // just a guess @@ -217,7 +223,9 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) stmt->setUInt32(2, mainSurvey); stmt->setString(3, comment); - CharacterDatabase.Execute(stmt); + trans->Append(stmt); + + CharacterDatabase.CommitTransaction(trans); } void WorldSession::HandleReportLag(WorldPacket& recvData) diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index bd50b77961e..e17b33c345b 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -108,7 +108,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData) if (!accessory) GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next - else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), accessory)) + else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory)) { if (Vehicle* vehicle = vehUnit->GetVehicleKit()) if (vehicle->HasEmptySeat(seatId)) @@ -126,7 +126,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData) if (vehicle_base->GetGUID() == guid) GetPlayer()->ChangeSeat(seatId); - else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), guid)) + else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), guid)) if (Vehicle* vehicle = vehUnit->GetVehicleKit()) if (vehicle->HasEmptySeat(seatId)) vehUnit->HandleSpellClick(GetPlayer(), seatId); diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index de332afe627..ce9b2448dd4 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -249,7 +249,7 @@ AI* GetInstanceAI(T* obj, char const* scriptName) return new AI(obj); return NULL; -}; +} template<class AI, class T> AI* GetInstanceAI(T* obj) @@ -259,6 +259,6 @@ AI* GetInstanceAI(T* obj) return new AI(obj); return NULL; -}; +} #endif // TRINITY_INSTANCE_DATA_H diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 22c0b332f33..cd91af11a92 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2859,10 +2859,9 @@ bool InstanceMap::CanEnter(Player* player) return false; } - // cannot enter while an encounter is in progress on raids - /*Group* group = player->GetGroup(); - if (!player->IsGameMaster() && group && group->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/ - if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress()) + // cannot enter while an encounter is in progress + // allow if just loading + if (!player->IsLoading() && IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress()) { player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); return false; diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index f3a5a66bf66..dd697719d54 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -6,34 +6,6 @@ #include <ace/Guard_T.h> #include <ace/Method_Request.h> -class WDBThreadStartReq1 : public ACE_Method_Request -{ - public: - - WDBThreadStartReq1() - { - } - - virtual int call() - { - return 0; - } -}; - -class WDBThreadEndReq1 : public ACE_Method_Request -{ - public: - - WDBThreadEndReq1() - { - } - - virtual int call() - { - return 0; - } -}; - class MapUpdateRequest : public ACE_Method_Request { private: @@ -67,7 +39,7 @@ MapUpdater::~MapUpdater() int MapUpdater::activate(size_t num_threads) { - return m_executor.start((int)num_threads, new WDBThreadStartReq1, new WDBThreadEndReq1); + return m_executor.start((int)num_threads); } int MapUpdater::deactivate() diff --git a/src/server/game/Maps/PhaseMgr.cpp b/src/server/game/Maps/PhaseMgr.cpp index f3b31fdf6d5..13d357702ab 100644 --- a/src/server/game/Maps/PhaseMgr.cpp +++ b/src/server/game/Maps/PhaseMgr.cpp @@ -93,7 +93,9 @@ void PhaseMgr::Recalculate() PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId()); if (itr != _PhaseDefinitionStore->end()) + { for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase) + { if (CheckDefinition(&(*phase))) { phaseData.AddPhaseDefinition(&(*phase)); @@ -107,6 +109,8 @@ void PhaseMgr::Recalculate() if (phase->IsLastDefinition()) break; } + } + } } inline bool PhaseMgr::CheckDefinition(PhaseDefinition const* phaseDefinition) @@ -143,35 +147,56 @@ bool PhaseMgr::NeedsPhaseUpdateWithData(PhaseUpdateData const& updateData) const void PhaseMgr::RegisterPhasingAuraEffect(AuraEffect const* auraEffect) { - PhaseInfo phaseInfo; + std::list<PhaseInfo> phases; - if (auraEffect->GetMiscValue()) - { - _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; - phaseInfo.phasemask = auraEffect->GetMiscValue(); - } - else + if (auraEffect->GetAuraType() == SPELL_AURA_PHASE) { - SpellPhaseStore::const_iterator itr = _SpellPhaseStore->find(auraEffect->GetId()); - if (itr != _SpellPhaseStore->end()) + PhaseInfo phaseInfo; + + if (auraEffect->GetMiscValue()) + { + _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + phaseInfo.phasemask = auraEffect->GetMiscValue(); + } + else { - if (itr->second.phasemask) + SpellPhaseStore::const_iterator itr = _SpellPhaseStore->find(auraEffect->GetId()); + if (itr != _SpellPhaseStore->end()) { - _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; - phaseInfo.phasemask = itr->second.phasemask; - } + if (itr->second.phasemask) + { + _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + phaseInfo.phasemask = itr->second.phasemask; + } - if (itr->second.terrainswapmap) - phaseInfo.terrainswapmap = itr->second.terrainswapmap; + if (itr->second.terrainswapmap) + phaseInfo.terrainswapmap = itr->second.terrainswapmap; + } } - } - phaseInfo.phaseId = auraEffect->GetMiscValueB(); + phaseInfo.phaseId = auraEffect->GetMiscValueB(); + + if (phaseInfo.NeedsClientSideUpdate()) + _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; - if (phaseInfo.NeedsClientSideUpdate()) - _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; + phases.push_back(phaseInfo); + } + else if (auraEffect->GetAuraType() == SPELL_AURA_PHASE_GROUP) + { + uint32 group = auraEffect->GetMiscValueB(); + std::set<uint32> const& groupPhases = GetPhasesForGroup(group); + for (auto itr = groupPhases.begin(); itr != groupPhases.end(); ++itr) + { + PhaseInfo phaseInfo; + phaseInfo.phaseId = auraEffect->GetMiscValueB(); + if (phaseInfo.NeedsClientSideUpdate()) + _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; + phases.push_back(phaseInfo); + } + } - phaseData.AddAuraInfo(auraEffect->GetId(), phaseInfo); + for (auto itr = phases.begin(); itr != phases.end(); ++itr) + phaseData.AddAuraInfo(auraEffect->GetId(), *itr); Update(); } @@ -265,11 +290,14 @@ void PhaseData::SendPhaseshiftToPlayer() for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) { - if (itr->second.terrainswapmap) - terrainswaps.insert(itr->second.terrainswapmap); + for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph) + { + if (ph->terrainswapmap) + terrainswaps.insert(ph->terrainswapmap); - if (itr->second.phaseId) - phaseIds.insert(itr->second.phaseId); + if (ph->phaseId) + phaseIds.insert(ph->phaseId); + } } // Phase Definitions @@ -288,8 +316,9 @@ void PhaseData::SendPhaseshiftToPlayer() void PhaseData::GetActivePhases(std::set<uint32>& phases) const { for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) - if (itr->second.phaseId) - phases.insert(itr->second.phaseId); + for (auto phase = itr->second.begin(); phase != itr->second.end(); ++phase) + if (phase->phaseId) + phases.insert(phase->phaseId); // Phase Definitions for (std::list<PhaseDefinition const*>::const_iterator itr = activePhaseDefinitions.begin(); itr != activePhaseDefinitions.end(); ++itr) @@ -320,7 +349,7 @@ void PhaseData::AddAuraInfo(uint32 spellId, PhaseInfo const& phaseInfo) if (phaseInfo.phasemask) _PhasemaskThroughAuras |= phaseInfo.phasemask; - spellPhaseInfo[spellId] = phaseInfo; + spellPhaseInfo[spellId].push_back(phaseInfo); } uint32 PhaseData::RemoveAuraInfo(uint32 spellId) @@ -330,19 +359,25 @@ uint32 PhaseData::RemoveAuraInfo(uint32 spellId) { uint32 updateflag = 0; - if (rAura->second.NeedsClientSideUpdate()) - updateflag |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; - - if (rAura->second.NeedsServerSideUpdate()) + for (auto phase = rAura->second.begin(); phase != rAura->second.end(); ++phase) { - _PhasemaskThroughAuras = 0; + if (phase->NeedsClientSideUpdate()) + updateflag |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; - updateflag |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + if (phase->NeedsServerSideUpdate()) + { + _PhasemaskThroughAuras = 0; + updateflag |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + } + } + if (updateflag & PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED) + { spellPhaseInfo.erase(rAura); for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) - _PhasemaskThroughAuras |= itr->second.phasemask; + for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph) + _PhasemaskThroughAuras |= ph->phasemask; } return updateflag; diff --git a/src/server/game/Maps/PhaseMgr.h b/src/server/game/Maps/PhaseMgr.h index a2f51722e26..f5226e6468c 100644 --- a/src/server/game/Maps/PhaseMgr.h +++ b/src/server/game/Maps/PhaseMgr.h @@ -82,7 +82,7 @@ struct PhaseInfo bool NeedsClientSideUpdate() const { return terrainswapmap || phaseId; } }; -typedef std::unordered_map<uint32 /*spellId*/, PhaseInfo> PhaseInfoContainer; +typedef std::unordered_map<uint32 /*spellId*/, std::list<PhaseInfo>> PhaseInfoContainer; struct PhaseData { diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index cbb76ba4612..97834d3e444 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1232,6 +1232,8 @@ enum TrinityStrings LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD = 11006, LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007, + LANG_NPCINFO_INHABIT_TYPE = 11008 + // NOT RESERVED IDS 12000-1999999999 // `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID) // For other tables maybe 2000010000-2147483647 (max index) diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index cd57789ed60..cbcf509747b 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -436,7 +436,7 @@ enum SpellAttr4 SPELL_ATTR4_UNK5 = 0x00000020, // 5 SPELL_ATTR4_NOT_STEALABLE = 0x00000040, // 6 although such auras might be dispellable, they cannot be stolen SPELL_ATTR4_TRIGGERED = 0x00000080, // 7 spells forced to be triggered - SPELL_ATTR4_FIXED_DAMAGE = 0x00000100, // 8 ignores taken percent damage mods? + SPELL_ATTR4_FIXED_DAMAGE = 0x00000100, // 8 Ignores resilience and any (except mechanic related) damage or % damage taken auras on target. SPELL_ATTR4_TRIGGER_ACTIVATE = 0x00000200, // 9 initially disabled / trigger activate from event (Execute, Riposte, Deep Freeze end other) SPELL_ATTR4_SPELL_VS_EXTEND_COST = 0x00000400, // 10 Rogue Shiv have this flag SPELL_ATTR4_UNK11 = 0x00000800, // 11 @@ -542,7 +542,7 @@ enum SpellAttr7 SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // 3 Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS SPELL_ATTR7_UNK4 = 0x00000010, // 4 Only 47883 (Soulstone Resurrection) and test spell. SPELL_ATTR7_SUMMON_TOTEM = 0x00000020, // 5 Only Shaman totems. - SPELL_ATTR7_UNK6 = 0x00000040, // 6 Dark Surge, Surge of Light, Burning Breath triggers (boss spells). + SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE = 0x00000040, // 6 Does not cause spell pushback on damage SPELL_ATTR7_UNK7 = 0x00000080, // 7 66218 (Launch) spell. SPELL_ATTR7_HORDE_ONLY = 0x00000100, // 8 Teleports, mounts and other spells. SPELL_ATTR7_ALLIANCE_ONLY = 0x00000200, // 9 Teleports, mounts and other spells. @@ -1282,7 +1282,7 @@ enum SpellCustomErrors SPELL_CUSTOM_ERROR_REQUIRES_CONTROL_FIREWORKS = 95, // Requires Remote Control Fireworks. Return to Hobart Grapplehammer to get more. SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_RECRUITS = 96, // You already have the max number of recruits. SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_VOLUNTEERS = 97, // You already have the max number of volunteers. - SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESSURECT = 98, // Frostmourne has rendered you unable to ressurect. + SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESURRECT = 98, // Frostmourne has rendered you unable to resurrect. SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99, // You can't mount while affected by that shapeshift. SPELL_CUSTOM_ERROR_FAWNS_ALREADY_FOLLOWING = 100, // Three fawns are already following you! SPELL_CUSTOM_ERROR_ALREADY_HAVE_RIVER_BOAT = 101, // You already have a River Boat. diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 9a17175b1a8..5f811714f3a 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -326,7 +326,7 @@ bool Quest::IsAutoAccept() const bool Quest::IsAutoComplete() const { - return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) ? false : (Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE)); + return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) || (Method == 0); } bool Quest::IsRaidQuest(Difficulty difficulty) const diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 4ab41ba13f8..3a9fdf024bf 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -147,11 +147,11 @@ enum QuestFlags QUEST_FLAGS_FLAGS_PVP = 0x00002000, // Having this quest in log forces PvP flag QUEST_FLAGS_UNAVAILABLE = 0x00004000, // Used on quests that are not generically available QUEST_FLAGS_WEEKLY = 0x00008000, - QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // auto complete + QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // Quests with this flag player submit automatically by special button in player gui QUEST_FLAGS_DISPLAY_ITEM_IN_TRACKER = 0x00020000, // Displays usable item in quest tracker QUEST_FLAGS_OBJ_TEXT = 0x00040000, // use Objective text as Complete text QUEST_FLAGS_AUTO_ACCEPT = 0x00080000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future. - QUEST_FLAGS_AUTO_SUBMIT = 0x00100000, // Quests with this flag player submit automatically by special button in player gui + QUEST_FLAGS_UNK1 = 0x00100000, // QUEST_FLAGS_AUTO_TAKE = 0x00200000, // Automatically suggestion of accepting quest. Not from npc. //QUEST_FLAGS_UNK2 = 0x00400000, //QUEST_FLAGS_UNK3 = 0x00800000, // Found in quest 14069 diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 8f77f09ba2d..94bfc8e1305 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1395,11 +1395,18 @@ enum PacketProcessing PROCESS_THREADSAFE //packet is thread-safe - process it in Map::Update() }; +class WorldSession; class WorldPacket; class WorldSession; typedef void(WorldSession::*pOpcodeHandler)(WorldPacket& recvPacket); +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push, 1) +#endif + struct OpcodeHandler { OpcodeHandler() {} @@ -1446,6 +1453,12 @@ class OpcodeTable extern OpcodeTable opcodeTable; +#if defined(__GNUC__) +#pragma pack() +#else +#pragma pack(pop) +#endif + void InitOpcodes(); /// Lookup opcode name for human understandable logging diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a99695206ad..201235b4a40 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -124,8 +124,10 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 _filterAddonMessages(false), recruiterId(recruiter), isRecruiter(isARecruiter), - timeLastWhoCommand(0), - _RBACData(NULL) + _RBACData(NULL), + expireTime(60000), // 1 min after socket loss, session is deleted + forceExit(false), + m_currentBankerGUID(0) { memset(m_Tutorials, 0, sizeof(m_Tutorials)); @@ -317,12 +319,13 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) //! loop caused by re-enqueueing the same packets over and over again, we stop updating this session //! and continue updating others. The re-enqueued packets will be handled in the next Update call for this session. uint32 processedPackets = 0; + time_t currentTime = time(NULL); while (m_Socket && !m_Socket->IsClosed() && !_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket && _recvQueue.next(packet, updater)) { - if (!AntiDOS.EvaluateOpcode(*packet)) + if (!AntiDOS.EvaluateOpcode(*packet, currentTime)) KickPlayer(); OpcodeHandler const* opHandle = opcodeTable[packet->GetOpcode()]; @@ -449,8 +452,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) ///- Cleanup socket pointer if need if (m_Socket && m_Socket->IsClosed()) { - m_Socket->RemoveReference(); - m_Socket = NULL; + expireTime -= expireTime > diff ? diff : expireTime; + if (expireTime < diff || forceExit) + { + m_Socket->RemoveReference(); + m_Socket = NULL; + } } if (!m_Socket) @@ -476,7 +483,6 @@ void WorldSession::LogoutPlayer(bool save) DoLootRelease(lguid); ///- If the player just died before logging out, make him appear as a ghost - //FIXME: logout must be delayed in case lost connection with client in time of combat if (_player->GetDeathTimer()) { _player->getHostileRefManager().deleteReferences(); @@ -599,7 +605,6 @@ void WorldSession::LogoutPlayer(bool save) m_playerLogout = false; m_playerSave = false; m_playerRecentlyLogout = true; - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); LogoutRequest(0); } @@ -607,7 +612,10 @@ void WorldSession::LogoutPlayer(bool save) void WorldSession::KickPlayer() { if (m_Socket) + { m_Socket->CloseSocket(); + forceExit = true; + } } void WorldSession::SendNotification(const char *format, ...) @@ -1176,14 +1184,39 @@ void WorldSession::InvalidateRBACData() _RBACData = NULL; } -bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const +bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) const { - if (IsOpcodeAllowed(p.GetOpcode())) - return true; + PacketCounter& packetCounter = _PacketThrottlingMap[p.GetOpcode()]; + if (packetCounter.lastReceiveTime != time) + { + packetCounter.lastReceiveTime = time; + packetCounter.amountCounter = 0; + } + + uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode()); - // Opcode not allowed, let the punishment begin - TC_LOG_INFO("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)", - Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size()); + bool dosTriggered = false; + // Check if player is flooding some packets + if (++packetCounter.amountCounter > maxPacketCounterAllowed) + { + dosTriggered = true; + TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Ping: %u, Character: %s, flooding packet (opc: %s (0x%X), count: %u)", + Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(), + opcodeTable[p.GetOpcode()]->Name, p.GetOpcode(), packetCounter.amountCounter); + } + + // Then check if player is sending packets not allowed + if (!IsOpcodeAllowed(p.GetOpcode())) + { + dosTriggered = true; + // Opcode not allowed, let the punishment begin + TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)", + Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size()); + } + + // Return true if everything is fine, otherwise apply the configured policy + if (!dosTriggered) + return true; switch (_policy) { @@ -1212,3 +1245,238 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const return true; } } + + +uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) const +{ + uint32 maxPacketCounterAllowed; + switch (opcode) + { + case CMSG_MESSAGECHAT_ADDON_BATTLEGROUND: + case CMSG_MESSAGECHAT_ADDON_GUILD: + case CMSG_MESSAGECHAT_ADDON_OFFICER: + case CMSG_MESSAGECHAT_ADDON_PARTY: + case CMSG_MESSAGECHAT_ADDON_RAID: + case CMSG_MESSAGECHAT_ADDON_WHISPER: + case CMSG_MESSAGECHAT_AFK: + case CMSG_MESSAGECHAT_BATTLEGROUND: + case CMSG_MESSAGECHAT_CHANNEL: + case CMSG_MESSAGECHAT_DND: + case CMSG_MESSAGECHAT_EMOTE: + case CMSG_MESSAGECHAT_GUILD: + case CMSG_MESSAGECHAT_OFFICER: + case CMSG_MESSAGECHAT_PARTY: + case CMSG_MESSAGECHAT_RAID: + case CMSG_MESSAGECHAT_RAID_WARNING: + case CMSG_MESSAGECHAT_SAY: + case CMSG_MESSAGECHAT_WHISPER: + case CMSG_MESSAGECHAT_YELL: + { + maxPacketCounterAllowed = 500; + break; + } + + case CMSG_ATTACKSTOP: + case CMSG_GUILD_QUERY: + case CMSG_NAME_QUERY: + case CMSG_PET_NAME_QUERY: + case CMSG_CREATURE_QUERY: + case CMSG_NPC_TEXT_QUERY: + case CMSG_QUESTGIVER_STATUS_QUERY: + { + maxPacketCounterAllowed = 5000; + break; + } + + case CMSG_ARENA_TEAM_QUERY: + case CMSG_TAXINODE_STATUS_QUERY: + case CMSG_TAXIQUERYAVAILABLENODES: + case CMSG_QUESTGIVER_QUERY_QUEST: + case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY: + case CMSG_QUERY_QUESTS_COMPLETED: + case CMSG_QUEST_POI_QUERY: + case CMSG_QUERY_TIME: + case CMSG_PAGE_TEXT_QUERY: + case CMSG_PETITION_QUERY: + case CMSG_QUERY_INSPECT_ACHIEVEMENTS: + case CMSG_AREA_SPIRIT_HEALER_QUERY: + case CMSG_CORPSE_MAP_POSITION_QUERY: + case CMSG_MOVE_TIME_SKIPPED: + case CMSG_GUILD_BANK_QUERY_TAB: + case CMSG_GUILD_BANK_LOG_QUERY: + case CMSG_GUILD_EVENT_LOG_QUERY: + case MSG_CORPSE_QUERY: + case MSG_QUERY_NEXT_MAIL_TIME: + case MSG_MOVE_SET_FACING: + case CMSG_INSPECT: + { + maxPacketCounterAllowed = 500; + break; + } + + case CMSG_REQUEST_PARTY_MEMBER_STATS: + case CMSG_WHO: + case CMSG_SETSHEATHED: + case CMSG_CONTACT_LIST: + case CMSG_GUILD_MOTD: + { + maxPacketCounterAllowed = 50; + break; + } + + case CMSG_SPELLCLICK: + case CMSG_GAMEOBJ_USE: + case CMSG_GAMEOBJ_REPORT_USE: + case MSG_RAID_TARGET_UPDATE: + case CMSG_QUESTGIVER_COMPLETE_QUEST: + case CMSG_PLAYER_VEHICLE_ENTER: + case CMSG_PETITION_SIGN: + { + maxPacketCounterAllowed = 20; + break; + } + + case CMSG_PLAYER_LOGOUT: + case CMSG_LOGOUT_REQUEST: + case CMSG_LOGOUT_CANCEL: + case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE: + case CMSG_REQUEST_VEHICLE_PREV_SEAT: + case CMSG_REQUEST_VEHICLE_NEXT_SEAT: + case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: + case CMSG_TOGGLE_PVP: + case CMSG_ADD_FRIEND: + case CMSG_DEL_FRIEND: + case CMSG_SET_CONTACT_NOTES: + case CMSG_RESET_INSTANCES: + case CMSG_HEARTH_AND_RESURRECT: + case CMSG_CHAR_CREATE: + case CMSG_READY_FOR_ACCOUNT_DATA_TIMES: + case CMSG_CHAR_ENUM: + case CMSG_REALM_SPLIT: + case CMSG_CHAR_DELETE: + case CMSG_PLAYER_LOGIN: + case CMSG_PET_ABANDON: + case CMSG_PET_RENAME: + case CMSG_CHAR_RENAME: + case CMSG_CHAR_CUSTOMIZE: + case CMSG_CHAR_RACE_CHANGE: + case CMSG_CHAR_FACTION_CHANGE: + case CMSG_GMTICKET_CREATE: + case CMSG_GMTICKET_UPDATETEXT: + case CMSG_GMTICKET_DELETETICKET: + case CMSG_GMSURVEY_SUBMIT: + case CMSG_GM_REPORT_LAG: + case CMSG_BUG: + case CMSG_GMRESPONSE_RESOLVE: + case CMSG_ACTIVATETAXIEXPRESS: + case CMSG_ACTIVATETAXI: + case CMSG_SELF_RES: + case CMSG_INITIATE_TRADE: + case CMSG_BEGIN_TRADE: + case CMSG_UNLEARN_SKILL: + case CMSG_DISMISS_CONTROLLED_VEHICLE: + case CMSG_REQUEST_VEHICLE_EXIT: + case CMSG_LEARN_PREVIEW_TALENTS: + case CMSG_LEARN_PREVIEW_TALENTS_PET: + case CMSG_EJECT_PASSENGER: + case CMSG_EQUIPMENT_SET_SAVE: + case CMSG_EQUIPMENT_SET_DELETE: + case CMSG_ALTER_APPEARANCE: + case CMSG_QUESTGIVER_ACCEPT_QUEST: + case CMSG_QUESTGIVER_CHOOSE_REWARD: + case CMSG_QUESTGIVER_REQUEST_REWARD: + //case CMSG_QUESTGIVER_CANCEL: + case CMSG_QUESTLOG_REMOVE_QUEST: + case CMSG_QUEST_CONFIRM_ACCEPT: + case CMSG_DISMISS_CRITTER: + case CMSG_REPOP_REQUEST: + case CMSG_PETITION_BUY: + case CMSG_TURN_IN_PETITION: + case CMSG_COMPLETE_CINEMATIC: + case CMSG_ITEM_REFUND: + case CMSG_SOCKET_GEMS: + case CMSG_WRAP_ITEM: + case CMSG_BUY_BANK_SLOT: + case CMSG_GROUP_INVITE_RESPONSE: + //case CMSG_GROUP_UNINVITE: + case CMSG_GROUP_UNINVITE_GUID: + case CMSG_GROUP_SET_LEADER: + case CMSG_GROUP_DISBAND: + case CMSG_GROUP_RAID_CONVERT: + case CMSG_GROUP_CHANGE_SUB_GROUP: + case CMSG_GROUP_ASSISTANT_LEADER: + case CMSG_OPT_OUT_OF_LOOT: + case CMSG_BATTLEMASTER_JOIN_ARENA: + case CMSG_BATTLEFIELD_LEAVE: + case CMSG_REPORT_PVP_AFK: + case CMSG_DUEL_ACCEPTED: + case CMSG_DUEL_CANCELLED: + case CMSG_CALENDAR_GET_CALENDAR: + case CMSG_CALENDAR_ADD_EVENT: + case CMSG_CALENDAR_UPDATE_EVENT: + case CMSG_CALENDAR_REMOVE_EVENT: + case CMSG_CALENDAR_COPY_EVENT: + case CMSG_CALENDAR_EVENT_INVITE: + case CMSG_CALENDAR_EVENT_SIGNUP: + case CMSG_CALENDAR_EVENT_RSVP: + case CMSG_CALENDAR_EVENT_REMOVE_INVITE: + case CMSG_CALENDAR_EVENT_MODERATOR_STATUS: + case CMSG_CALENDAR_COMPLAIN: + case CMSG_ARENA_TEAM_INVITE: + case CMSG_ARENA_TEAM_ACCEPT: + case CMSG_ARENA_TEAM_DECLINE: + case CMSG_ARENA_TEAM_LEAVE: + case CMSG_ARENA_TEAM_DISBAND: + case CMSG_ARENA_TEAM_REMOVE: + case CMSG_ARENA_TEAM_LEADER: + case CMSG_LOOT_METHOD: + case CMSG_GUILD_INVITE: + case CMSG_GUILD_ACCEPT: + case CMSG_GUILD_DECLINE: + case CMSG_GUILD_LEAVE: + case CMSG_GUILD_DISBAND: + case CMSG_GUILD_SET_GUILD_MASTER: + case CMSG_GUILD_QUERY_RANKS: + case CMSG_GUILD_ADD_RANK: + case CMSG_GUILD_DEL_RANK: + case CMSG_GUILD_INFO_TEXT: + case CMSG_GUILD_BANK_DEPOSIT_MONEY: + case CMSG_GUILD_BANK_WITHDRAW_MONEY: + case CMSG_GUILD_BANK_BUY_TAB: + case CMSG_GUILD_BANK_UPDATE_TAB: + case CMSG_SET_GUILD_BANK_TEXT: + case MSG_SAVE_GUILD_EMBLEM: + case MSG_PETITION_RENAME: + case MSG_PETITION_DECLINE: + case MSG_TALENT_WIPE_CONFIRM: + case MSG_SET_DUNGEON_DIFFICULTY: + case MSG_SET_RAID_DIFFICULTY: + case MSG_RANDOM_ROLL: + case MSG_PARTY_ASSIGNMENT: + case MSG_RAID_READY_CHECK: + { + maxPacketCounterAllowed = 3; + break; + } + + case CMSG_SET_ACTION_BUTTON: + { + maxPacketCounterAllowed = MAX_ACTION_BUTTONS; + break; + } + + case CMSG_ITEM_REFUND_INFO: + { + maxPacketCounterAllowed = PLAYER_SLOTS_COUNT; + break; + } + + default: + { + maxPacketCounterAllowed = 100; + break; + } + } + + return maxPacketCounterAllowed; +} diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 2453104c80e..3c5e27f6f52 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -28,10 +28,12 @@ #include "AddonMgr.h" #include "DatabaseEnv.h" #include "World.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "Cryptography/BigNumber.h" #include "Opcodes.h" #include "AccountMgr.h" +#include <unordered_set> class Creature; class GameObject; @@ -203,6 +205,12 @@ class CharacterCreateInfo uint8 CharCount; }; +struct PacketCounter +{ + time_t lastReceiveTime; + uint32 amountCounter; +}; + /// Player session in the World class WorldSession { @@ -985,7 +993,7 @@ class WorldSession friend class World; public: DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY)) { } - bool EvaluateOpcode(WorldPacket& p) const; + bool EvaluateOpcode(WorldPacket& p, time_t time) const; void AllowOpcode(uint16 opcode, bool allow) { _isOpcodeAllowed[opcode] = allow; } protected: enum Policy @@ -1004,12 +1012,17 @@ class WorldSession return itr->second; } + uint32 GetMaxPacketCounterAllowed(uint16 opcode) const; + WorldSession* Session; private: typedef std::unordered_map<uint16, bool> OpcodeStatusMap; OpcodeStatusMap _isOpcodeAllowed; // could be bool array, but wouldn't be practical for game versions with non-linear opcodes Policy _policy; + typedef std::unordered_map<uint16, PacketCounter> PacketThrottlingMap; + // mark this member as "mutable" so it can be modified even in const functions + mutable PacketThrottlingMap _PacketThrottlingMap; DosProtection(DosProtection const& right) = delete; DosProtection& operator=(DosProtection const& right) = delete; @@ -1019,6 +1032,8 @@ class WorldSession // private trade methods void moveItems(Item* myItems[], Item* hisItems[]); + bool CanUseBank(uint64 bankerGUID = 0) const; + // logging helper void LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason); void LogUnprocessedTail(WorldPacket* packet); @@ -1066,9 +1081,11 @@ class WorldSession uint32 recruiterId; bool isRecruiter; ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue; - time_t timeLastWhoCommand; z_stream_s* _compressionStream; rbac::RBACData* _RBACData; + uint32 expireTime; + bool forceExit; + uint64 m_currentBankerGUID; WorldSession(WorldSession const& right) = delete; WorldSession& operator=(WorldSession const& right) = delete; diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index 268034444b0..0f396ee4bc6 100644 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.h @@ -385,7 +385,7 @@ enum AuraType SPELL_AURA_323 = 323, // Not used in 4.3.4 SPELL_AURA_324 = 324, // spell critical chance (probably by school mask) SPELL_AURA_325 = 325, // Not used in 4.3.4 - SPELL_AURA_326 = 326, // phase related + SPELL_AURA_PHASE_GROUP = 326, // Puts the player in all the phases that are in the group with id = miscB SPELL_AURA_327 = 327, // Not used in 4.3.4 SPELL_AURA_PROC_ON_POWER_AMOUNT = 328, SPELL_AURA_MOD_RUNE_REGEN_SPEED = 329, // NYI diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a4210d2dad5..7226ebe12c2 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -384,7 +384,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleUnused, //323 unused (4.3.4) &AuraEffect::HandleNULL, //324 SPELL_AURA_324 &AuraEffect::HandleUnused, //325 unused (4.3.4) - &AuraEffect::HandleNULL, //326 SPELL_AURA_326 + &AuraEffect::HandlePhaseGroup, //326 SPELL_AURA_PHASE_GROUP &AuraEffect::HandleUnused, //327 unused (4.3.4) &AuraEffect::HandleNoImmediateEffect, //328 SPELL_AURA_PROC_ON_POWER_AMOUNT implemented in Unit::HandleAuraProcOnPowerAmount &AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_RUNE_REGEN_SPEED @@ -1645,6 +1645,34 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app target->UpdateObjectVisibility(); } +void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const +{ + if (!(mode & AURA_EFFECT_HANDLE_REAL)) + return; + + Unit* target = aurApp->GetTarget(); + + if (Player* player = target->ToPlayer()) + { + if (apply) + player->GetPhaseMgr().RegisterPhasingAuraEffect(this); + else + player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this); + } + + // call functions which may have additional effects after chainging state of unit + // phase auras normally not expected at BG but anyway better check + if (apply) + { + // drop flag at invisibiliy in bg + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + } + + // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) + if (target->IsVisible()) + target->UpdateObjectVisibility(); +} + /**********************/ /*** UNIT MODEL ***/ /**********************/ @@ -1740,9 +1768,6 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo if (aurApp->GetRemoveMode()) return; - if (modelid > 0) - target->SetDisplayId(modelid); - if (PowerType != POWER_MANA) { int32 oldPower = target->GetPower(PowerType); @@ -1772,6 +1797,12 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo return; target->SetShapeshiftForm(form); + if (modelid > 0) + { + SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()); + if (!transformSpellInfo || !GetSpellInfo()->IsPositive()) + target->SetDisplayId(modelid); + } } else { @@ -1891,9 +1922,11 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (apply) { - // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case - if (!target->GetModelForForm(target->GetShapeshiftForm()) || !GetSpellInfo()->IsPositive()) + // update active transform spell only when transform not set or not overwriting negative by positive case + SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()); + if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive()) { + target->setTransForm(GetId()); // special case (spell specific functionality) if (GetMiscValue() == 0) { @@ -2062,11 +2095,6 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, } } - // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case - SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm()); - if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive()) - target->setTransForm(GetId()); - // polymorph case if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed()) { @@ -5805,7 +5833,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target); int32 dmg = damage; - caster->ApplyResilience(target, &dmg); + + if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE)) + caster->ApplyResilience(target, &dmg); damage = dmg; caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); @@ -5872,7 +5902,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c } int32 dmg = damage; - caster->ApplyResilience(target, &dmg); + if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE)) + caster->ApplyResilience(target, &dmg); damage = dmg; caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 2e849fff963..2415b89c9a8 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -134,6 +134,8 @@ class AuraEffect void HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const; + // unit model void HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6ec5e5d5f8f..b64ee454e2e 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -569,7 +569,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme m_spellState = SPELL_STATE_NULL; _triggeredCastFlags = triggerFlags; if (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED) - _triggeredCastFlags = TRIGGERED_FULL_MASK; + _triggeredCastFlags = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT); m_CastItem = NULL; m_castItemGUID = 0; @@ -1285,10 +1285,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici dist = objSize + (dist - objSize) * float(rand_norm()); Position pos = dest._position; - if (targetType.GetTarget() == TARGET_DEST_CASTER_FRONT_LEAP) - m_caster->MovePositionToFirstCollision(pos, dist, angle); - else - m_caster->MovePosition(pos, dist, angle); + m_caster->MovePositionToFirstCollision(pos, dist, angle); dest.Relocate(pos); break; @@ -1321,7 +1318,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici dist = objSize + (dist - objSize) * float(rand_norm()); Position pos = dest._position; - target->MovePosition(pos, dist, angle); + target->MovePositionToFirstCollision(pos, dist, angle); dest.Relocate(pos); break; @@ -1360,7 +1357,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT dist *= float(rand_norm()); Position pos = dest._position; - m_caster->MovePosition(pos, dist, angle); + m_caster->MovePositionToFirstCollision(pos, dist, angle); dest.Relocate(pos); break; @@ -4226,7 +4223,7 @@ void Spell::SendChannelStart(uint32 duration) void Spell::SendResurrectRequest(Player* target) { - // get ressurector 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 std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER ? "" diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9c6b69ef7d7..8dfa017467a 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -280,7 +280,7 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex) Player* target = unitTarget->ToPlayer(); - if (target->IsRessurectRequested()) // already have one active request + if (target->IsResurrectRequested()) // already have one active request return; uint32 health = damage; @@ -4254,7 +4254,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex) Player* target = unitTarget->ToPlayer(); - if (target->IsRessurectRequested()) // already have one active request + if (target->IsResurrectRequested()) // already have one active request return; uint32 health = target->CountPctFromMaxHealth(damage); @@ -5713,7 +5713,7 @@ void Spell::EffectResurrectWithAura(SpellEffIndex effIndex) if (unitTarget->IsAlive()) return; - if (target->IsRessurectRequested()) // already have one active request + if (target->IsResurrectRequested()) // already have one active request return; uint32 health = target->CountPctFromMaxHealth(damage); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index ef9e6d5aa21..7491920c36a 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -24,6 +24,7 @@ #include "Player.h" #include "Battleground.h" #include "Vehicle.h" +#include "Pet.h" uint32 GetTargetFlagMask(SpellTargetObjectTypes objType) { @@ -1678,8 +1679,16 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta // creature/player specific target checks if (unitTarget) { - if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && unitTarget->IsInCombat()) - return SPELL_FAILED_TARGET_AFFECTING_COMBAT; + if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT) + { + if (unitTarget->IsInCombat()) + return SPELL_FAILED_TARGET_AFFECTING_COMBAT; + // player with active pet counts as a player in combat + else if (Player const* player = unitTarget->ToPlayer()) + if (Pet* pet = player->GetPet()) + if (pet->GetVictim() && !pet->HasUnitState(UNIT_STATE_CONTROLLED)) + return SPELL_FAILED_TARGET_AFFECTING_COMBAT; + } // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts if (((AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST)) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 33a2bd2d41a..277d2b701c4 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -787,14 +787,14 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell bool hasFamilyMask = false; - /** - + /** + * @brief Check auras procced by periodics *Only damaging Dots can proc auras with PROC_FLAG_TAKEN_DAMAGE *Only Dots can proc if ONLY has PROC_FLAG_DONE_PERIODIC or PROC_FLAG_TAKEN_PERIODIC. - + *Hots can proc if ONLY has PROC_FLAG_DONE_PERIODIC and spellfamily != 0 *Only Dots can proc auras with PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG or PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG @@ -809,7 +809,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell * @param procFlags proc_flags of spellProc * @param procExtra proc_EX of procSpell * @param EventProcFlag proc_flags of aura to be procced - * @param spellProto SpellInfo of aura to be procced + * @param spellProto SpellInfo of aura to be procced */ @@ -818,7 +818,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell return true; if (procFlags & PROC_FLAG_DONE_PERIODIC && EventProcFlag & PROC_FLAG_DONE_PERIODIC) - { + { if (procExtra & PROC_EX_INTERNAL_HOT) { if (EventProcFlag == PROC_FLAG_DONE_PERIODIC) @@ -838,7 +838,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, Spell } if (procFlags & PROC_FLAG_TAKEN_PERIODIC && EventProcFlag & PROC_FLAG_TAKEN_PERIODIC) - { + { if (procExtra & PROC_EX_INTERNAL_HOT) { /// No aura that only has PROC_FLAG_TAKEN_PERIODIC can proc from a HOT. @@ -3244,6 +3244,9 @@ void SpellMgr::LoadSpellInfoCorrections() case 63675: // Improved Devouring Plague spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; break; + case 12721: // Deep Wounds shouldnt ignore resillience or damage taken auras because its damage is not based off a spell. + spellInfo->AttributesEx4 = 0; + break; case 8145: // Tremor Totem (instant pulse) case 6474: // Earthbind Totem (instant pulse) spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY; @@ -3392,6 +3395,9 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd spellInfo->Effects[EFFECT_1].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_60_YARDS); // 60yd break; + case 72830: // Achievement Check + spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd + break; case 72900: // Start Halls of Reflection Quest AE spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd break; diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 75a191a9801..32b8781fb89 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -249,7 +249,7 @@ class SpellScript : public _SpellScript class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) { } }; \ class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) { } }; \ class ObjectTargetSelectHandlerFunction : public SpellScript::ObjectTargetSelectHandler { public: ObjectTargetSelectHandlerFunction(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectTargetSelectHandler((SpellScript::SpellObjectTargetSelectFnType)_pObjectTargetSelectHandlerScript, _effIndex, _targetType) { } }; \ - class DestinationTargetSelectHandlerFunction : public SpellScript::DestinationTargetSelectHandler { public: DestinationTargetSelectHandlerFunction(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::DestinationTargetSelectHandler((SpellScript::SpellDestinationTargetSelectFnType)_DestinationTargetSelectHandlerScript, _effIndex, _targetType) { } }; + class DestinationTargetSelectHandlerFunction : public SpellScript::DestinationTargetSelectHandler { public: DestinationTargetSelectHandlerFunction(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::DestinationTargetSelectHandler((SpellScript::SpellDestinationTargetSelectFnType)_DestinationTargetSelectHandlerScript, _effIndex, _targetType) { } } #define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: @@ -623,7 +623,7 @@ class AuraScript : public _SpellScript class EffectSplitFunction : public AuraScript::EffectSplitHandler { public: EffectSplitFunction(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectSplitHandler((AuraScript::AuraEffectSplitFnType)_pEffectHandlerScript, _effIndex) { } }; \ class CheckProcHandlerFunction : public AuraScript::CheckProcHandler { public: CheckProcHandlerFunction(AuraCheckProcFnType handlerScript) : AuraScript::CheckProcHandler((AuraScript::AuraCheckProcFnType)handlerScript) { } }; \ class AuraProcHandlerFunction : public AuraScript::AuraProcHandler { public: AuraProcHandlerFunction(AuraProcFnType handlerScript) : AuraScript::AuraProcHandler((AuraScript::AuraProcFnType)handlerScript) { } }; \ - class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) { } }; \ + class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) { } } #define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 35f5cb82036..3fbbd34777b 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -24,6 +24,7 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CreatureTextMgr.h" +#include "Group.h" class CreatureTextBuilder { @@ -347,6 +348,18 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, } break; } + case CHAT_MSG_MONSTER_PARTY: + if (!whisperTarget) + return; + + if (Player const* player = whisperTarget->ToPlayer()) + { + if (Group* group = const_cast<Group*>(player->GetGroup())) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + member->GetSession()->SendPacket(data); + } + return; default: break; } diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 77fbe92400d..c6b1da46e6b 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -238,7 +238,7 @@ void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log) std::stringstream ss(log); std::stringstream newss; std::string line; - while (std::getline(ss, line)) + while (std::getline(ss, line) && !time.empty()) { newss << secsToTimeString(time.front()) << ": " << line << "\n"; time.pop_front(); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 42872bba22e..0810295c0cc 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -223,7 +223,7 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/) void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) { - if (!_warden) + if (!_warden || recvData.empty()) return; _warden->DecryptData(recvData.contents(), recvData.size()); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index e4b9737a544..d47ee20fac5 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1020,8 +1020,8 @@ public: } else { - uint32 moneyToAddMsg = moneyToAdd * -1; - if (newmoney > int64(MAX_MONEY_AMOUNT)) + uint64 moneyToAddMsg = moneyToAdd * -1; + if (newmoney > static_cast<int64>(MAX_MONEY_AMOUNT)) newmoney = MAX_MONEY_AMOUNT; handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, moneyToAddMsg, handler->GetNameLink(target).c_str()); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index e7aeb289833..fb465aaca16 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -720,6 +720,7 @@ public: handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId()); handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); + handler->PSendSysMessage(LANG_NPCINFO_INHABIT_TYPE, cInfo->InhabitType); handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS)); for (uint8 i = 0; i < MAX_UNIT_FLAGS; ++i) diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 83b716728ea..47e91cac63d 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -82,7 +82,7 @@ public: // check if creature is not outside of building if (resetTimer < diff) { - if (Creature* pBalinda = Unit::GetCreature(*me, balindaGUID)) + if (Creature* pBalinda = ObjectAccessor::GetCreature(*me, balindaGUID)) if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50) EnterEvadeMode(); resetTimer = 5 * IN_MILLISECONDS; @@ -212,4 +212,4 @@ void AddSC_boss_balinda() { new boss_balinda; new npc_water_elemental; -}; +} diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 1ab2d746aa5..3eab75cfd76 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -229,7 +229,7 @@ public: if (RingBossGUID) { - Creature* boss = Unit::GetCreature(*me, RingBossGUID); + Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID); if (boss && !boss->IsAlive() && boss->isDead()) { RingBossGUID = 0; @@ -242,7 +242,7 @@ public: for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i) { - Creature* mob = Unit::GetCreature(*me, RingMobGUID[i]); + Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]); if (mob && !mob->IsAlive() && mob->isDead()) { RingMobGUID[i] = 0; @@ -1304,7 +1304,7 @@ public: DoGo(DATA_GO_BAR_KEG_TRAP, 0); //doesn't work very well, leaving code here for future //spell by trap has effect61, this indicate the bar go hostile - if (Unit* tmp = Unit::GetUnit(*me, instance->GetData64(DATA_PHALANX))) + if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PHALANX))) tmp->setFaction(14); //for later, this event(s) has alot more to it. diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp index 4ac039e9138..3e4097daf20 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_ambassador_flamelash.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -24,64 +23,74 @@ enum Spells SPELL_FIREBLAST = 15573 }; -class boss_ambassador_flamelash : public CreatureScript +enum Events { -public: - boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_ambassador_flamelashAI(creature); - } - - struct boss_ambassador_flamelashAI : public ScriptedAI - { - boss_ambassador_flamelashAI(Creature* creature) : ScriptedAI(creature) { } + EVENT_FIREBLAST = 1, + EVENT_SUMMON_SPIRITS = 2 +}; - uint32 FireBlast_Timer; - uint32 Spirit_Timer; +class boss_ambassador_flamelash : public CreatureScript +{ + public: + boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { } - void Reset() override + struct boss_ambassador_flamelashAI : public ScriptedAI { - FireBlast_Timer = 2000; - Spirit_Timer = 24000; - } + boss_ambassador_flamelashAI(Creature* creature) : ScriptedAI(creature) { } - void EnterCombat(Unit* /*who*/) override { } - - void SummonSpirits(Unit* victim) - { - if (Creature* Spirit = DoSpawnCreature(9178, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Spirit->AI()->AttackStart(victim); - } + void Reset() override + { + _events.Reset(); + } - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) override + { + _events.ScheduleEvent(EVENT_FIREBLAST, 2000); + _events.ScheduleEvent(EVENT_SUMMON_SPIRITS, 24000); + } - //FireBlast_Timer - if (FireBlast_Timer <= diff) + void SummonSpirit(Unit* victim) { - DoCastVictim(SPELL_FIREBLAST); - FireBlast_Timer = 7000; - } else FireBlast_Timer -= diff; + if (Creature* spirit = DoSpawnCreature(9178, frand(-9, 9), frand(-9, 9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + spirit->AI()->AttackStart(victim); + } - //Spirit_Timer - if (Spirit_Timer <= diff) + void UpdateAI(uint32 diff) override { - SummonSpirits(me->GetVictim()); - SummonSpirits(me->GetVictim()); - SummonSpirits(me->GetVictim()); - SummonSpirits(me->GetVictim()); + if (!UpdateVictim()) + return; - Spirit_Timer = 30000; - } else Spirit_Timer -= diff; + _events.Update(diff); - DoMeleeAttackIfReady(); + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FIREBLAST: + DoCastVictim(SPELL_FIREBLAST); + _events.ScheduleEvent(EVENT_FIREBLAST, 7000); + break; + case EVENT_SUMMON_SPIRITS: + for (uint32 i = 0; i < 4; ++i) + SummonSpirit(me->GetVictim()); + _events.ScheduleEvent(EVENT_SUMMON_SPIRITS, 30000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_ambassador_flamelashAI(creature); } - }; }; void AddSC_boss_ambassador_flamelash() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp index fd8b77ea8d4..894b528c03c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_anubshiah.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -21,90 +20,94 @@ enum Spells { - SPELL_SHADOWBOLT = 17228, - SPELL_CURSEOFTONGUES = 15470, - SPELL_CURSEOFWEAKNESS = 17227, - SPELL_DEMONARMOR = 11735, - SPELL_ENVELOPINGWEB = 15471 + SPELL_SHADOWBOLT = 17228, + SPELL_CURSEOFTONGUES = 15470, + SPELL_CURSEOFWEAKNESS = 17227, + SPELL_DEMONARMOR = 11735, + SPELL_ENVELOPINGWEB = 15471 }; -class boss_anubshiah : public CreatureScript +enum Events { -public: - boss_anubshiah() : CreatureScript("boss_anubshiah") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_anubshiahAI(creature); - } - - struct boss_anubshiahAI : public ScriptedAI - { - boss_anubshiahAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 ShadowBolt_Timer; - uint32 CurseOfTongues_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - uint32 EnvelopingWeb_Timer; - - void Reset() override - { - ShadowBolt_Timer = 7000; - CurseOfTongues_Timer = 24000; - CurseOfWeakness_Timer = 12000; - DemonArmor_Timer = 3000; - EnvelopingWeb_Timer = 16000; - } + EVENT_SHADOWBOLT = 1, + EVENT_CURSE_OF_TONGUES = 2, + EVENT_CURSE_OF_WEAKNESS = 3, + EVENT_DEMON_ARMOR = 4, + EVENT_ENVELOPING_WEB = 5 +}; - void EnterCombat(Unit* /*who*/) override { } +class boss_anubshiah : public CreatureScript +{ + public: + boss_anubshiah() : CreatureScript("boss_anubshiah") { } - void UpdateAI(uint32 diff) override + struct boss_anubshiahAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; - - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) - { - DoCastVictim(SPELL_SHADOWBOLT); - ShadowBolt_Timer = 7000; - } else ShadowBolt_Timer -= diff; - - //CurseOfTongues_Timer - if (CurseOfTongues_Timer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_CURSEOFTONGUES); - CurseOfTongues_Timer = 18000; - } else CurseOfTongues_Timer -= diff; + boss_anubshiahAI(Creature* creature) : ScriptedAI(creature) { } - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) + void Reset() override { - DoCastVictim(SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; + _events.Reset(); + } - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) + void EnterCombat(Unit* /*who*/) override { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; - - //EnvelopingWeb_Timer - if (EnvelopingWeb_Timer <= diff) + _events.ScheduleEvent(EVENT_SHADOWBOLT, 7000); + _events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 24000); + _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 12000); + _events.ScheduleEvent(EVENT_DEMON_ARMOR, 3000); + _events.ScheduleEvent(EVENT_ENVELOPING_WEB, 16000); + } + + void UpdateAI(uint32 diff) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_ENVELOPINGWEB); - EnvelopingWeb_Timer = 12000; - } else EnvelopingWeb_Timer -= diff; - - DoMeleeAttackIfReady(); + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOWBOLT: + DoCast(me, SPELL_SHADOWBOLT); + _events.ScheduleEvent(EVENT_SHADOWBOLT, 7000); + break; + case EVENT_CURSE_OF_TONGUES: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(target, SPELL_CURSEOFTONGUES); + _events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 18000); + break; + case EVENT_CURSE_OF_WEAKNESS: + DoCastVictim(SPELL_CURSEOFWEAKNESS); + _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 45000); + break; + case EVENT_DEMON_ARMOR: + DoCast(me, SPELL_DEMONARMOR); + _events.ScheduleEvent(EVENT_DEMON_ARMOR, 300000); + break; + case EVENT_ENVELOPING_WEB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(target, SPELL_ENVELOPINGWEB); + _events.ScheduleEvent(EVENT_ENVELOPING_WEB, 12000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_anubshiahAI(creature); } - }; }; void AddSC_boss_anubshiah() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index fffdf9c7514..cec29bcd4d1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -32,89 +31,89 @@ enum Spells SPELL_AVATAROFFLAME = 15636 }; -class boss_emperor_dagran_thaurissan : public CreatureScript +enum Events { -public: - boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_draganthaurissanAI>(creature); - } - - struct boss_draganthaurissanAI : public ScriptedAI - { - boss_draganthaurissanAI(Creature* creature) : ScriptedAI(creature) - { - instance = me->GetInstanceScript(); - } - - InstanceScript* instance; - uint32 HandOfThaurissan_Timer; - uint32 AvatarOfFlame_Timer; - //uint32 Counter; + EVENT_HANDOFTHAURISSAN = 1, + EVENT_AVATAROFFLAME = 2 +}; - void Reset() override - { - HandOfThaurissan_Timer = 4000; - AvatarOfFlame_Timer = 25000; - //Counter= 0; - } +class boss_emperor_dagran_thaurissan : public CreatureScript +{ + public: + boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { } - void EnterCombat(Unit* /*who*/) override + struct boss_draganthaurissanAI : public ScriptedAI { - Talk(SAY_AGGRO); - me->CallForHelp(VISIBLE_RANGE); - } + boss_draganthaurissanAI(Creature* creature) : ScriptedAI(creature) + { + _instance = me->GetInstanceScript(); + } - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_SLAY); - } + void Reset() override + { + _events.Reset(); + } - void JustDied(Unit* /*killer*/) override - { - if (Creature* Moira = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOIRA))) + void EnterCombat(Unit* /*who*/) override { - Moira->AI()->EnterEvadeMode(); - Moira->setFaction(35); + Talk(SAY_AGGRO); + me->CallForHelp(VISIBLE_RANGE); + _events.ScheduleEvent(EVENT_HANDOFTHAURISSAN, 4000); + _events.ScheduleEvent(EVENT_AVATAROFFLAME, 25000); } - } - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; + void KilledUnit(Unit* who) override + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - if (HandOfThaurissan_Timer <= diff) + void JustDied(Unit* /*killer*/) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_HANDOFTHAURISSAN); - - //3 Hands of Thaurissan will be cast - //if (Counter < 3) - //{ - // HandOfThaurissan_Timer = 1000; - // ++Counter; - //} - //else - //{ - HandOfThaurissan_Timer = 5000; - //Counter = 0; - //} - } else HandOfThaurissan_Timer -= diff; - - //AvatarOfFlame_Timer - if (AvatarOfFlame_Timer <= diff) + if (Creature* moira = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_MOIRA))) + { + moira->AI()->EnterEvadeMode(); + moira->setFaction(35); + } + } + + void UpdateAI(uint32 diff) override { - DoCastVictim(SPELL_AVATAROFFLAME); - AvatarOfFlame_Timer = 18000; - } else AvatarOfFlame_Timer -= diff; + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_HANDOFTHAURISSAN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_HANDOFTHAURISSAN); + _events.ScheduleEvent(EVENT_HANDOFTHAURISSAN, 5000); + break; + case EVENT_AVATAROFFLAME: + DoCastVictim(SPELL_AVATAROFFLAME); + _events.ScheduleEvent(EVENT_AVATAROFFLAME, 18000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* _instance; + EventMap _events; + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI<boss_draganthaurissanAI>(creature); } - }; }; void AddSC_boss_draganthaurissan() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp index 34ce2276a54..d5b8d1deadd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_general_angerforge.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -26,101 +25,113 @@ enum Spells SPELL_CLEAVE = 20691 }; -class boss_general_angerforge : public CreatureScript +enum Events { -public: - boss_general_angerforge() : CreatureScript("boss_general_angerforge") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_general_angerforgeAI(creature); - } - - struct boss_general_angerforgeAI : public ScriptedAI - { - boss_general_angerforgeAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 MightyBlow_Timer; - uint32 HamString_Timer; - uint32 Cleave_Timer; - uint32 Adds_Timer; - bool Medics; - - void Reset() override - { - MightyBlow_Timer = 8000; - HamString_Timer = 12000; - Cleave_Timer = 16000; - Adds_Timer = 0; - Medics = false; - } - - void EnterCombat(Unit* /*who*/) override { } + EVENT_MIGHTYBLOW = 1, + EVENT_HAMSTRING = 2, + EVENT_CLEAVE = 3, + EVENT_MEDIC = 4, + EVENT_ADDS = 5 +}; - void SummonAdds(Unit* victim) - { - if (Creature* SummonedAdd = DoSpawnCreature(8901, float(irand(-14, 14)), float(irand(-14, 14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedAdd->AI()->AttackStart(victim); - } +enum Phases +{ + PHASE_ONE = 1, + PHASE_TWO = 2 +}; - void SummonMedics(Unit* victim) - { - if (Creature* SummonedMedic = DoSpawnCreature(8894, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMedic->AI()->AttackStart(victim); - } +class boss_general_angerforge : public CreatureScript +{ + public: + boss_general_angerforge() : CreatureScript("boss_general_angerforge") { } - void UpdateAI(uint32 diff) override + struct boss_general_angerforgeAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_general_angerforgeAI(Creature* creature) : ScriptedAI(creature) { } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void Reset() override { - DoCastVictim(SPELL_MIGHTYBLOW); - MightyBlow_Timer = 18000; - } else MightyBlow_Timer -= diff; + _events.Reset(); + } - //HamString_Timer - if (HamString_Timer <= diff) + void EnterCombat(Unit* /*who*/) override { - DoCastVictim(SPELL_HAMSTRING); - HamString_Timer = 15000; - } else HamString_Timer -= diff; + _events.SetPhase(PHASE_ONE); + _events.ScheduleEvent(EVENT_MIGHTYBLOW, 8000); + _events.ScheduleEvent(EVENT_HAMSTRING, 12000); + _events.ScheduleEvent(EVENT_CLEAVE, 16000); + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - DoCastVictim(SPELL_CLEAVE); - Cleave_Timer = 9000; - } else Cleave_Timer -= diff; + if (me->HealthBelowPctDamaged(20, damage) && _events.IsInPhase(PHASE_ONE)) + { + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_MEDIC, 0, 0, PHASE_TWO); + _events.ScheduleEvent(EVENT_ADDS, 0, 0, PHASE_TWO); + } + } - //Adds_Timer - if (HealthBelowPct(21)) + void SummonAdd(Unit* victim) { - if (Adds_Timer <= diff) - { - // summon 3 Adds every 25s - SummonAdds(me->GetVictim()); - SummonAdds(me->GetVictim()); - SummonAdds(me->GetVictim()); + if (Creature* SummonedAdd = DoSpawnCreature(8901, float(irand(-14, 14)), float(irand(-14, 14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedAdd->AI()->AttackStart(victim); + } - Adds_Timer = 25000; - } else Adds_Timer -= diff; + void SummonMedic(Unit* victim) + { + if (Creature* SummonedMedic = DoSpawnCreature(8894, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMedic->AI()->AttackStart(victim); } - //Summon Medics - if (!Medics && HealthBelowPct(21)) + void UpdateAI(uint32 diff) override { - SummonMedics(me->GetVictim()); - SummonMedics(me->GetVictim()); - Medics = true; + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_MIGHTYBLOW: + DoCastVictim(SPELL_MIGHTYBLOW); + _events.ScheduleEvent(EVENT_MIGHTYBLOW, 18000); + break; + case EVENT_HAMSTRING: + DoCastVictim(SPELL_HAMSTRING); + _events.ScheduleEvent(EVENT_HAMSTRING, 15000); + break; + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + _events.ScheduleEvent(EVENT_CLEAVE, 9000); + break; + case EVENT_MEDIC: + for (uint8 i = 0; i < 2; ++i) + SummonMedic(me->GetVictim()); + break; + case EVENT_ADDS: + for (uint8 i = 0; i < 3; ++i) + SummonAdd(me->GetVictim()); + _events.ScheduleEvent(EVENT_ADDS, 25000, 0, PHASE_TWO); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_general_angerforgeAI(creature); } - }; }; void AddSC_boss_general_angerforge() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp index b5998576f24..e9034e17d83 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_gorosh_the_dervish.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -25,56 +24,67 @@ enum Spells SPELL_MORTALSTRIKE = 24573 }; +enum Events +{ + EVENT_WHIRLWIND = 1, + EVENT_MORTALSTRIKE = 2 +}; + class boss_gorosh_the_dervish : public CreatureScript { -public: - boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { } + public: + boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { } - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_gorosh_the_dervishAI(creature); - } + struct boss_gorosh_the_dervishAI : public ScriptedAI + { + boss_gorosh_the_dervishAI(Creature* creature) : ScriptedAI(creature) { } - struct boss_gorosh_the_dervishAI : public ScriptedAI - { - boss_gorosh_the_dervishAI(Creature* creature) : ScriptedAI(creature) { } + void Reset() override + { + _events.Reset(); + } - uint32 WhirlWind_Timer; - uint32 MortalStrike_Timer; + void EnterCombat(Unit* /*who*/) override + { + _events.ScheduleEvent(EVENT_WHIRLWIND, 12000); + _events.ScheduleEvent(EVENT_MORTALSTRIKE, 22000); + } - void Reset() override - { - WhirlWind_Timer = 12000; - MortalStrike_Timer = 22000; - } + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; - void EnterCombat(Unit* /*who*/) override - { - } + _events.Update(diff); - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_WHIRLWIND: + DoCast(me, SPELL_WHIRLWIND); + _events.ScheduleEvent(EVENT_WHIRLWIND, 15000); + break; + case EVENT_MORTALSTRIKE: + DoCastVictim(SPELL_MORTALSTRIKE); + _events.ScheduleEvent(EVENT_MORTALSTRIKE, 15000); + break; + default: + break; + } + } - //WhirlWind_Timer - if (WhirlWind_Timer <= diff) - { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind_Timer = 15000; - } else WhirlWind_Timer -= diff; + DoMeleeAttackIfReady(); + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) - { - DoCastVictim(SPELL_MORTALSTRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + private: + EventMap _events; + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_gorosh_the_dervishAI(creature); } - }; }; void AddSC_boss_gorosh_the_dervish() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp index c4277c2447e..f53fd0f65b3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_grizzle.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -26,59 +25,83 @@ enum Grizzle EMOTE_FRENZY_KILL = 0 }; -class boss_grizzle : public CreatureScript +enum Events { -public: - boss_grizzle() : CreatureScript("boss_grizzle") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_grizzleAI(creature); - } + EVENT_GROUNDTREMOR = 1, + EVENT_FRENZY = 2 +}; - struct boss_grizzleAI : public ScriptedAI - { - boss_grizzleAI(Creature* creature) : ScriptedAI(creature) { } +enum Phases +{ + PHASE_ONE = 1, + PHASE_TWO = 2 +}; - uint32 GroundTremor_Timer; - uint32 Frenzy_Timer; +class boss_grizzle : public CreatureScript +{ + public: + boss_grizzle() : CreatureScript("boss_grizzle") { } - void Reset() override + struct boss_grizzleAI : public ScriptedAI { - GroundTremor_Timer = 12000; - Frenzy_Timer =0; - } + boss_grizzleAI(Creature* creature) : ScriptedAI(creature) { } - void EnterCombat(Unit* /*who*/) override { } + void Reset() override + { + _events.Reset(); + } - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) override + { + _events.SetPhase(PHASE_ONE); + _events.ScheduleEvent(EVENT_GROUNDTREMOR, 12000); + } - //GroundTremor_Timer - if (GroundTremor_Timer <= diff) + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - DoCastVictim(SPELL_GROUNDTREMOR); - GroundTremor_Timer = 8000; - } else GroundTremor_Timer -= diff; + if (me->HealthBelowPctDamaged(50, damage) && _events.IsInPhase(PHASE_ONE)) + { + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_FRENZY, 0, 0, PHASE_TWO); + } + } - //Frenzy_Timer - if (HealthBelowPct(51)) + void UpdateAI(uint32 diff) override { - if (Frenzy_Timer <= diff) + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - DoCast(me, SPELL_FRENZY); - Talk(EMOTE_FRENZY_KILL); + switch (eventId) + { + case EVENT_GROUNDTREMOR: + DoCastVictim(SPELL_GROUNDTREMOR); + _events.ScheduleEvent(EVENT_GROUNDTREMOR, 8000); + break; + case EVENT_FRENZY: + DoCast(me, SPELL_FRENZY); + Talk(EMOTE_FRENZY_KILL); + _events.ScheduleEvent(EVENT_FRENZY, 15000, 0, PHASE_TWO); + break; + default: + break; + } + } - Frenzy_Timer = 15000; - } else Frenzy_Timer -= diff; + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_grizzleAI(creature); } - }; }; void AddSC_boss_grizzle() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp index 6aa89aa491d..c41ddf9d98b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_high_interrogator_gerstahn.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -27,74 +26,81 @@ enum Spells SPELL_SHADOWSHIELD = 22417 }; -class boss_high_interrogator_gerstahn : public CreatureScript +enum Events { -public: - boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_high_interrogator_gerstahnAI(creature); - } - - struct boss_high_interrogator_gerstahnAI : public ScriptedAI - { - boss_high_interrogator_gerstahnAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 ShadowWordPain_Timer; - uint32 ManaBurn_Timer; - uint32 PsychicScream_Timer; - uint32 ShadowShield_Timer; - - void Reset() override - { - ShadowWordPain_Timer = 4000; - ManaBurn_Timer = 14000; - PsychicScream_Timer = 32000; - ShadowShield_Timer = 8000; - } + EVENT_SHADOW_WORD_PAIN = 1, + EVENT_MANABURN = 2, + EVENT_PSYCHIC_SCREAM = 3, + EVENT_SHADOWSHIELD = 4 +}; - void EnterCombat(Unit* /*who*/) override { } +class boss_high_interrogator_gerstahn : public CreatureScript +{ + public: + boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { } - void UpdateAI(uint32 diff) override + struct boss_high_interrogator_gerstahnAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_high_interrogator_gerstahnAI(Creature* creature) : ScriptedAI(creature) { } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void Reset() override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 7000; - } else ShadowWordPain_Timer -= diff; + _events.Reset(); + } - //ManaBurn_Timer - if (ManaBurn_Timer <= diff) + void EnterCombat(Unit* /*who*/) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_MANABURN); - ManaBurn_Timer = 10000; - } else ManaBurn_Timer -= diff; + _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 4000); + _events.ScheduleEvent(EVENT_MANABURN, 14000); + _events.ScheduleEvent(EVENT_PSYCHIC_SCREAM, 32000); + _events.ScheduleEvent(EVENT_SHADOWSHIELD, 8000); + } - //PsychicScream_Timer - if (PsychicScream_Timer <= diff) + void UpdateAI(uint32 diff) override { - DoCastVictim(SPELL_PSYCHICSCREAM); - PsychicScream_Timer = 30000; - } else PsychicScream_Timer -= diff; + if (!UpdateVictim()) + return; - //ShadowShield_Timer - if (ShadowShield_Timer <= diff) - { - DoCast(me, SPELL_SHADOWSHIELD); - ShadowShield_Timer = 25000; - } else ShadowShield_Timer -= diff; + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOW_WORD_PAIN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_SHADOWWORDPAIN); + _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 7000); + break; + case EVENT_PSYCHIC_SCREAM: + DoCastVictim(SPELL_PSYCHICSCREAM); + _events.ScheduleEvent(EVENT_PSYCHIC_SCREAM, 30000); + break; + case EVENT_MANABURN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_MANABURN); + _events.ScheduleEvent(EVENT_MANABURN, 10000); + break; + case EVENT_SHADOWSHIELD: + DoCast(me, SPELL_SHADOWSHIELD); + _events.ScheduleEvent(EVENT_SHADOWSHIELD, 25000); + break; + default: + break; + } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_high_interrogator_gerstahnAI(creature); } - }; }; void AddSC_boss_high_interrogator_gerstahn() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp index 4cf968ad3b7..e6bbbaa73a9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_magmus.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -18,75 +17,96 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "blackrock_depths.h" enum Spells { - SPELL_FIERYBURST = 13900, - SPELL_WARSTOMP = 24375 + SPELL_FIERYBURST = 13900, + SPELL_WARSTOMP = 24375 }; -enum Misc +enum Events { - DATA_THRONE_DOOR = 24 // not id or guid of doors but number of enum in blackrock_depths.h + EVENT_FIERY_BURST = 1, + EVENT_WARSTOMP = 2 }; -class boss_magmus : public CreatureScript +enum Phases { -public: - boss_magmus() : CreatureScript("boss_magmus") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_magmusAI(creature); - } - - struct boss_magmusAI : public ScriptedAI - { - boss_magmusAI(Creature* creature) : ScriptedAI(creature) { } + PHASE_ONE = 1, + PHASE_TWO = 2 +}; - uint32 FieryBurst_Timer; - uint32 WarStomp_Timer; +class boss_magmus : public CreatureScript +{ + public: + boss_magmus() : CreatureScript("boss_magmus") { } - void Reset() override + struct boss_magmusAI : public ScriptedAI { - FieryBurst_Timer = 5000; - WarStomp_Timer =0; - } + boss_magmusAI(Creature* creature) : ScriptedAI(creature) { } - void EnterCombat(Unit* /*who*/) override { } + void Reset() override + { + _events.Reset(); + } - void UpdateAI(uint32 diff) override - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) override + { + _events.SetPhase(PHASE_ONE); + _events.ScheduleEvent(EVENT_FIERY_BURST, 5000); + } - //FieryBurst_Timer - if (FieryBurst_Timer <= diff) + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - DoCastVictim(SPELL_FIERYBURST); - FieryBurst_Timer = 6000; - } else FieryBurst_Timer -= diff; + if (me->HealthBelowPctDamaged(50, damage) && _events.IsInPhase(PHASE_ONE)) + { + _events.SetPhase(PHASE_TWO); + _events.ScheduleEvent(EVENT_WARSTOMP, 0, 0, PHASE_TWO); + } + } - //WarStomp_Timer - if (HealthBelowPct(51)) + void UpdateAI(uint32 diff) override { - if (WarStomp_Timer <= diff) + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - DoCastVictim(SPELL_WARSTOMP); - WarStomp_Timer = 8000; - } else WarStomp_Timer -= diff; + switch (eventId) + { + case EVENT_FIERY_BURST: + DoCastVictim(SPELL_FIERYBURST); + _events.ScheduleEvent(EVENT_FIERY_BURST, 6000); + break; + case EVENT_WARSTOMP: + DoCastVictim(SPELL_WARSTOMP); + _events.ScheduleEvent(EVENT_WARSTOMP, 8000, 0, PHASE_TWO); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } - // When he die open door to last chamber - void JustDied(Unit* killer) override + void JustDied(Unit* /*killer*/) override + { + if (InstanceScript* instance = me->GetInstanceScript()) + instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override { - if (InstanceScript* instance = killer->GetInstanceScript()) - instance->HandleGameObject(instance->GetData64(DATA_THRONE_DOOR), true); + return new boss_magmusAI(creature); } - }; }; void AddSC_boss_magmus() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp index 98f5f75ae3f..8342bef682b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_moira_bronzebeard.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -29,63 +28,73 @@ enum Spells SPELL_SMITE = 10934 }; -class boss_moira_bronzebeard : public CreatureScript +enum Events { -public: - boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return new boss_moira_bronzebeardAI(creature); - } - - struct boss_moira_bronzebeardAI : public ScriptedAI - { - boss_moira_bronzebeardAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 Heal_Timer; - uint32 MindBlast_Timer; - uint32 ShadowWordPain_Timer; - uint32 Smite_Timer; - - void Reset() override - { - Heal_Timer = 12000; //These times are probably wrong - MindBlast_Timer = 16000; - ShadowWordPain_Timer = 2000; - Smite_Timer = 8000; - } + EVENT_MINDBLAST = 1, + EVENT_SHADOW_WORD_PAIN = 2, + EVENT_SMITE = 3, + EVENT_HEAL = 4 // not used atm +}; - void EnterCombat(Unit* /*who*/) override { } +class boss_moira_bronzebeard : public CreatureScript +{ + public: + boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { } - void UpdateAI(uint32 diff) override + struct boss_moira_bronzebeardAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_moira_bronzebeardAI(Creature* creature) : ScriptedAI(creature) { } - //MindBlast_Timer - if (MindBlast_Timer <= diff) + void Reset() override { - DoCastVictim(SPELL_MINDBLAST); - MindBlast_Timer = 14000; - } else MindBlast_Timer -= diff; + _events.Reset(); + } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void EnterCombat(Unit* /*who*/) override { - DoCastVictim(SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 18000; - } else ShadowWordPain_Timer -= diff; + //_events.ScheduleEvent(EVENT_HEAL, 12000); // not used atm // These times are probably wrong + _events.ScheduleEvent(EVENT_MINDBLAST, 16000); + _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 2000); + _events.ScheduleEvent(EVENT_SMITE, 8000); + } - //Smite_Timer - if (Smite_Timer <= diff) + void UpdateAI(uint32 diff) override { - DoCastVictim(SPELL_SMITE); - Smite_Timer = 10000; - } else Smite_Timer -= diff; + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_MINDBLAST: + DoCastVictim(SPELL_MINDBLAST); + _events.ScheduleEvent(EVENT_MINDBLAST, 14000); + break; + case EVENT_SHADOW_WORD_PAIN: + DoCastVictim(SPELL_SHADOWWORDPAIN); + _events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 18000); + break; + case EVENT_SMITE: + DoCastVictim(SPELL_SMITE); + _events.ScheduleEvent(EVENT_SMITE, 10000); + break; + default: + break; + } + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new boss_moira_bronzebeardAI(creature); } - }; }; void AddSC_boss_moira_bronzebeard() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index cbcafa32a89..83464c12230 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -24,18 +24,24 @@ enum Spells { - SPELL_SMELT_DARK_IRON = 14891, - SPELL_LEARN_SMELT = 14894, + SPELL_SMELT_DARK_IRON = 14891, + SPELL_LEARN_SMELT = 14894, }; enum Quests { - QUEST_SPECTRAL_CHALICE = 4083 + QUEST_SPECTRAL_CHALICE = 4083 }; enum Misc { - DATA_SKILLPOINT_MIN = 230 + DATA_SKILLPOINT_MIN = 230 +}; + +enum Phases +{ + PHASE_ONE = 1, + PHASE_TWO = 2 }; #define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron" @@ -99,149 +105,151 @@ enum DoomrelSpells SPELL_SUMMON_VOIDWALKERS = 15092 }; +enum DoomrelEvents +{ + EVENT_SHADOW_BOLT_VOLLEY = 1, + EVENT_IMMOLATE = 2, + EVENT_CURSE_OF_WEAKNESS = 3, + EVENT_DEMONARMOR = 4, + EVENT_SUMMON_VOIDWALKERS = 5 +}; + #define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" #define GOSSIP_SELECT_DOOMREL "[PH] Continue..." class boss_doomrel : public CreatureScript { -public: - boss_doomrel() : CreatureScript("boss_doomrel") { } + public: + boss_doomrel() : CreatureScript("boss_doomrel") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override - { - player->PlayerTalkClass->ClearMenus(); - switch (action) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(2605, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->CLOSE_GOSSIP_MENU(); - //start event here - creature->setFaction(FACTION_HOSTILE); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - creature->AI()->AttackStart(player); - InstanceScript* instance = creature->GetInstanceScript(); - if (instance) - instance->SetData64(DATA_EVENSTARTER, player->GetGUID()); - break; + player->PlayerTalkClass->ClearMenus(); + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->SEND_GOSSIP_MENU(2605, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->CLOSE_GOSSIP_MENU(); + //start event here + creature->setFaction(FACTION_HOSTILE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + creature->AI()->AttackStart(player); + InstanceScript* instance = creature->GetInstanceScript(); + if (instance) + instance->SetData64(DATA_EVENSTARTER, player->GetGUID()); + break; + } + return true; } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) override - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(2601, creature->GetGUID()); - return true; - } - - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_doomrelAI>(creature); - } - - struct boss_doomrelAI : public ScriptedAI - { - boss_doomrelAI(Creature* creature) : ScriptedAI(creature) + bool OnGossipHello(Player* player, Creature* creature) override { - instance = creature->GetInstanceScript(); - } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(2601, creature->GetGUID()); - InstanceScript* instance; - uint32 ShadowVolley_Timer; - uint32 Immolate_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - bool Voidwalkers; + return true; + } - void Reset() override + struct boss_doomrelAI : public ScriptedAI { - ShadowVolley_Timer = 10000; - Immolate_Timer = 18000; - CurseOfWeakness_Timer = 5000; - DemonArmor_Timer = 16000; - Voidwalkers = false; + boss_doomrelAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - me->setFaction(FACTION_FRIEND); + void Reset() override + { + _voidwalkers = false; - // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->setFaction(FACTION_FRIEND); - if (instance->GetData(DATA_GHOSTKILL) >= 7) - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - else - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } + // was set before event start, so set again + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - void EnterCombat(Unit* /*who*/) override - { - } - - void EnterEvadeMode() override - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(); - if (me->IsAlive()) - me->GetMotionMaster()->MoveTargetedHome(); - me->SetLootRecipient(NULL); - instance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit* /*killer*/) override - { - instance->SetData(DATA_GHOSTKILL, 1); - } + if (_instance->GetData(DATA_GHOSTKILL) >= 7) + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + else + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) override + { + _events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 10000); + _events.ScheduleEvent(EVENT_IMMOLATE, 18000); + _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 5000); + _events.ScheduleEvent(EVENT_DEMONARMOR, 16000); + } - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) override { - DoCastVictim(SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 12000; - } else ShadowVolley_Timer -= diff; + if (!_voidwalkers && !HealthAbovePct(50)) + { + DoCastVictim(SPELL_SUMMON_VOIDWALKERS, true); + _voidwalkers = true; + } + } - //Immolate_Timer - if (Immolate_Timer <= diff) + void EnterEvadeMode() override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_IMMOLATE); + ScriptedAI::EnterEvadeMode(); - Immolate_Timer = 25000; - } else Immolate_Timer -= diff; + _instance->SetData64(DATA_EVENSTARTER, 0); + } - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) + void JustDied(Unit* /*killer*/) override { - DoCastVictim(SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; + _instance->SetData(DATA_GHOSTKILL, 1); + } - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) + void UpdateAI(uint32 diff) override { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; + if (!UpdateVictim()) + return; - //Summon Voidwalkers - if (!Voidwalkers && HealthBelowPct(51)) - { - DoCastVictim(SPELL_SUMMON_VOIDWALKERS, true); - Voidwalkers = true; + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOW_BOLT_VOLLEY: + DoCastVictim(SPELL_SHADOWBOLTVOLLEY); + _events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 12000); + break; + case EVENT_IMMOLATE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_IMMOLATE); + _events.ScheduleEvent(EVENT_IMMOLATE, 25000); + break; + case EVENT_CURSE_OF_WEAKNESS: + DoCastVictim(SPELL_CURSEOFWEAKNESS); + _events.ScheduleEvent(EVENT_CURSE_OF_WEAKNESS, 45000); + break; + case EVENT_DEMONARMOR: + DoCast(me, SPELL_DEMONARMOR); + _events.ScheduleEvent(EVENT_DEMONARMOR, 300000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); + private: + InstanceScript* _instance; + EventMap _events; + bool _voidwalkers; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI<boss_doomrelAI>(creature); } - }; }; void AddSC_boss_tomb_of_seven() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index ab065f62bbb..94bf3e991f4 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -243,37 +243,37 @@ public: switch (eventId) { case EVENT_START_1: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_0); events.ScheduleEvent(EVENT_START_2, 4000); break; case EVENT_START_2: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->HandleEmoteCommand(EMOTE_ONESHOT_POINT); events.ScheduleEvent(EVENT_START_3, 4000); break; case EVENT_START_3: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_1); events.ScheduleEvent(EVENT_WAVE_1, 2000); events.ScheduleEvent(EVENT_TURN_TO_REND, 4000); events.ScheduleEvent(EVENT_WAVES_TEXT_1, 20000); break; case EVENT_TURN_TO_REND: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) { victor->SetFacingToObject(me); victor->HandleEmoteCommand(EMOTE_ONESHOT_TALK); } break; case EVENT_TURN_TO_PLAYER: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) if (Unit* player = victor->SelectNearestPlayer(60.0f)) victor->SetFacingToObject(player); break; case EVENT_TURN_TO_FACING_1: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->SetFacingTo(1.518436f); break; case EVENT_TURN_TO_FACING_2: @@ -283,7 +283,7 @@ public: me->SetFacingTo(1.500983f); break; case EVENT_WAVES_EMOTE_1: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION); break; case EVENT_WAVES_EMOTE_2: @@ -291,7 +291,7 @@ public: break; case EVENT_WAVES_TEXT_1: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_2); me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000); @@ -301,7 +301,7 @@ public: break; case EVENT_WAVES_TEXT_2: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_3); events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000); events.ScheduleEvent(EVENT_WAVE_3, 2000); @@ -309,7 +309,7 @@ public: break; case EVENT_WAVES_TEXT_3: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_4); events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000); events.ScheduleEvent(EVENT_WAVE_4, 2000); @@ -324,7 +324,7 @@ public: break; case EVENT_WAVES_TEXT_5: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_5); events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000); events.ScheduleEvent(EVENT_WAVE_6, 2000); @@ -332,26 +332,26 @@ public: break; case EVENT_WAVES_COMPLETE_TEXT_1: events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_6); events.ScheduleEvent(EVENT_TURN_TO_FACING_1, 4000); events.ScheduleEvent(EVENT_WAVES_COMPLETE_TEXT_2, 13000); break; case EVENT_WAVES_COMPLETE_TEXT_2: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_7); Talk(SAY_BLACKHAND_2); events.ScheduleEvent(EVENT_PATH_REND, 1000); events.ScheduleEvent(EVENT_WAVES_COMPLETE_TEXT_3, 4000); break; case EVENT_WAVES_COMPLETE_TEXT_3: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_8); events.ScheduleEvent(EVENT_PATH_NEFARIUS, 1000); events.ScheduleEvent(EVENT_PATH_REND, 1000); break; case EVENT_PATH_NEFARIUS: - if (Creature* victor = me->GetCreature(*me, victorGUID)) + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->GetMotionMaster()->MovePath(NEFARIUS_PATH_1, true); break; case EVENT_PATH_REND: diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index e645dd383f2..b3a55e1fe4a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -26,7 +26,7 @@ #include "ScriptedCreature.h" #include "blackrock_spire.h" -uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 }; +//uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 }; uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN }; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp index ea4784bb5a4..8d4a84197b1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_razorgore.cpp @@ -167,7 +167,7 @@ public: { if (InstanceScript* instance = go->GetInstanceScript()) if (instance->GetData(DATA_EGG_EVENT) != DONE) - if (Creature* razor = Unit::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED))) + if (Creature* razor = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_RAZORGORE_THE_UNTAMED))) { razor->Attack(player, true); player->CastSpell(razor, SPELL_MINDCONTROL); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index 652bdbb7d4a..5d7e7403686 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -146,8 +146,8 @@ public: break; case EVENT_SPEECH_4: me->setFaction(103); - if (PlayerGUID && Unit::GetUnit(*me, PlayerGUID)) - AttackStart(Unit::GetUnit(*me, PlayerGUID)); + if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) + AttackStart(player); break; } } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 048e6149b4b..6eafb41a8fa 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -147,7 +147,7 @@ class boss_ragnaros : public CreatureScript break; case EVENT_INTRO_4: Talk(SAY_ARRIVAL5_RAG); - if (Creature* executus = Unit::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS))) + if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS))) me->Kill(executus); break; case EVENT_INTRO_5: diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 1398f959e46..b171bf014c7 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -198,7 +198,7 @@ public: if (!SummonList.empty()) for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { - if (Creature* summon = Unit::GetCreature(*me, *itr)) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) { if (summon->IsAlive()) summon->DisappearAndDie(); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 59a04d6a457..b130ac74be3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -101,7 +101,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); - if (Unit* midnight = Unit::GetUnit(*me, Midnight)) + if (Unit* midnight = ObjectAccessor::GetUnit(*me, Midnight)) midnight->Kill(midnight); } @@ -149,7 +149,7 @@ public: { if (Phase == 2) { - if (Unit* unit = Unit::GetUnit(*me, Attumen)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, Attumen)) Talk(SAY_MIDNIGHT_KILL, unit); } } @@ -172,7 +172,7 @@ public: } else if (Phase == 2 && HealthBelowPct(25)) { - if (Unit* pAttumen = Unit::GetUnit(*me, Attumen)) + if (Unit* pAttumen = ObjectAccessor::GetUnit(*me, Attumen)) Mount(pAttumen); } else if (Phase == 3) @@ -184,7 +184,7 @@ public: Mount_Timer = 0; me->SetVisible(false); me->GetMotionMaster()->MoveIdle(); - if (Unit* pAttumen = Unit::GetUnit(*me, Attumen)) + if (Unit* pAttumen = ObjectAccessor::GetUnit(*me, Attumen)) { pAttumen->SetDisplayId(MOUNTED_DISPLAYID); pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -242,7 +242,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) if (ResetTimer <= diff) { ResetTimer = 0; - Unit* pMidnight = Unit::GetUnit(*me, Midnight); + Unit* pMidnight = ObjectAccessor::GetUnit(*me, Midnight); if (pMidnight) { pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -288,7 +288,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) std::vector<Unit*> target_list; for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) { - target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (target && !target->IsWithinDist(me, ATTACK_DISTANCE, false)) target_list.push_back(target); target = NULL; @@ -304,7 +304,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) { if (HealthBelowPct(25)) { - Creature* pMidnight = Unit::GetCreature(*me, Midnight); + Creature* pMidnight = ObjectAccessor::GetCreature(*me, Midnight); if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) { CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 5d52cc62f8a..0ca7ee90986 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -236,7 +236,7 @@ public: { if (AddGUID[i]) { - Creature* temp = Creature::GetCreature((*me), AddGUID[i]); + Creature* temp = ObjectAccessor::GetCreature((*me), AddGUID[i]); if (temp && temp->IsAlive()) { temp->AI()->AttackStart(me->GetVictim()); @@ -270,7 +270,7 @@ public: { if (AddGUID[i]) { - Creature* temp = Unit::GetCreature((*me), AddGUID[i]); + Creature* temp = ObjectAccessor::GetCreature((*me), AddGUID[i]); if (temp && temp->IsAlive()) if (!temp->GetVictim()) temp->AI()->AttackStart(me->GetVictim()); @@ -350,7 +350,7 @@ struct boss_moroes_guestAI : public ScriptedAI void AcquireGUID() { - if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES))) + if (Creature* Moroes = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOROES))) for (uint8 i = 0; i < 4; ++i) if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]) GuestGUID[i] = GUID; @@ -361,7 +361,7 @@ struct boss_moroes_guestAI : public ScriptedAI uint64 TempGUID = GuestGUID[rand()%4]; if (TempGUID) { - Unit* unit = Unit::GetUnit(*me, TempGUID); + Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID); if (unit && unit->IsAlive()) return unit; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 33ea71f81e1..010b7223f97 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -158,9 +158,9 @@ public: { for (int i=0; i<3; ++i) { - if (Creature* portal = Unit::GetCreature(*me, PortalGUID[i])) + if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[i])) portal->DisappearAndDie(); - if (Creature* portal = Unit::GetCreature(*me, BeamerGUID[i])) + if (Creature* portal = ObjectAccessor::GetCreature(*me, BeamerGUID[i])) portal->DisappearAndDie(); PortalGUID[i] = 0; BeamTarget[i] = 0; @@ -170,10 +170,10 @@ public: void UpdatePortals() // Here we handle the beams' behavior { for (int j=0; j<3; ++j) // j = color - if (Creature* portal = Unit::GetCreature(*me, PortalGUID[j])) + if (Creature* portal = ObjectAccessor::GetCreature(*me, PortalGUID[j])) { // the one who's been cast upon before - Unit* current = Unit::GetUnit(*portal, BeamTarget[j]); + Unit* current = ObjectAccessor::GetUnit(*portal, BeamTarget[j]); // temporary store for the best suitable beam reciever Unit* target = me; @@ -205,7 +205,7 @@ public: { BeamTarget[j] = target->GetGUID(); // remove currently beaming portal - if (Creature* beamer = Unit::GetCreature(*portal, BeamerGUID[j])) + if (Creature* beamer = ObjectAccessor::GetCreature(*portal, BeamerGUID[j])) { beamer->CastSpell(target, PortalBeam[j], false); beamer->DisappearAndDie(); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index cf13863f84b..befe72a6403 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -146,7 +146,7 @@ public: void KilledUnit(Unit* who) override { - if (Unit* unit = Unit::GetUnit(*me, malchezaar)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, malchezaar)) if (Creature* creature = unit->ToCreature()) creature->AI()->KilledUnit(who); } @@ -273,7 +273,7 @@ public: { //Infernal Cleanup for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) - if (Unit* pInfernal = Unit::GetUnit(*me, *itr)) + if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr)) if (pInfernal->IsAlive()) { pInfernal->SetVisible(false); @@ -287,7 +287,7 @@ public: { for (uint8 i = 0; i < 2; ++i) { - Unit* axe = Unit::GetUnit(*me, axes[i]); + Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]); if (axe && axe->IsAlive()) axe->Kill(axe); axes[i] = 0; @@ -316,7 +316,7 @@ public: ThreatContainer::StorageType::const_iterator itr = t_list.begin(); std::advance(itr, 1); for (; itr != t_list.end(); ++itr) //store the threat list in a different container - if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); @@ -340,7 +340,7 @@ public: { for (uint8 i = 0; i < 5; ++i) { - Unit* target = Unit::GetUnit(*me, enfeeble_targets[i]); + Unit* target = ObjectAccessor::GetUnit(*me, enfeeble_targets[i]); if (target && target->IsAlive()) target->SetHealth(enfeeble_health[i]); enfeeble_targets[i] = 0; @@ -480,7 +480,7 @@ public: { for (uint8 i = 0; i < 2; ++i) { - if (Unit* axe = Unit::GetUnit(*me, axes[i])) + if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i])) { if (axe->GetVictim()) DoModifyThreatPercent(axe->GetVictim(), -100); @@ -583,7 +583,7 @@ public: void netherspite_infernal::netherspite_infernalAI::Cleanup() { - Creature* pMalchezaar = Unit::GetCreature(*me, malchezaar); + Creature* pMalchezaar = ObjectAccessor::GetCreature(*me, malchezaar); if (pMalchezaar && pMalchezaar->IsAlive()) CAST_AI(boss_malchezaar::boss_malchezaarAI, pMalchezaar->AI())->Cleanup(me, point); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 0a3a697c6a7..9bda41b03a1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -184,7 +184,7 @@ public: //store the threat list in a different container for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); //only on alive players if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); @@ -450,7 +450,7 @@ public: if (!FlameWreathTarget[i]) continue; - Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]); + Unit* unit = ObjectAccessor::GetUnit(*me, FlameWreathTarget[i]); if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) { unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 24ea77c5c93..2cdaf4b4e4a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -102,7 +102,7 @@ public: uint64 TerestianGUID = instance->GetData64(DATA_TERESTIAN); if (TerestianGUID) { - Unit* Terestian = Unit::GetUnit(*me, TerestianGUID); + Unit* Terestian = ObjectAccessor::GetUnit(*me, TerestianGUID); if (Terestian && Terestian->IsAlive()) DoCast(Terestian, SPELL_BROKEN_PACT, true); } @@ -157,7 +157,7 @@ public: { if (SacrificeGUID) { - Unit* Sacrifice = Unit::GetUnit(*me, SacrificeGUID); + Unit* Sacrifice = ObjectAccessor::GetUnit(*me, SacrificeGUID); if (Sacrifice) Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); } @@ -279,7 +279,7 @@ public: { if (PortalGUID[i]) { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i])) + if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[i])) { CAST_AI(npc_fiendish_portal::npc_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); pPortal->DespawnOrUnsummon(); @@ -344,7 +344,7 @@ public: { if (PortalGUID[i]) { - if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i])) + if (Creature* pPortal = ObjectAccessor::GetCreature((*me), PortalGUID[i])) pPortal->DespawnOrUnsummon(); PortalGUID[i] = 0; @@ -395,7 +395,7 @@ public: if (PortalGUID[0] && PortalGUID[1]) { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0, 1)])) + if (Creature* pPortal = ObjectAccessor::GetCreature(*me, PortalGUID[urand(0, 1)])) pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP, false); SummonTimer = 5000; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 010e06d67cb..c0e6a8d3b90 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -109,7 +109,7 @@ void SummonCroneIfReady(InstanceScript* instance, Creature* creature) pCrone->AI()->AttackStart(creature->GetVictim()); } } -}; +} class boss_dorothee : public CreatureScript { @@ -254,7 +254,7 @@ public: { if (DorotheeGUID) { - Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID)); + Creature* Dorothee = (ObjectAccessor::GetCreature((*me), DorotheeGUID)); if (Dorothee && Dorothee->IsAlive()) { CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; @@ -893,7 +893,7 @@ public: { IsChasing = false; - if (Unit* target = Unit::GetUnit(*me, HoodGUID)) + if (Unit* target = ObjectAccessor::GetUnit(*me, HoodGUID)) { HoodGUID = 0; if (DoGetThreat(target)) @@ -1186,7 +1186,7 @@ public: IsFakingDeath = true; Phase = PHASE_BOTH; - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID))) { CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; @@ -1200,7 +1200,7 @@ public: { if (JulianneDead) { - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID))) { Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Julianne->GetMotionMaster()->Clear(); @@ -1212,7 +1212,7 @@ public: return; } - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID))) { PretendToDie(me); IsFakingDeath = true; @@ -1231,7 +1231,7 @@ public: Talk(SAY_ROMULO_AGGRO); if (JulianneGUID) { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)); if (Julianne && Julianne->GetVictim()) { me->AddThreat(Julianne->GetVictim(), 1.0f); @@ -1275,7 +1275,7 @@ public: { if (ResurrectTimer <= diff) { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)); if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) { Talk(SAY_ROMULO_RESURRECT); @@ -1395,7 +1395,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff) { if (ResurrectTimer <= diff) { - Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); + Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)); if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) { Talk(SAY_JULIANNE_RESURRECT); @@ -1430,7 +1430,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff) { if (urand(0, 1) && SummonedRomulo) { - Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); + Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)); if (Romulo && Romulo->IsAlive() && !RomuloDead) DoCast(Romulo, SPELL_ETERNAL_AFFECTION); } else DoCast(me, SPELL_ETERNAL_AFFECTION); @@ -1460,7 +1460,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama DoCast(me, SPELL_DRINK_POISON); IsFakingDeath = true; - //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + //IS THIS USEFULL? Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)); return; } @@ -1476,7 +1476,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama //if this is true then we have to kill romulo too if (RomuloDead) { - if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) + if (Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID))) { Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Romulo->GetMotionMaster()->Clear(); @@ -1490,7 +1490,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama } //if not already returned, then romulo is alive and we can pretend die - if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID))) + if (Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID))) { PretendToDie(me); IsFakingDeath = true; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 9db4c4b2bfa..976a83a98c2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -286,7 +286,7 @@ public: { if (TalkCount > 3) { - if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID)) + if (Creature* pSpotlight = ObjectAccessor::GetCreature(*me, m_uiSpotlightGUID)) pSpotlight->DespawnOrUnsummon(); SetEscortPaused(false); @@ -539,7 +539,7 @@ public: uint32 NextStep(uint32 Step) { - Creature* arca = Unit::GetCreature(*me, ArcanagosGUID); + Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID); Map* map = me->GetMap(); switch (Step) { @@ -630,7 +630,7 @@ public: if (Step >= 7 && Step <= 12) { - Unit* arca = Unit::GetUnit(*me, ArcanagosGUID); + Unit* arca = ObjectAccessor::GetUnit(*me, ArcanagosGUID); if (FireArcanagosTimer <= diff) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index e0c902427c2..3c4b372808b 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -196,7 +196,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->IsAlive()) { float threat = me->getThreatManager().getThreat(unit); @@ -214,7 +214,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true); } @@ -227,7 +227,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) // Knockback into the air unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); @@ -240,7 +240,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { // Also needs an exception in spell system. @@ -260,7 +260,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 046db7fc654..8dc8ff799ba 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -162,7 +162,7 @@ public: for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i])) { if (!pAdd->GetVictim()) { @@ -210,7 +210,7 @@ public: { for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) { - Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]); + Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[j]); //object already removed, not exist if (!pAdd) @@ -271,7 +271,7 @@ public: Unit* target = me; for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i])) { if (pAdd->IsAlive() && pAdd->GetHealth() < health) target = pAdd; @@ -287,7 +287,7 @@ public: Unit* target = me; if (urand(0, 1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive()) target = pAdd; @@ -300,7 +300,7 @@ public: Unit* target = me; if (urand(0, 1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive() && !pAdd->HasAura(SPELL_SHIELD)) target = pAdd; @@ -319,7 +319,7 @@ public: if (urand(0, 1)) target = me; else - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive()) target = pAdd; } @@ -390,7 +390,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i])) { if (!pAdd->GetVictim() && pAdd != me) { @@ -400,7 +400,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI } } - if (Creature* pDelrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) + if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) { if (pDelrissa->IsAlive() && !pDelrissa->GetVictim()) { @@ -412,7 +412,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void JustDied(Unit* /*killer*/) override { - Creature* pDelrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA)); + Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)); uint32 uiLackeyDeathCount = instance->GetData(DATA_DELRISSA_DEATH_COUNT); if (!pDelrissa) @@ -441,13 +441,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI void KilledUnit(Unit* victim) override { - if (Creature* Delrissa = Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) + if (Creature* Delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA))) Delrissa->AI()->KilledUnit(victim); } void AcquireGUIDs() { - if (Creature* Delrissa = (Unit::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))) + if (Creature* Delrissa = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DELRISSA)))) { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; @@ -832,7 +832,7 @@ public: ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { //if in melee range if (target->IsWithinDistInMap(me, 5)) @@ -918,7 +918,7 @@ public: ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { //if in melee range if (target->IsWithinDistInMap(me, ATTACK_DISTANCE)) @@ -1022,7 +1022,7 @@ public: Wing_Clip_Timer = 4000; Freezing_Trap_Timer = 15000; - Unit* pPet = Unit::GetUnit(*me, m_uiPetGUID); + Unit* pPet = ObjectAccessor::GetUnit(*me, m_uiPetGUID); if (!pPet) me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); @@ -1171,7 +1171,7 @@ public: // uint64 guid = (*itr)->guid; // if (guid) // { - // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid); + // Unit* pAdd = ObjectAccessor::GetUnit(*me, (*itr)->guid); // if (pAdd && pAdd->IsAlive()) // { DoCast(me, SPELL_LESSER_HEALING_WAVE); @@ -1256,7 +1256,7 @@ public: { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i])) { if (pAdd->IsPolymorphed()) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 74e9321d08c..d77f5db9cea 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -107,8 +107,8 @@ public: //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - //Unit* unit = Unit::GetUnit(*me, FelCrystals[i]); - if (Creature* creature = Unit::GetCreature(*me, *itr)) + //Unit* unit = ObjectAccessor::GetUnit(*me, FelCrystals[i]); + if (Creature* creature = ObjectAccessor::GetCreature(*me, *itr)) { if (!creature->IsAlive()) creature->Respawn(); // Let the core handle setting death state, etc. @@ -148,8 +148,8 @@ public: for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { pCrystal = NULL; - //pCrystal = Unit::GetUnit(*me, FelCrystals[i]); - pCrystal = Unit::GetUnit(*me, *itr); + //pCrystal = ObjectAccessor::GetUnit(*me, FelCrystals[i]); + pCrystal = ObjectAccessor::GetUnit(*me, *itr); if (pCrystal && pCrystal->IsAlive()) { // select nearest @@ -184,8 +184,8 @@ public: //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i])); - Creature* pCrystal = Unit::GetCreature(*me, *itr); + //Creature* pCrystal = (ObjectAccessor::GetCreature(*me, FelCrystals[i])); + Creature* pCrystal = ObjectAccessor::GetCreature(*me, *itr); if (pCrystal && pCrystal->IsAlive()) pCrystal->Kill(pCrystal); } @@ -206,7 +206,7 @@ public: { if (type == POINT_MOTION_TYPE && id == 1) { - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + Unit* CrystalChosen = ObjectAccessor::GetUnit(*me, CrystalGUID); if (CrystalChosen && CrystalChosen->IsAlive()) { // Make the crystal attackable @@ -292,7 +292,7 @@ public: Talk(SAY_EMPOWERED); - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + Unit* CrystalChosen = ObjectAccessor::GetUnit(*me, CrystalGUID); if (CrystalChosen && CrystalChosen->IsAlive()) // Use Deal Damage to kill it, not setDeathState. CrystalChosen->Kill(CrystalChosen); @@ -335,7 +335,7 @@ public: { if (InstanceScript* instance = me->GetInstanceScript()) { - Creature* Selin = (Unit::GetCreature(*me, instance->GetData64(DATA_SELIN))); + Creature* Selin = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SELIN))); if (Selin && Selin->IsAlive()) { if (CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID()) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 8bc136a1a1d..fff8a92dfcd 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -314,7 +314,7 @@ public: { if (Creature* anchor = go->FindNearestCreature(29521, 15)) if (uint64 prisonerGUID = anchor->AI()->GetGUID()) - if (Creature* prisoner = Creature::GetCreature(*player, prisonerGUID)) + if (Creature* prisoner = ObjectAccessor::GetCreature(*player, prisonerGUID)) CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player); return false; @@ -467,7 +467,7 @@ public: { me->setFaction(FACTION_HOSTILE); - if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, m_uiDuelerGUID)) AttackStart(unit); } else @@ -1049,14 +1049,14 @@ class npc_scarlet_miner : public CreatureScript { if (IntroPhase == 1) { - if (Creature* car = Unit::GetCreature(*me, carGUID)) + if (Creature* car = ObjectAccessor::GetCreature(*me, carGUID)) DoCast(car, SPELL_CART_DRAG); IntroTimer = 800; IntroPhase = 2; } else { - if (Creature* car = Unit::GetCreature(*me, carGUID)) + if (Creature* car = ObjectAccessor::GetCreature(*me, carGUID)) car->AI()->DoAction(0); IntroPhase = 0; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 88c30efdf71..09377f20bed 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -307,7 +307,7 @@ public: break; case 4: { - Creature* temp = Unit::GetCreature(*me, valrothGUID); + Creature* temp = ObjectAccessor::GetCreature(*me, valrothGUID); if (!temp || !temp->IsAlive()) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 8d5e10679ec..40773c87b68 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -400,15 +400,15 @@ public: //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->setDeathState(JUST_DIED); - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) temp->setDeathState(JUST_DIED); - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) temp->setDeathState(JUST_DIED); - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) temp->setDeathState(JUST_DIED); - if (Creature* temp = Unit::GetCreature(*me, uiRayneGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiRayneGUID)) temp->setDeathState(JUST_DIED); uiTirionGUID = 0; @@ -419,24 +419,24 @@ public: for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiDefenderGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i])) temp->setDeathState(JUST_DIED); uiDefenderGUID[i] = 0; } for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i])) temp->setDeathState(JUST_DIED); uiEarthshatterGUID[i] = 0; } - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) temp->Respawn(); - if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) temp->Respawn(); - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) temp->Respawn(); - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->Respawn(); uiKoltiraGUID = 0; @@ -445,25 +445,25 @@ public: uiLichKingGUID = 0; for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiAbominationGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i])) temp->setDeathState(JUST_DIED); uiAbominationGUID[i] = 0; } for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiBehemothGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i])) temp->setDeathState(JUST_DIED); uiBehemothGUID[i] = 0; } for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiGhoulGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i])) temp->setDeathState(JUST_DIED); uiGhoulGUID[i] = 0; } for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { - if (Creature* temp = Unit::GetCreature(*me, uiWarriorGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i])) temp->setDeathState(JUST_DIED); uiWarriorGUID[i] = 0; } @@ -514,9 +514,9 @@ public: case 1: SetHoldState(true); SpawnNPC(); - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN07); - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN08); for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) @@ -534,9 +534,9 @@ public: me->Dismount(); me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) temp->Dismount(); - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) temp->Dismount(); bIsBattle = true; @@ -547,37 +547,37 @@ public: break; case 3: { - //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); + //Unit* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID); Talk(EMOTE_LIGHT_OF_DAWN05); if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); } - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); } - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->SetWalk(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); } - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) { temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); } - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); @@ -589,9 +589,9 @@ public: Talk(SAY_LIGHT_OF_DAWN27); me->SetStandState(UNIT_STAND_STATE_KNEEL); - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) temp->SetStandState(UNIT_STAND_STATE_KNEEL); - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) temp->SetStandState(UNIT_STAND_STATE_KNEEL); SetHoldState(true); break; @@ -610,7 +610,7 @@ public: break; case 8: me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) me->CastSpell(temp, SPELL_ASHBRINGER, true); Talk(EMOTE_LIGHT_OF_DAWN14); SetHoldState(true); @@ -743,51 +743,51 @@ public: case 9: // charge begins SetHoldState(false); - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } - if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) { temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); } for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - if (Creature* temp = Unit::GetCreature(*me, uiAbominationGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i])) temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - if (Creature* temp = Unit::GetCreature(*me, uiBehemothGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i])) temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - if (Creature* temp = Unit::GetCreature(*me, uiGhoulGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i])) temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - if (Creature* temp = Unit::GetCreature(*me, uiWarriorGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i])) temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); JumpToNextStep(5000); break; // ******* After battle ***************************************************************** case 11: // Tirion starts to speak - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN28); JumpToNextStep(21000); break; case 12: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN29); JumpToNextStep(13000); break; case 13: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN30); JumpToNextStep(13000); break; @@ -810,7 +810,7 @@ public: break; case 16: // Alexandros out - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); @@ -837,7 +837,7 @@ public: break; case 19: // runs to father - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN07); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); @@ -846,59 +846,59 @@ public: break; case 20: - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN36); JumpToNextStep(4000); break; case 21: - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN08); JumpToNextStep(4000); break; case 22: - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN37); JumpToNextStep(8000); break; case 23: - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN38); JumpToNextStep(8000); break; case 24: - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN39); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); JumpToNextStep(15000); break; case 25: - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN40); JumpToNextStep(11000); break; case 26: - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN41); JumpToNextStep(5000); break; case 27: - if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) temp->setDeathState(JUST_DIED); JumpToNextStep(24000); break; case 28: - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN42); JumpToNextStep(6000); break; @@ -908,19 +908,19 @@ public: { temp->AI()->Talk(SAY_LIGHT_OF_DAWN43); uiLichKingGUID = temp->GetGUID(); - if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID)) + if (Unit* pAlex = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) temp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false); } JumpToNextStep(2000); break; case 30: - if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) // just hide him { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN09); temp->SetVisible(false); } - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) { temp->InterruptNonMeleeSpells(false); temp->AI()->Talk(SAY_LIGHT_OF_DAWN45); @@ -936,13 +936,13 @@ public: break; case 32: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); JumpToNextStep(6000); break; case 33: // Darion supports to jump to lich king here - if (Unit::GetCreature(*me, uiLichKingGUID)) + if (ObjectAccessor::GetCreature(*me, uiLichKingGUID)) DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge // doesn't make it looks well, so workarounds, Darion charges, looks better me->SetSpeed(MOVE_RUN, 3.0f); @@ -952,7 +952,7 @@ public: break; case 35: // Lich king counterattacks - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) { temp->HandleEmoteCommand(EMOTE_ONESHOT_KICK); temp->AI()->Talk(SAY_LIGHT_OF_DAWN46); @@ -969,29 +969,29 @@ public: break; case 38: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN47); JumpToNextStep(8000); break; case 39: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN48); JumpToNextStep(15000); break; case 40: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN49); JumpToNextStep(17000); break; case 41: // Lich king - Apocalypse - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN11); temp->AI()->Talk(SAY_LIGHT_OF_DAWN51); - if (Creature* pTirion = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* pTirion = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { pTirion->SetStandState(UNIT_STAND_STATE_KNEEL); //temp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working @@ -1007,7 +1007,7 @@ public: float fLichPositionX = 0, fLichPositionY = 0, fLichPositionZ = 0; - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) { fLichPositionX = temp->GetPositionX(); fLichPositionY = temp->GetPositionY(); @@ -1032,7 +1032,7 @@ public: temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); uiEarthshatterGUID[0] = temp->GetGUID(); } - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); @@ -1040,7 +1040,7 @@ public: temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); temp->AI()->Talk(SAY_LIGHT_OF_DAWN50); } - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); @@ -1048,7 +1048,7 @@ public: temp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); } - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); @@ -1060,37 +1060,37 @@ public: break; case 43: // They all got kicked - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN13); - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); } - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); } - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); } - if (Creature* temp = Unit::GetCreature(*me, uiDefenderGUID[0])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[0])) { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); } - if (Creature* temp = Unit::GetCreature(*me, uiEarthshatterGUID[0])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[0])) { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); @@ -1100,11 +1100,11 @@ public: break; case 44: // make them stand up - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) temp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) temp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) temp->SetStandState(UNIT_STAND_STATE_STAND); JumpToNextStep(1000); break; @@ -1126,7 +1126,7 @@ public: case 47: // Ashbringer rebirth me->SetStandState(UNIT_STAND_STATE_KNEEL); Talk(EMOTE_LIGHT_OF_DAWN15); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { temp->SetStandState(UNIT_STAND_STATE_STAND); temp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING)); @@ -1139,38 +1139,38 @@ public: //if (GameObject* go = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // go->SetPhaseMask(128, true); me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896f, -5287.914f, 83.066f, 0, 0, 0, 0, 0, 30000); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { if (temp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) temp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); temp->CastSpell(temp, 41542, false); // workarounds, light expoded, makes it cool temp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); } - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->InterruptNonMeleeSpells(false); JumpToNextStep(2500); break; case 49: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN54); JumpToNextStep(4000); break; case 50: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN55); JumpToNextStep(5000); break; case 51: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN56); JumpToNextStep(1000); break; case 52: // Tiron charges - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN16); temp->CastSpell(temp, SPELL_TIRION_CHARGE, false); // jumping charge @@ -1178,20 +1178,20 @@ public: temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running temp->SetWalk(false); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); - if (Creature* lktemp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* lktemp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him } JumpToNextStep(1500); break; case 53: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN57); JumpToNextStep(1000); break; case 54: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) { temp->SetSpeed(MOVE_RUN, 1.0f); me->SetWalk(true); @@ -1201,33 +1201,33 @@ public: break; case 55: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->SetStandState(UNIT_STAND_STATE_KNEEL); JumpToNextStep(2000); break; case 56: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->SetStandState(UNIT_STAND_STATE_STAND); JumpToNextStep(1500); break; case 57: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN58); JumpToNextStep(10000); break; case 58: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN59); JumpToNextStep(10000); break; case 59: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->CastSpell(temp, SPELL_TELEPORT_VISUAL, false); - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 1.0f); @@ -1237,7 +1237,7 @@ public: break; case 60: - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN17); temp->Kill(temp); @@ -1246,13 +1246,13 @@ public: break; case 61: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN60); JumpToNextStep(3000); break; case 62: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { temp->SetWalk(true); temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); @@ -1261,7 +1261,7 @@ public: break; case 63: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); temp->AI()->Talk(SAY_LIGHT_OF_DAWN61); @@ -1270,37 +1270,37 @@ public: break; case 64: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN62); JumpToNextStep(7000); break; case 65: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN63); JumpToNextStep(10000); break; case 66: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN64); JumpToNextStep(11000); break; case 67: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN65); JumpToNextStep(10000); break; case 68: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN66); JumpToNextStep(8000); break; case 69: - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN67); JumpToNextStep(10000); break; @@ -1335,13 +1335,13 @@ public: break; case 73: - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) temp->DespawnOrUnsummon(); - if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) temp->DespawnOrUnsummon(); - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) temp->DespawnOrUnsummon(); - if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) temp->DespawnOrUnsummon(); me->DespawnOrUnsummon(); break; @@ -1452,7 +1452,7 @@ public: for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) DespawnNPC(uiWarriorGUID[i]); - if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->RemoveAllAuras(); temp->DeleteThreatList(); @@ -1463,7 +1463,7 @@ public: temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); } - if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) { temp->RemoveAllAuras(); temp->DeleteThreatList(); @@ -1474,7 +1474,7 @@ public: temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); } - if (Creature* temp = Unit::GetCreature(*me, uiEligorGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->RemoveAllAuras(); temp->DeleteThreatList(); @@ -1486,7 +1486,7 @@ public: } DespawnNPC(uiRayneGUID); - if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { temp->RemoveAllAuras(); temp->DeleteThreatList(); @@ -1498,10 +1498,10 @@ public: temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } - if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN04); - if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { temp->RemoveAllAuras(); temp->DeleteThreatList(); @@ -1513,7 +1513,7 @@ public: temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } - if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) temp->AI()->Talk(SAY_LIGHT_OF_DAWN26); SetHoldState(false); @@ -1532,7 +1532,7 @@ public: void NPCChangeTarget(uint64 ui_GUID) { - if (Creature* temp = Unit::GetCreature(*me, ui_GUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, ui_GUID)) if (temp->IsAlive()) if (Unit* pTarger = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (pTarger->IsAlive()) @@ -1553,7 +1553,7 @@ public: // Death for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiGhoulGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1563,7 +1563,7 @@ public: } for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiAbominationGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1573,7 +1573,7 @@ public: } for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiWarriorGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1583,7 +1583,7 @@ public: } for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiBehemothGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1595,7 +1595,7 @@ public: // Dawn for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiDefenderGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1606,7 +1606,7 @@ public: } for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) { - temp = Unit::GetCreature(*me, uiEarthshatterGUID[i]); + temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]); if (!temp) { temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1615,7 +1615,7 @@ public: uiEarthshatterGUID[i] = temp->GetGUID(); } } - temp = Unit::GetCreature(*me, uiKorfaxGUID); + temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID); if (!temp) { temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); @@ -1623,7 +1623,7 @@ public: me->AddThreat(temp, 0.0f); uiKorfaxGUID = temp->GetGUID(); } - temp = Unit::GetCreature(*me, uiMaxwellGUID); + temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID); if (!temp) { temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); @@ -1631,7 +1631,7 @@ public: me->AddThreat(temp, 0.0f); uiMaxwellGUID = temp->GetGUID(); } - temp = Unit::GetCreature(*me, uiEligorGUID); + temp = ObjectAccessor::GetCreature(*me, uiEligorGUID); if (!temp) { temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); @@ -1639,7 +1639,7 @@ public: me->AddThreat(temp, 0.0f); uiEligorGUID = temp->GetGUID(); } - temp = Unit::GetCreature(*me, uiRayneGUID); + temp = ObjectAccessor::GetCreature(*me, uiRayneGUID); if (!temp) { temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); @@ -1651,7 +1651,7 @@ public: void DespawnNPC(uint64 pGUID) { - if (Creature* temp = Unit::GetCreature(*me, pGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, pGUID)) if (temp->IsAlive()) { temp->SetVisible(false); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index f47a3bc3a86..cad51dd55e0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -99,7 +99,7 @@ public: FlyBackTimer = 4500; break; case 2: - if (!player->IsRessurectRequested()) + if (!player->IsResurrectRequested()) { me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01); DoCast(player, SPELL_REVIVE, true); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 423f8f26130..0be681af915 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -356,7 +356,7 @@ public: if (wait <= diff) { die = false; - if (Unit* body = Unit::GetUnit(*me, bodyGUID)) + if (Unit* body = ObjectAccessor::GetUnit(*me, bodyGUID)) body->Kill(body); me->Kill(me); } @@ -428,7 +428,7 @@ public: DoCast(me, SPELL_HEAD); if (headGUID) { - if (Creature* Head = Unit::GetCreature((*me), headGUID)) + if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID)) Head->DisappearAndDie(); headGUID = 0; @@ -483,7 +483,7 @@ public: wp_reached = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); SaySound(SAY_ENTRANCE); - if (Unit* player = Unit::GetUnit(*me, PlayerGUID)) + if (Unit* player = ObjectAccessor::GetUnit(*me, PlayerGUID)) DoStartMovement(player); break; } @@ -516,7 +516,7 @@ public: if (withhead) SaySound(SAY_PLAYER_DEATH); //maybe possible when player dies from conflagration - else if (Creature* Head = Unit::GetCreature((*me), headGUID)) + else if (Creature* Head = ObjectAccessor::GetCreature((*me), headGUID)) CAST_AI(npc_head::npc_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); } } @@ -601,7 +601,7 @@ public: ThreatContainer::StorageType threatlist = caster->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->IsAlive() && unit != caster) me->AddThreat(unit, caster->getThreatManager().getThreat(unit)); } @@ -621,7 +621,7 @@ public: if (!headGUID) headGUID = DoSpawnCreature(HEAD, float(rand()%6), float(rand()%6), 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->GetGUID(); - Unit* Head = Unit::GetUnit(*me, headGUID); + Unit* Head = ObjectAccessor::GetUnit(*me, headGUID); if (Head && Head->IsAlive()) { Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -746,7 +746,7 @@ public: --Phase; else Phase = 1; - Creature* Head = Unit::GetCreature((*me), headGUID); + Creature* Head = ObjectAccessor::GetCreature((*me), headGUID); if (Head && Head->IsAlive()) { CAST_AI(npc_head::npc_headAI, Head->AI())->Phase = Phase; @@ -837,7 +837,7 @@ public: if (!debuffGUID) return; - Unit* debuff = Unit::GetUnit(*me, debuffGUID); + Unit* debuff = ObjectAccessor::GetUnit(*me, debuffGUID); if (debuff) { debuff->SetVisible(false); @@ -909,7 +909,7 @@ void npc_head::npc_headAI::Disappear() if (bodyGUID) { - Creature* body = Unit::GetCreature((*me), bodyGUID); + Creature* body = ObjectAccessor::GetCreature((*me), bodyGUID); if (body && body->IsAlive()) { withbody = true; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index e345dc60074..a7c795a81f6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -84,7 +84,7 @@ public: void JustDied(Unit* /*killer*/) override { //Any other Actions to do with vorrel? setStandState? - if (Creature* vorrel = Creature::GetCreature(*me, instance->GetData64(DATA_VORREL))) + if (Creature* vorrel = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VORREL))) vorrel->AI()->Talk(SAY_TRIGGER_VORREL); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index a8d1f91c443..25bb08620a1 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -33,12 +33,12 @@ enum Says //Mograine says SAY_MO_AGGRO = 0, SAY_MO_KILL = 1, - SAY_MO_RESSURECTED = 2, + SAY_MO_RESURRECTED = 2, //Whitemane says SAY_WH_INTRO = 0, SAY_WH_KILL = 1, - SAY_WH_RESSURECT = 2, + SAY_WH_RESURRECT = 2, }; enum Spells @@ -127,7 +127,7 @@ public: return; //On first death, fake death and open door, as well as initiate whitemane if exist - if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) + if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) { instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); @@ -157,10 +157,10 @@ public: void SpellHit(Unit* /*who*/, const SpellInfo* spell) override { - //When hit with ressurection say text + //When hit with resurrection say text if (spell->Id == SPELL_SCARLETRESURRECTION) { - Talk(SAY_MO_RESSURECTED); + Talk(SAY_MO_RESURRECTED); _bFakeDeath = false; instance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); @@ -174,8 +174,8 @@ public: if (_bHasDied && !_bHeal && instance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) { - //On ressurection, stop fake death and heal whitemane and resume fight - if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) + //On resurrection, stop fake death and heal whitemane and resume fight + if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_WHITEMANE))) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetStandState(UNIT_STAND_STATE_STAND); @@ -294,7 +294,7 @@ public: if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE))) { DoCast(mograine, SPELL_SCARLETRESURRECTION); - Talk(SAY_WH_RESSURECT); + Talk(SAY_WH_RESURRECT); _bCanResurrect = false; } } @@ -325,7 +325,7 @@ public: if (!HealthAbovePct(75)) target = me; - if (Creature* mograine = Unit::GetCreature(*me, instance->GetData64(DATA_MOGRAINE))) + if (Creature* mograine = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOGRAINE))) { // checking _bCanResurrectCheck prevents her healing Mograine while he is "faking death" if (_bCanResurrectCheck && mograine->IsAlive() && !mograine->HealthAbovePct(75)) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 9bcf67bce8c..4109328afda 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -187,7 +187,7 @@ public: { if (Die_Timer <= diff) { - if (Unit* temp = Unit::GetUnit(*me, Tagger)) + if (Unit* temp = ObjectAccessor::GetUnit(*me, Tagger)) { if (Player* player = temp->ToPlayer()) player->KilledMonsterCredit(NPC_RESTLESS, me->GetGUID()); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 5bca936d5b4..8a9699ed1be 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -280,7 +280,7 @@ public: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); if (!target) { @@ -306,7 +306,7 @@ public: Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); if (!target) { @@ -335,7 +335,7 @@ public: { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); if (!target) - target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); if (!target) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 5562559786d..d300703152c 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -679,13 +679,16 @@ public: if (!map->IsDungeon()) return; - Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map::PlayerList const &playerList = map->GetPlayers(); + Position homePos = me->GetHomePosition(); + for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { - if (i->GetSource()->GetPositionZ() <= DRAGON_REALM_Z-5) + Player* player = itr->GetSource(); + if (player->IsInDist(&homePos, 50.0f) && player->GetPositionZ() <= DEMON_REALM_Z + 10.f) { - i->GetSource()->RemoveAura(AURA_SPECTRAL_REALM); - i->GetSource()->TeleportTo(me->GetMap()->GetId(), i->GetSource()->GetPositionX(), i->GetSource()->GetPositionY(), DRAGON_REALM_Z+5, i->GetSource()->GetOrientation()); + player->RemoveAura(AURA_SPECTRAL_REALM); + player->TeleportTo(me->GetMap()->GetId(), player->GetPositionX(), + player->GetPositionY(), DRAGON_REALM_Z + 5, player->GetOrientation()); } } } @@ -763,7 +766,7 @@ public: ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (unit->GetPositionZ() > me->GetPositionZ() + 5) me->getThreatManager().modifyThreatPercent(unit, -100); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 179a649aab4..565d40a802e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -956,7 +956,7 @@ public: ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit) pPortal->AddThreat(unit, 1.0f); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 9d9232b774d..faecb2ca2f0 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -603,7 +603,7 @@ public: { if (SpellTimer <= diff) { - Unit* Victim = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + Unit* Victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); switch (NeedForAHack) { case 0: diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 9134f15959f..f06dc247883 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -94,7 +94,7 @@ class boss_archaedas : public CreatureScript void ActivateMinion(uint64 uiGuid, bool flag) { - Unit* minion = Unit::GetUnit(*me, uiGuid); + Unit* minion = ObjectAccessor::GetUnit(*me, uiGuid); if (minion && minion->IsAlive()) { @@ -139,7 +139,7 @@ class boss_archaedas : public CreatureScript } else if (bWakingUp && iAwakenTimer <= 0) { bWakingUp = false; - AttackStart(Unit::GetUnit(*me, instance->GetData64(0))); + AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); return; // dont want to continue until we finish the AttackStart method } @@ -285,7 +285,7 @@ class npc_archaedas_minions : public CreatureScript { bWakingUp = false; bAmIAwake = true; - // AttackStart(Unit::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID + // AttackStart(ObjectAccessor::GetUnit(*me, instance->GetData64(0))); // whoWokeArchaedasGUID return; // dont want to continue until we finish the AttackStart method } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 717406e6750..56c84677181 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -252,7 +252,7 @@ class instance_uldaman : public InstanceMapScript if (!archaedas) return; - if (Unit::GetUnit(*archaedas, target)) + if (ObjectAccessor::GetUnit(*archaedas, target)) { archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN, false); whoWokeuiArchaedasGUID = target; diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 07cdcefcbbb..0958a9141f0 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -130,7 +130,7 @@ public: { if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) { - if (Creature* target = Unit::GetCreature(*summoned, targetGUID)) + if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID)) { target->MonsterMoveWithSpeed(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0); target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f); diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 65b21520102..c9798338b36 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -1036,7 +1036,7 @@ class npc_grizzlemaw_cw_trigger : public CreatureScript if (who && who->GetDistance2d(me) < 10.0f) if (Player* player = who->ToPlayer()) if (player->GetQuestStatus(QUEST_HOME_OF_THE_BEAR_MEN) == QUEST_STATUS_INCOMPLETE) - if (Creature* orphan = Creature::GetCreature(*me, getOrphanGUID(player, ORPHAN_WOLVAR))) + if (Creature* orphan = ObjectAccessor::GetCreature(*me, getOrphanGUID(player, ORPHAN_WOLVAR))) { player->AreaExploredOrEventHappens(QUEST_HOME_OF_THE_BEAR_MEN); orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_10); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index ebe9939390f..7aaa2239745 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -94,7 +94,7 @@ public: { if (waypointId == 7) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index c0f3ea35004..d86e3342cf0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -118,7 +118,7 @@ public: { if (CheckTimer <= diff) { - if (Unit* Archimonde = Unit::GetUnit(*me, ArchimondeGUID)) + if (Unit* Archimonde = ObjectAccessor::GetUnit(*me, ArchimondeGUID)) { if (Archimonde->HealthBelowPct(2) || !Archimonde->IsAlive()) DoCast(me, SPELL_DENOUEMENT_WISP); @@ -205,7 +205,7 @@ public: { if (ChangeTargetTimer <= diff) { - if (Unit* temp = Unit::GetUnit(*me, TargetGUID)) + if (Unit* temp = ObjectAccessor::GetUnit(*me, TargetGUID)) { me->GetMotionMaster()->MoveFollow(temp, 0.0f, 0.0f); TargetGUID = 0; @@ -364,7 +364,7 @@ public: ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); for (; itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->IsAlive()) targets.push_back(unit); } @@ -406,7 +406,7 @@ public: summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false); summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID()); - if (Unit* DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID)) + if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID)) { summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f); DoomfireSpiritGUID = 0; @@ -487,7 +487,7 @@ public: if (temp) WorldTreeGUID = temp->GetGUID(); - if (Unit* Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID)) { Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Nordrassil->SetDisplayId(11686); @@ -496,7 +496,7 @@ public: } } - if (Unit* Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID)) { Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); DrainNordrassilTimer = 1000; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index d7c48541315..c9e010e4159 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -99,7 +99,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 235b27dfb10..606188250dd 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -94,7 +94,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 21fe3ab946b..9ac5034d954 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -89,7 +89,7 @@ public: { if (waypointId == 7 && instance) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index c8006158ef1..4e6da7dcac2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -665,7 +665,7 @@ void hyjalAI::DeSpawnVeins() { if (Faction == 1) { - Creature* unit=Unit::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); + Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); if (!unit)return; hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); if (!ai)return; @@ -676,7 +676,7 @@ void hyjalAI::DeSpawnVeins() } } else if (Faction) { - Creature* unit=Unit::GetCreature((*me), instance->GetData64(DATA_THRALL)); + Creature* unit=ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_THRALL)); if (!unit)return; hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); if (!ai)return; @@ -804,7 +804,7 @@ void hyjalAI::UpdateAI(uint32 diff) { if (BossGUID[i]) { - Unit* unit = Unit::GetUnit(*me, BossGUID[i]); + Unit* unit = ObjectAccessor::GetUnit(*me, BossGUID[i]); if (unit && (!unit->IsAlive())) { if (BossGUID[i] == BossGUID[0]) @@ -937,7 +937,7 @@ void hyjalAI::WaypointReached(uint32 waypointId) DoCast(me, SPELL_MASS_TELEPORT, false); if (me->GetEntry() == THRALL && DummyGuid) { - if (Creature* creature = Unit::GetCreature(*me, DummyGuid)) + if (Creature* creature = ObjectAccessor::GetCreature(*me, DummyGuid)) { hyjalAI* ai = CAST_AI(hyjalAI, creature->AI()); ai->DoMassTeleport = true; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 038b7ab69ce..85de43cb4c4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -447,7 +447,7 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -486,7 +486,7 @@ public: CanMove = true; if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT)) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){ @@ -563,13 +563,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -662,13 +662,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -773,13 +773,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -886,13 +886,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -982,13 +982,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -1068,13 +1068,13 @@ public: { if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } else { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE)); if (target && target->IsAlive()) me->AddThreat(target, 0.0f); } @@ -1155,7 +1155,7 @@ public: { if (waypointId == 2 && !IsOverrun) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) { me->AddThreat(target, 0.0f); @@ -1276,7 +1276,7 @@ public: { if (waypointId == 2 && !IsOverrun) { - Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL)); + Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THRALL)); if (target && target->IsAlive()) { me->AddThreat(target, 0.0f); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 0e6d60395d8..fd832051421 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -627,7 +627,7 @@ public: JumpToNextStep(2000); break; case 3: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) { uther->AI()->Talk(SAY_PHASE102); } @@ -642,13 +642,13 @@ public: break; //After waypoint 1 case 5: - if (Creature* jaina = Unit::GetCreature(*me, jainaGUID)) + if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) jaina->SetTarget(me->GetGUID()); Talk(SAY_PHASE104); JumpToNextStep(10000); break; case 6: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->AI()->Talk(SAY_PHASE105); JumpToNextStep(1000); break; @@ -657,7 +657,7 @@ public: JumpToNextStep(4000); break; case 8: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->AI()->Talk(SAY_PHASE107); JumpToNextStep(6000); break; @@ -666,7 +666,7 @@ public: JumpToNextStep(4000); break; case 10: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->AI()->Talk(SAY_PHASE109); JumpToNextStep(8000); break; @@ -675,7 +675,7 @@ public: JumpToNextStep(4000); break; case 12: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->AI()->Talk(SAY_PHASE111); JumpToNextStep(4000); break; @@ -684,7 +684,7 @@ public: JumpToNextStep(11000); break; case 14: - if (Creature* jaina = Unit::GetCreature(*me, jainaGUID)) + if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) jaina->AI()->Talk(SAY_PHASE113); JumpToNextStep(3000); break; @@ -693,12 +693,12 @@ public: JumpToNextStep(9000); break; case 16: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->AI()->Talk(SAY_PHASE115); JumpToNextStep(4000); break; case 17: - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) { uther->SetWalk(true); uther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f); @@ -706,7 +706,7 @@ public: JumpToNextStep(1000); break; case 18: - if (Creature* jaina = Unit::GetCreature(*me, jainaGUID)) + if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) { me->SetTarget(jainaGUID); jaina->SetWalk(true); @@ -719,7 +719,7 @@ public: JumpToNextStep(1000); break; case 20: - if (Creature* jaina = Unit::GetCreature(*me, jainaGUID)) + if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) jaina->AI()->Talk(SAY_PHASE117); JumpToNextStep(3000); break; @@ -740,10 +740,10 @@ public: bStepping = false; SetRun(true); - if (Creature* jaina = Unit::GetCreature(*me, jainaGUID)) + if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) jaina->DisappearAndDie(); - if (Creature* uther = Unit::GetCreature(*me, utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, utherGUID)) uther->DisappearAndDie(); me->SetTarget(0); @@ -772,7 +772,7 @@ public: //After waypoint 9 case 27: me->SetTarget(citymenGUID[0]); - if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0])) + if (Creature* cityman = ObjectAccessor::GetCreature(*me, citymenGUID[0])) { cityman->SetTarget(me->GetGUID()); cityman->SetWalk(true); @@ -781,7 +781,7 @@ public: JumpToNextStep(2000); break; case 28: - if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0])) + if (Creature* cityman = ObjectAccessor::GetCreature(*me, citymenGUID[0])) cityman->AI()->Talk(SAY_PHASE202); JumpToNextStep(4000); break; @@ -799,11 +799,11 @@ public: case 31: SetEscortPaused(false); bStepping = false; - if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1])) + if (Creature* cityman1 = ObjectAccessor::GetCreature(*me, citymenGUID[1])) { cityman1->AI()->Talk(SAY_PHASE204); cityman1->SetTarget(me->GetGUID()); - if (Creature* cityman0 = Unit::GetCreature(*me, citymenGUID[0])) + if (Creature* cityman0 = ObjectAccessor::GetCreature(*me, citymenGUID[0])) cityman0->Kill(cityman0); me->SetTarget(citymenGUID[1]); } @@ -815,7 +815,7 @@ public: JumpToNextStep(1000); break; case 33: - if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1])) + if (Creature* cityman1 = ObjectAccessor::GetCreature(*me, citymenGUID[1])) cityman1->Kill(cityman1); JumpToNextStep(1000); break; @@ -839,7 +839,7 @@ public: case 36: if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000)) { - if (Creature* pStalkerM = Unit::GetCreature(*me, stalkerGUID)) + if (Creature* pStalkerM = ObjectAccessor::GetCreature(*me, stalkerGUID)) malganis->CastSpell(pStalkerM, 63793, false); malganisGUID = malganis->GetGUID(); @@ -850,7 +850,7 @@ public: JumpToNextStep(11000); break; case 37: - if (Creature* malganis = Unit::GetCreature(*me, malganisGUID)) + if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID)) { Creature* pZombie = GetClosestCreatureWithEntry(malganis, NPC_CITY_MAN, 100.0f); if (!pZombie) @@ -865,12 +865,12 @@ public: phaseTimer = 500; break; case 38: - if (Creature* malganis = Unit::GetCreature(*me, malganisGUID)) + if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID)) malganis->AI()->Talk(SAY_PHASE207); JumpToNextStep(17000); break; case 39: - if (Creature* malganis = Unit::GetCreature(*me, malganisGUID)) + if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID)) malganis->SetVisible(false); Talk(SAY_PHASE208); JumpToNextStep(7000); @@ -922,7 +922,7 @@ public: if (waveGUID[i] == 0) break; ++mobCounter; - Unit* temp = Unit::GetCreature(*me, waveGUID[i]); + Unit* temp = ObjectAccessor::GetCreature(*me, waveGUID[i]); if (!temp || temp->isDead()) ++deadCounter; } @@ -976,16 +976,16 @@ public: //After Gossip 2 (waypoint 22) case 61: me->SetReactState(REACT_AGGRESSIVE); - if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0])) + if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0])) disguised0->SetTarget(me->GetGUID()); - if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1])) + if (Creature* disguised1 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[1])) disguised1->SetTarget(me->GetGUID()); - if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2])) + if (Creature* disguised2 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[2])) disguised2->SetTarget(me->GetGUID()); JumpToNextStep(1000); break; case 62: - if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0])) + if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0])) disguised0->AI()->Talk(SAY_PHASE302); JumpToNextStep(7000); break; @@ -1001,7 +1001,7 @@ public: JumpToNextStep(1000); break; case 65: - if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0])) + if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0])) disguised0->HandleEmoteCommand(11); JumpToNextStep(1000); break; @@ -1010,12 +1010,12 @@ public: JumpToNextStep(2000); break; case 67: - if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0])) + if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0])) disguised0->AI()->Talk(SAY_PHASE305); JumpToNextStep(1000); break; case 68: - if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2])) + if (Creature* disguised2 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[2])) { disguised2->UpdateEntry(NPC_INFINITE_HUNTER); //Make them unattackable @@ -1025,7 +1025,7 @@ public: JumpToNextStep(2000); break; case 69: - if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1])) + if (Creature* disguised1 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[1])) { disguised1->UpdateEntry(NPC_INFINITE_AGENT); //Make them unattackable @@ -1035,7 +1035,7 @@ public: JumpToNextStep(2000); break; case 70: - if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0])) + if (Creature* disguised0 = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[0])) { disguised0->UpdateEntry(NPC_INFINITE_ADVERSARY); //Make them unattackable @@ -1051,7 +1051,7 @@ public: case 77: //Make cratures attackable for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) - if (Creature* temp = Unit::GetCreature(*me, infiniteDraconianGUID[i])) + if (Creature* temp = ObjectAccessor::GetCreature(*me, infiniteDraconianGUID[i])) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); temp->SetReactState(REACT_AGGRESSIVE); @@ -1091,7 +1091,7 @@ public: if (instance->GetData(DATA_EPOCH_EVENT) != DONE) { SpawnTimeRift(17, &epochGUID); - if (Creature* epoch = Unit::GetCreature(*me, epochGUID)) + if (Creature* epoch = ObjectAccessor::GetCreature(*me, epochGUID)) epoch->AI()->Talk(SAY_PHASE314); me->SetTarget(epochGUID); } @@ -1105,7 +1105,7 @@ public: case 82: if (instance->GetData(DATA_EPOCH_EVENT) != DONE) { - if (Creature* epoch = Unit::GetCreature(*me, epochGUID)) + if (Creature* epoch = ObjectAccessor::GetCreature(*me, epochGUID)) { //Make Epoch attackable epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); @@ -1157,7 +1157,7 @@ public: me->SetTarget(malganisGUID); break; case 87: - if (Creature* malganis = Unit::GetCreature(*me, malganisGUID)) + if (Creature* malganis = ObjectAccessor::GetCreature(*me, malganisGUID)) { malganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_UNK_6 | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNK_15); malganis->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index dbd844aa34c..503166e0b12 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -187,7 +187,7 @@ class instance_culling_of_stratholme : public InstanceMapScript // Summon Chromie and global whisper if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos)) if (!instance->GetPlayers().isEmpty()) - sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + chromie->AI()->TalkToMap(SAY_CRATES_COMPLETED); } DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount); break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index f6ff1719391..14f9bfb2e2f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -402,7 +402,7 @@ public: case 94: if (uint64 TarethaGUID = instance->GetData64(DATA_TARETHA)) { - if (Creature* Taretha = Creature::GetCreature(*me, TarethaGUID)) + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, TarethaGUID)) Taretha->AI()->Talk(SAY_TA_ESCAPED, me); } break; @@ -590,7 +590,7 @@ public: if (instance->GetData64(DATA_EPOCH) == 0) creature->SummonCreature(ENTRY_EPOCH, 2639.13f, 698.55f, 65.43f, 4.59f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); - if (Creature* thrall = (Unit::GetCreature(*creature, instance->GetData64(DATA_THRALL)))) + if (Creature* thrall = (ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_THRALL)))) CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, thrall->AI())->StartWP(); } } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 35086afa42e..21da920e4fd 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -545,7 +545,7 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* unit = Unit::GetUnit(*me, i->first); + Unit* unit = ObjectAccessor::GetUnit(*me, i->first); //Only units out of stomach if (unit && i->second == false) @@ -640,7 +640,7 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase - //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); + //AttackStart(ObjectAccessor::GetUnit(*me, HoldpPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach @@ -686,7 +686,7 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* unit = Unit::GetUnit(*me, i->first); + Unit* unit = ObjectAccessor::GetUnit(*me, i->first); //Only move units in stomach if (unit && i->second == true) @@ -717,7 +717,7 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* unit = Unit::GetUnit(*me, i->first); + Unit* unit = ObjectAccessor::GetUnit(*me, i->first); //Only apply to units in stomach if (unit && i->second == true) @@ -767,7 +767,7 @@ public: if (StomachEnterVisTimer <= diff) { //Check for valid player - Unit* unit = Unit::GetUnit(*me, StomachEnterTarget); + Unit* unit = ObjectAccessor::GetUnit(*me, StomachEnterTarget); if (unit) { @@ -917,7 +917,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); } @@ -998,7 +998,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); } @@ -1026,7 +1026,7 @@ public: { if (EvadeTimer <= diff) { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); //Dissapear and reappear at new position @@ -1115,7 +1115,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); } @@ -1144,7 +1144,7 @@ public: { if (EvadeTimer <= diff) { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); //Dissapear and reappear at new position @@ -1234,7 +1234,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Unit* p = Unit::GetUnit(*me, Portal)) + if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) p->Kill(p); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 6775d84d435..acf0215f9ff 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -103,7 +103,7 @@ struct boss_twinemperorsAI : public ScriptedAI Creature* GetOtherBoss() { - return Unit::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR)); + return ObjectAccessor::GetCreature(*me, instance->GetData64(IAmVeklor() ? DATA_VEKNILASH : DATA_VEKLOR)); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index aa9180d79c2..0614303515c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -132,7 +132,7 @@ public: void SendMyListToBuddies() { for (int i=0; i<3; ++i) - if (Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i])) GiveBuddyMyList(pNearby); } @@ -140,7 +140,7 @@ public: { for (int i=0; i<3; ++i) { - Creature* c = Unit::GetCreature(*me, NearbyGUID[i]); + Creature* c = ObjectAccessor::GetCreature(*me, NearbyGUID[i]); if (c) { if (!c->IsInCombat()) @@ -195,7 +195,7 @@ public: if (!NearbyGUID[bli]) break; - Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); + Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[bli]); if (!pNearby) break; @@ -221,7 +221,7 @@ public: { if (!NearbyGUID[i]) continue; - if (Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + if (Creature* pNearby = ObjectAccessor::GetCreature(*me, NearbyGUID[i])) { if (pNearby->isDead()) pNearby->Respawn(); @@ -250,7 +250,7 @@ public: { for (int ni=0; ni<3; ++ni) { - Creature* sent = Unit::GetCreature(*me, NearbyGUID[ni]); + Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]); if (!sent) continue; if (sent->isDead()) diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 51e97b43554..c3c1d7c146b 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -442,7 +442,7 @@ public: uint32 NextStep(uint8 Step) { - Creature* Spark = Unit::GetCreature(*me, SparkGUID); + Creature* Spark = ObjectAccessor::GetCreature(*me, SparkGUID); if (!Spark) return 99999999; diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 3dd2419de4a..00ef96dc785 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -706,7 +706,7 @@ public: break; case 65: me->SetVisible(false); - if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID))) + if (Creature* AnachronosQuestTrigger = (ObjectAccessor::GetCreature(*me, AnachronosQuestTriggerGUID))) { Talk(ARYGOS_YELL_1); AnachronosQuestTrigger->AI()->EnterEvadeMode(); @@ -1002,11 +1002,11 @@ void npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) if (!MobGUID) return; - if (Creature* mob = Unit::GetCreature(*me, MobGUID)) + if (Creature* mob = ObjectAccessor::GetCreature(*me, MobGUID)) if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, mob->AI())) triggerAI->LiveCounter(); -}; +} /*##### # go_crystalline_tear diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index 780ee046eda..af0bfdd982d 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -515,7 +515,7 @@ public: { PostEventTimer = 5000; - Creature* torta = Creature::GetCreature(*me, TortaGUID); + Creature* torta = ObjectAccessor::GetCreature(*me, TortaGUID); if (!torta || !torta->IsAlive()) { //something happened, so just complete diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp index b9bfedc59e3..42caaaca9fd 100644 --- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp +++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp @@ -375,7 +375,7 @@ public: { if (AffrayChallenger[i]) { - Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); + Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i]); if (creature && creature->IsAlive()) creature->DisappearAndDie(); } @@ -383,7 +383,7 @@ public: if (BigWill) // unsummon bigWill { - Creature* creature = Unit::GetCreature((*me), BigWill); + Creature* creature = ObjectAccessor::GetCreature((*me), BigWill); if (creature && creature->IsAlive()) creature->DisappearAndDie(); } @@ -424,7 +424,7 @@ public: { if (AffrayChallenger[i]) { - Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]); + Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i]); if ((!creature || (!creature->IsAlive())) && !ChallengerDown[i]) { Talk(SAY_TWIGGY_FLATHEAD_DOWN); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 09fdbcbce70..1c042f4d185 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -211,7 +211,7 @@ public: // Check if all summons in this phase killed for (SummonList::const_iterator iter = Summons.begin(); iter != Summons.end(); ++iter) { - if (Creature* visage = Unit::GetCreature(*me, *iter)) + if (Creature* visage = ObjectAccessor::GetCreature(*me, *iter)) { // Not all are dead if (phase == visage->GetPhaseMask()) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index aab0f22169f..b78bdae5c87 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -212,7 +212,7 @@ public: } else { - if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_PL_JEDOGA_TARGET))) { AttackStart(target); instance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index a4c3edb85f3..bf5855c3318 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -188,7 +188,7 @@ public: } break; case IMPALE_PHASE_ATTACK: - if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget)) + if (Creature* impaleTarget = ObjectAccessor::GetCreature(*me, ImpaleTarget)) { impaleTarget->CastSpell(impaleTarget, SPELL_IMPALE_SPIKE, false); impaleTarget->RemoveAurasDueToSpell(SPELL_IMPALE_SHAKEGROUND); @@ -197,7 +197,7 @@ public: ImpaleTimer = 1*IN_MILLISECONDS; break; case IMPALE_PHASE_DMG: - if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget)) + if (Creature* impaleTarget = ObjectAccessor::GetCreature(*me, ImpaleTarget)) me->CastSpell(impaleTarget, SPELL_IMPALE_DMG, true); ImpalePhase = IMPALE_PHASE_TARGET; ImpaleTimer = 9*IN_MILLISECONDS; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 12c3c580cae..81e124cf5bc 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -178,15 +178,15 @@ public: Talk(SAY_SARTHARION_DEATH); _JustDied(); - if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) if (tenebron->IsAlive()) tenebron->DisappearAndDie(); - if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) if (shadron->IsAlive()) shadron->DisappearAndDie(); - if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) if (vesperon->IsAlive()) vesperon->DisappearAndDie(); } @@ -211,7 +211,7 @@ public: void DrakeRespawn() // Drakes respawning system { - if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) { tenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f); if (tenebron->IsAlive()) @@ -231,7 +231,7 @@ public: } } - if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) { shadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f); if (shadron->IsAlive()) @@ -251,7 +251,7 @@ public: } } - if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) { vesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f); if (vesperon->IsAlive()) @@ -280,7 +280,7 @@ public: //if at least one of the dragons are alive and are being called bool _canUseWill = false; - if (Creature* fetchTene = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (Creature* fetchTene = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) { if (fetchTene->IsAlive() && !fetchTene->GetVictim()) { @@ -298,7 +298,7 @@ public: } } - if (Creature* fetchShad = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (Creature* fetchShad = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) { if (fetchShad->IsAlive() && !fetchShad->GetVictim()) { @@ -316,7 +316,7 @@ public: } } - if (Creature* fetchVesp = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) { if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim()) { @@ -340,7 +340,7 @@ public: void CallDragon(uint32 dataId) { - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(dataId))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(dataId))) { if (temp->IsAlive() && !temp->GetVictim()) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index cb0cba21d6c..7e9e351ae9c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -292,7 +292,7 @@ public: bHealth = false; bDone = false; - if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (Creature* pMemory = ObjectAccessor::GetCreature(*me, MemoryGUID)) if (pMemory->IsAlive()) pMemory->RemoveFromWorld(); } @@ -373,7 +373,7 @@ public: DoCast(me, SPELL_RENEW); break; case 1: - if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (Creature* pMemory = ObjectAccessor::GetCreature(*me, MemoryGUID)) if (pMemory->IsAlive()) DoCast(pMemory, SPELL_RENEW); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 46817e46512..a8aff70b034 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -140,7 +140,7 @@ public: for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { - if (Creature* temp = Unit::GetCreature(*me, *itr)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) if (temp) temp->DisappearAndDie(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index c1d6d2c7c3f..b39734224f6 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -126,9 +126,9 @@ bool GrandChampionsOutVehicle(Creature* me) if (!instance) return false; - Creature* pGrandChampion1 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1)); - Creature* pGrandChampion2 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2)); - Creature* pGrandChampion3 = Unit::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3)); + Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_1)); + Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_2)); + Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GRAND_CHAMPION_3)); if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) { @@ -829,7 +829,7 @@ public: if (bShoot && uiMultiShotTimer <= uiDiff) { me->InterruptNonMeleeSpells(true); - Unit* target = Unit::GetUnit(*me, uiTargetGUID); + Unit* target = ObjectAccessor::GetUnit(*me, uiTargetGUID); if (target && me->IsInRange(target, 5.0f, 30.0f, false)) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index faeb92e4595..e22ee040599 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -161,7 +161,7 @@ public: } for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) - if (Creature* summon = Unit::GetCreature(*me, *itr)) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) AggroAllPlayers(summon); }else if (uiLesserChampions == 9) StartGrandChampionsAttack(); @@ -173,9 +173,9 @@ public: void StartGrandChampionsAttack() { - Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID); - Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID); - Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID); + Creature* pGrandChampion1 = ObjectAccessor::GetCreature(*me, uiVehicle1GUID); + Creature* pGrandChampion2 = ObjectAccessor::GetCreature(*me, uiVehicle2GUID); + Creature* pGrandChampion3 = ObjectAccessor::GetCreature(*me, uiVehicle3GUID); if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) { @@ -417,7 +417,7 @@ public: if (!Champion1List.empty()) { for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) - if (Creature* summon = Unit::GetCreature(*me, *itr)) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) AggroAllPlayers(summon); NextStep(0, false); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 77e4e740333..6a664ec7f8d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -344,7 +344,7 @@ class boss_anubarak_trial : public CreatureScript uint32 at = urand(0, _burrowGUID.size()-1); for (uint32 k = 0; k < at; k++) ++i; - if (Creature* pBurrow = Unit::GetCreature(*me, *i)) + if (Creature* pBurrow = ObjectAccessor::GetCreature(*me, *i)) pBurrow->CastSpell(pBurrow, 66340, false); events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED); @@ -377,7 +377,7 @@ class boss_anubarak_trial : public CreatureScript uint8 i = startAt; do { - if (Unit* pSphere = Unit::GetCreature(*me, _sphereGUID[i])) + if (Unit* pSphere = ObjectAccessor::GetCreature(*me, _sphereGUID[i])) { if (!pSphere->HasAura(SPELL_FROST_SPHERE)) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 71df7d05378..77697cdb3e8 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -479,7 +479,7 @@ class boss_toc_champion_controller : public CreatureScript case 1: for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i) { - if (Creature* temp = Unit::GetCreature(*me, *i)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, *i)) { temp->SetReactState(REACT_AGGRESSIVE); temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); @@ -559,7 +559,7 @@ struct boss_faction_championsAI : public BossAI void JustReachedHome() override { - if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, FAIL); me->DespawnOrUnsummon(); } @@ -577,7 +577,7 @@ struct boss_faction_championsAI : public BossAI std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && me->getThreatManager().getThreat(unit)) { if (unit->GetTypeId() == TYPEID_PLAYER) @@ -609,7 +609,7 @@ struct boss_faction_championsAI : public BossAI void JustDied(Unit* /*killer*/) override { if (_aiType != AI_PET) - if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, DONE); } @@ -617,7 +617,7 @@ struct boss_faction_championsAI : public BossAI { DoCast(me, SPELL_ANTI_AOE, true); _EnterCombat(); - if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(2, IN_PROGRESS); } @@ -634,11 +634,11 @@ struct boss_faction_championsAI : public BossAI if (TeamInInstance == ALLIANCE) { - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VARIAN))) temp->AI()->Talk(SAY_KILL_PLAYER); } else - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GARROSH))) temp->AI()->Talk(SAY_KILL_PLAYER); @@ -663,7 +663,7 @@ struct boss_faction_championsAI : public BossAI Unit* target; for (iter = tList.begin(); iter!=tList.end(); ++iter) { - target = Unit::GetUnit(*me, (*iter)->getUnitGuid()); + target = ObjectAccessor::GetUnit(*me, (*iter)->getUnitGuid()); if (target && target->getPowerType() == POWER_MANA) return target; } @@ -678,7 +678,7 @@ struct boss_faction_championsAI : public BossAI Unit* target; for (iter = tList.begin(); iter != tList.end(); ++iter) { - target = Unit::GetUnit(*me, (*iter)->getUnitGuid()); + target = ObjectAccessor::GetUnit(*me, (*iter)->getUnitGuid()); if (target && me->GetDistance2d(target) < distance) ++count; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index abeafe156ad..c0f7b2f1856 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -553,7 +553,7 @@ class spell_mistress_kiss_area : public SpellScriptLoader class spell_mistress_kiss_area_SpellScript : public SpellScript { - PrepareSpellScript(spell_mistress_kiss_area_SpellScript) + PrepareSpellScript(spell_mistress_kiss_area_SpellScript); void FilterTargets(std::list<WorldObject*>& targets) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index f45a57bd0bc..9e75bef9735 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -508,7 +508,7 @@ struct boss_jormungarAI : public BossAI void JustDied(Unit* /*killer*/) override { - if (Creature* otherWorm = Unit::GetCreature(*me, instance->GetData64(OtherWormEntry))) + if (Creature* otherWorm = ObjectAccessor::GetCreature(*me, instance->GetData64(OtherWormEntry))) { if (!otherWorm->IsAlive()) { diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 00eb970b57b..e40cd9d5f41 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -245,7 +245,7 @@ struct boss_twin_baseAI : public BossAI // Called when sister pointer needed Creature* GetSister() { - return Unit::GetCreature((*me), instance->GetData64(SisterNpcId)); + return ObjectAccessor::GetCreature((*me), instance->GetData64(SisterNpcId)); } void EnterCombat(Unit* /*who*/) override @@ -673,8 +673,7 @@ class spell_powering_up : public SpellScriptLoader class spell_powering_up_SpellScript : public SpellScript { - public: - PrepareSpellScript(spell_powering_up_SpellScript) + PrepareSpellScript(spell_powering_up_SpellScript); uint32 spellId; uint32 poweringUp; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 64afe8d5b2e..7cab84ee4a7 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -95,7 +95,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript // make sure Anub'arak isnt missing and floor is destroyed after a crash if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE) { - Creature* anubArak = Unit::GetCreature(*player, GetData64(NPC_ANUBARAK)); + Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK)); if (!anubArak) anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 74e4f4caa9d..11548ba4b1c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -173,7 +173,7 @@ class npc_announcer_toc10 : public CreatureScript else if (instance->GetBossState(BOSS_JARAXXUS) != DONE) { // if Jaraxxus is spawned, but the raid wiped - if (Creature* jaraxxus = Unit::GetCreature(*player, instance->GetData64(NPC_JARAXXUS))) + if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_JARAXXUS))) { jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS); jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -207,7 +207,7 @@ class npc_announcer_toc10 : public CreatureScript creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false); creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false); - Creature* anubArak = Unit::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK)); + Creature* anubArak = ObjectAccessor::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK)); if (!anubArak || !anubArak->IsAlive()) anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); @@ -330,7 +330,7 @@ class boss_lich_king_toc : public CreatureScript me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false); _instance->SetBossState(BOSS_LICH_KING, DONE); - Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)); + Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)); if (!temp || !temp->IsAlive()) temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); @@ -377,7 +377,7 @@ class npc_fizzlebang_toc : public CreatureScript { Talk(SAY_STAGE_1_06, killer); _instance->SetData(TYPE_EVENT, 1180); - if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); temp->SetReactState(REACT_AGGRESSIVE); @@ -484,23 +484,23 @@ class npc_fizzlebang_toc : public CreatureScript _updateTimer = 5*IN_MILLISECONDS; break; case 1142: - if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) temp->SetTarget(me->GetGUID()); - if (Creature* pTrigger = Unit::GetCreature(*me, _triggerGUID)) + if (Creature* pTrigger = ObjectAccessor::GetCreature(*me, _triggerGUID)) pTrigger->DespawnOrUnsummon(); - if (Creature* pPortal = Unit::GetCreature(*me, _portalGUID)) + if (Creature* pPortal = ObjectAccessor::GetCreature(*me, _portalGUID)) pPortal->DespawnOrUnsummon(); _instance->SetData(TYPE_EVENT, 1144); _updateTimer = 10*IN_MILLISECONDS; break; case 1144: - if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) temp->AI()->Talk(SAY_STAGE_1_05); _instance->SetData(TYPE_EVENT, 1150); _updateTimer = 5*IN_MILLISECONDS; break; case 1150: - if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS))) { //1-shot Fizzlebang temp->CastSpell(me, 67888, false); @@ -699,7 +699,7 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 3092); break; case 3092: - if (Creature* pChampionController = Unit::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER))) pChampionController->AI()->SetData(1, NOT_STARTED); _instance->SetData(TYPE_EVENT, 3095); break; @@ -735,12 +735,12 @@ class npc_tirion_toc : public CreatureScript break; case 4015: _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR)); - if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE))) + if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); temp->SetVisible(true); } - if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_DARKBANE))) + if (Creature* temp = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_DARKBANE))) { temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); temp->SetVisible(true); @@ -779,7 +779,7 @@ class npc_tirion_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 6005); break; case 6005: - if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_06); _updateTimer = 20*IN_MILLISECONDS; _instance->SetData(TYPE_EVENT, 6010); @@ -787,7 +787,7 @@ class npc_tirion_toc : public CreatureScript case 6010: if (IsHeroic()) { - if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) + if (Creature* tirionFordring = ObjectAccessor::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING))) tirionFordring->AI()->Talk(SAY_STAGE_4_07); _updateTimer = 1*MINUTE*IN_MILLISECONDS; _instance->SetBossState(BOSS_ANUBARAK, SPECIAL); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index 562105c0866..8a62453d7c1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -40,7 +40,7 @@ enum SpellIds enum MiscData { - DESPAWN_TIME = 300000, + DESPAWN_TIME = 1200000, DISPLAYID_DESTROYED_FLOOR = 9060 }; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 72e4b0b5eb9..63b1359a406 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -314,7 +314,7 @@ public: { if (InstanceScript* instance = me->GetInstanceScript()) if (uint64 guid = instance->GetData64(DATA_NOVOS)) - if (Creature* novos = Creature::GetCreature(*me, guid)) + if (Creature* novos = ObjectAccessor::GetCreature(*me, guid)) novos->AI()->JustSummoned(summon); if (summon) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 0c5514a1c0a..4303026ba64 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1100,7 +1100,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript Talk(SAY_JAINA_ESCAPE_9); if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetData64(DATA_GUNSHIP))) gunship->EnableMovement(true); - _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE); + _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE); break; case EVENT_ESCAPE_17: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -1139,7 +1139,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript struct npc_the_lich_king_escape_horAI : public ScriptedAI { - npc_the_lich_king_escape_horAI(Creature* creature) : ScriptedAI(creature) + npc_the_lich_king_escape_horAI(Creature* creature) : ScriptedAI(creature) { _instance = me->GetInstanceScript(); _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, NOT_STARTED); @@ -1248,12 +1248,12 @@ class npc_the_lich_king_escape_hor : public CreatureScript _events.ScheduleEvent(EVENT_ESCAPE_SUMMON_WITCH_DOCTOR, 66000); _events.ScheduleEvent(EVENT_ESCAPE_SUMMON_LUMBERING_ABOMINATION, 14000); Talk(SAY_LK_ESCAPE_ICEWALL_SUMMONED_4); - break; + break; default: break; } } - + void EnterEvadeMode() override { if (_despawn) @@ -2021,12 +2021,12 @@ class at_hor_waves_restarter : public AreaTriggerScript { _instance->ProcessEvent(0, EVENT_SPAWN_WAVES); - if (Creature* falric = player->GetCreature(*player, _instance->GetData64(DATA_FALRIC))) + if (Creature* falric = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_FALRIC))) { falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true); falric->SetVisible(true); } - if (Creature* marwyn = player->GetCreature(*player, _instance->GetData64(DATA_MARWYN))) + if (Creature* marwyn = ObjectAccessor::GetCreature(*player, _instance->GetData64(DATA_MARWYN))) { marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); marwyn->SetVisible(true); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 9cbd296d69e..783f9e245c8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -113,7 +113,7 @@ class boss_garfrost : public CreatureScript Talk(SAY_DEATH); me->RemoveAllGameObjects(); - if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TYRANNUS))) tyrannus->AI()->Talk(SAY_TYRANNUS_DEATH); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 26ab1f61ae8..1c126bc54fd 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -362,7 +362,7 @@ class boss_krick : public CreatureScript { case EVENT_OUTRO_1: { - if (Creature* temp = me->GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1))) temp->DespawnOrUnsummon(); Creature* jainaOrSylvanas = NULL; @@ -410,7 +410,7 @@ class boss_krick : public CreatureScript _events.ScheduleEvent(EVENT_OUTRO_6, 1000); break; case EVENT_OUTRO_6: - if (Creature* tyrannus = me->GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT))) + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT))) { tyrannus->SetSpeed(MOVE_FLIGHT, 3.5f, true); tyrannus->GetMotionMaster()->MovePoint(1, outroPos[4]); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index a501bf4ea55..c4f46136bd9 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -25,12 +25,12 @@ enum Yells { - //Gorkun + // Gorkun SAY_GORKUN_INTRO_2 = 0, SAY_GORKUN_OUTRO_1 = 1, SAY_GORKUN_OUTRO_2 = 2, - //Tyrannus + // Tyrannus SAY_AMBUSH_1 = 3, SAY_AMBUSH_2 = 4, SAY_GAUNTLET_START = 5, @@ -44,12 +44,12 @@ enum Yells SAY_DARK_MIGHT_1 = 13, SAY_DARK_MIGHT_2 = 14, - //Jaina + // Jaina SAY_JAYNA_OUTRO_3 = 3, SAY_JAYNA_OUTRO_4 = 4, SAY_JAYNA_OUTRO_5 = 5, - //Sylvanas + // Sylvanas SAY_SYLVANAS_OUTRO_3 = 3, SAY_SYLVANAS_OUTRO_4 = 4 }; @@ -121,7 +121,7 @@ static const Position rimefangPos[10] = {1012.601f, 142.4965f, 665.0453f, 0.000000f}, }; -static const Position miscPos = {1018.376f, 167.2495f, 628.2811f, 0.000000f}; //tyrannus combat start position +static Position const miscPos = { 1018.376f, 167.2495f, 628.2811f, 0.000000f }; // tyrannus combat start position class boss_tyrannus : public CreatureScript { @@ -235,7 +235,7 @@ class boss_tyrannus : public CreatureScript me->GetMotionMaster()->MovePoint(0, miscPos); break; case EVENT_COMBAT_START: - if (Creature* rimefang = me->GetCreature(*me, instance->GetData64(DATA_RIMEFANG))) + if (Creature* rimefang = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_RIMEFANG))) rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight events.SetPhase(PHASE_COMBAT); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -357,7 +357,7 @@ class boss_rimefang : public CreatureScript _events.ScheduleEvent(EVENT_ICY_BLAST, 15000, 0, PHASE_COMBAT); break; case EVENT_HOARFROST: - if (Unit* target = me->GetUnit(*me, _hoarfrostTargetGUID)) + if (Unit* target = ObjectAccessor::GetUnit(*me, _hoarfrostTargetGUID)) { DoCast(target, SPELL_HOARFROST); _hoarfrostTargetGUID = 0; @@ -490,6 +490,43 @@ class spell_tyrannus_mark_of_rimefang : public SpellScriptLoader } }; +// 69232 - Icy Blast +class spell_tyrannus_rimefang_icy_blast : public SpellScriptLoader +{ + public: + spell_tyrannus_rimefang_icy_blast() : SpellScriptLoader("spell_tyrannus_rimefang_icy_blast") { } + + class spell_tyrannus_rimefang_icy_blast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_tyrannus_rimefang_icy_blast_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AURA)) + return false; + return true; + } + + void HandleTriggerMissile(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Position const* pos = GetHitDest()) + if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 60000)) + summon->CastSpell(summon, SPELL_ICY_BLAST_AURA, true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_tyrannus_rimefang_icy_blast_SpellScript::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_tyrannus_rimefang_icy_blast_SpellScript(); + } +}; + class at_tyrannus_event_starter : public AreaTriggerScript { public: @@ -518,5 +555,6 @@ void AddSC_boss_tyrannus() new boss_rimefang(); new spell_tyrannus_overlord_brand(); new spell_tyrannus_mark_of_rimefang(); + new spell_tyrannus_rimefang_icy_blast(); new at_tyrannus_event_starter(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index f0affa66d0f..b02a319abdc 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -278,7 +278,7 @@ class boss_drakkari_elemental : public CreatureScript if (killer == me) return; - if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) killer->Kill(colossus); } @@ -314,7 +314,7 @@ class boss_drakkari_elemental : public CreatureScript { case ACTION_RETURN_TO_COLOSSUS: DoCast(SPELL_SURGE_VISUAL); - if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) // what if the elemental is more than 80 yards from drakkari colossus ? DoCast(colossus, SPELL_MERGE, true); break; @@ -325,7 +325,7 @@ class boss_drakkari_elemental : public CreatureScript { if (HealthBelowPct(50) && instance) { - if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) { if (colossus->AI()->GetData(DATA_COLOSSUS_PHASE) == COLOSSUS_PHASE_FIRST_ELEMENTAL_SUMMON) { @@ -423,7 +423,7 @@ public: if (id == 1) { - if (Creature* colossus = Unit::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) + if (Creature* colossus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRAKKARI_COLOSSUS))) { colossus->AI()->DoAction(ACTION_UNFREEZE_COLOSSUS); if (!colossus->AI()->GetData(DATA_INTRO_DONE)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 9847d7191c6..4e45d72cadf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -345,7 +345,7 @@ class npc_stinky_icc : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* festergut = me->GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) + if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) if (festergut->IsAlive()) festergut->AI()->Talk(SAY_STINKY_DEAD); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index c408c486b30..3bf8fd8d305 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -372,7 +372,7 @@ class boss_professor_putricide : public CreatureScript instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); // needed here for delayed gate close me->SetSpeed(MOVE_RUN, _baseSpeed, true); DoAction(ACTION_FESTERGUT_GAS); - if (Creature* festergut = Unit::GetCreature(*me, instance->GetData64(DATA_FESTERGUT))) + if (Creature* festergut = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FESTERGUT))) festergut->CastSpell(festergut, SPELL_GASEOUS_BLIGHT_LARGE, false, NULL, NULL, festergut->GetGUID()); break; case POINT_ROTFACE: @@ -442,7 +442,7 @@ class boss_professor_putricide : public CreatureScript _oozeFloodStage = 0; DoZoneInCombat(me); // init random sequence of floods - if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) { std::list<Creature*> list; GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f); @@ -469,7 +469,7 @@ class boss_professor_putricide : public CreatureScript } case ACTION_ROTFACE_OOZE: Talk(SAY_ROTFACE_OOZE_FLOOD); - if (Creature* dummy = Unit::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage])) + if (Creature* dummy = ObjectAccessor::GetCreature(*me, _oozeFloodDummyGUIDs[_oozeFloodStage])) dummy->CastSpell(dummy, oozeFloodSpells[_oozeFloodStage], true, NULL, NULL, me->GetGUID()); // cast from self for LoS (with prof's GUID for logs) if (++_oozeFloodStage == 4) _oozeFloodStage = 0; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 8766781de7c..c1ee616218c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -126,7 +126,7 @@ class boss_rotface : public CreatureScript me->setActive(true); Talk(SAY_AGGRO); - if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_ROTFACE_COMBAT); DoZoneInCombat(); @@ -138,7 +138,7 @@ class boss_rotface : public CreatureScript instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); _JustDied(); Talk(SAY_DEATH); - if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_ROTFACE_DEATH); } @@ -158,7 +158,7 @@ class boss_rotface : public CreatureScript void EnterEvadeMode() override { ScriptedAI::EnterEvadeMode(); - if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->EnterEvadeMode(); } @@ -176,7 +176,7 @@ class boss_rotface : public CreatureScript void JustSummoned(Creature* summon) override { if (summon->GetEntry() == NPC_VILE_GAS_STALKER) - if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) professor->CastSpell(summon, SPELL_VILE_GAS_H, true); } @@ -308,13 +308,13 @@ class npc_big_ooze : public CreatureScript DoCast(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true); events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); // register in Rotface's summons - not summoned with Rotface as owner - if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) rotface->AI()->JustSummoned(me); } void JustDied(Unit* /*killer*/) override { - if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) rotface->AI()->SummonedCreatureDespawn(me); me->DespawnOrUnsummon(); } @@ -395,7 +395,7 @@ class npc_precious_icc : public CreatureScript void JustDied(Unit* /*killer*/) override { _summons.DespawnAll(); - if (Creature* rotface = Unit::GetCreature(*me, _instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE))) if (rotface->IsAlive()) rotface->AI()->Talk(SAY_PRECIOUS_DIES); } @@ -657,7 +657,7 @@ class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* rotface = Unit::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) + if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) if (rotface->IsAlive()) { rotface->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 0543b0274b5..77486c37498 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -138,10 +138,10 @@ public: bool DoEncounteraction(Unit* who, bool attack, bool reset, bool checkAllDead) { - Creature* Thane = Unit::GetCreature(*me, instance->GetData64(DATA_THANE)); - Creature* Lady = Unit::GetCreature(*me, instance->GetData64(DATA_LADY)); - Creature* Baron = Unit::GetCreature(*me, instance->GetData64(DATA_BARON)); - Creature* Sir = Unit::GetCreature(*me, instance->GetData64(DATA_SIR)); + Creature* Thane = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THANE)); + Creature* Lady = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_LADY)); + Creature* Baron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BARON)); + Creature* Sir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SIR)); if (Thane && Lady && Baron && Sir) { @@ -226,7 +226,7 @@ public: movementCompleted = true; me->SetReactState(REACT_AGGRESSIVE); - Unit* eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); + Unit* eventStarter = ObjectAccessor::GetUnit(*me, uiEventStarterGUID); if (eventStarter && me->IsValidAttackTarget(eventStarter)) AttackStart(eventStarter); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 29e435e2127..d973ce867f2 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -257,25 +257,25 @@ class boss_gothik : public CreatureScript { case NPC_LIVE_TRAINEE: { - if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[0])) + if (Creature* liveTrigger = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[0])) DoSummon(NPC_LIVE_TRAINEE, liveTrigger, 1); - if (Creature* liveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) + if (Creature* liveTrigger1 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[1])) DoSummon(NPC_LIVE_TRAINEE, liveTrigger1, 1); - if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) + if (Creature* liveTrigger2 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[2])) DoSummon(NPC_LIVE_TRAINEE, liveTrigger2, 1); break; } case NPC_LIVE_KNIGHT: { - if (Creature* liveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) + if (Creature* liveTrigger3 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[3])) DoSummon(NPC_LIVE_KNIGHT, liveTrigger3, 1); - if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) + if (Creature* liveTrigger5 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[5])) DoSummon(NPC_LIVE_KNIGHT, liveTrigger5, 1); break; } case NPC_LIVE_RIDER: { - if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + if (Creature* liveTrigger4 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(NPC_LIVE_RIDER, liveTrigger4, 1); break; } @@ -287,21 +287,21 @@ class boss_gothik : public CreatureScript { case NPC_LIVE_TRAINEE: { - if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[4])) + if (Creature* liveTrigger = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(NPC_LIVE_TRAINEE, liveTrigger, 1); - if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + if (Creature* liveTrigger2 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(NPC_LIVE_TRAINEE, liveTrigger2, 1); break; } case NPC_LIVE_KNIGHT: { - if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + if (Creature* liveTrigger5 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(NPC_LIVE_KNIGHT, liveTrigger5, 1); break; } case NPC_LIVE_RIDER: { - if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + if (Creature* liveTrigger4 = ObjectAccessor::GetCreature(*me, LiveTriggerGUID[4])) DoSummon(NPC_LIVE_RIDER, liveTrigger4, 1); break; } @@ -359,7 +359,7 @@ class boss_gothik : public CreatureScript if (spellId && me->IsInCombat()) { me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST); - if (Creature* pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) + if (Creature* pRandomDeadTrigger = ObjectAccessor::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) me->CastSpell(pRandomDeadTrigger, spellId, true); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 8b3ac64fb89..c5c70cf3957 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -368,38 +368,33 @@ public: if (Phase == 1) { - while (uint32 eventId = events.GetEvent()) + while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_WASTE: DoSummon(NPC_WASTE, Pos[RAND(0, 3, 6, 9)]); - events.RepeatEvent(urand(2000, 5000)); + events.Repeat(2000, 5000); break; case EVENT_ABOMIN: if (nAbomination < 8) { DoSummon(NPC_ABOMINATION, Pos[RAND(1, 4, 7, 10)]); nAbomination++; - events.RepeatEvent(20000); + events.Repeat(20000); } - else - events.PopEvent(); break; case EVENT_WEAVER: if (nWeaver < 8) { DoSummon(NPC_WEAVER, Pos[RAND(0, 3, 6, 9)]); nWeaver++; - events.RepeatEvent(25000); + events.Repeat(25000); } - else - events.PopEvent(); break; case EVENT_TRIGGER: if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) trigger->SetPhaseMask(2, true); - events.PopEvent(); break; case EVENT_PHASE: events.Reset(); @@ -419,7 +414,6 @@ public: Phase = 2; break; default: - events.PopEvent(); break; } } @@ -461,17 +455,17 @@ public: if (me->HasUnitState(UNIT_STATE_CASTING)) return; - if (uint32 eventId = events.GetEvent()) + if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BOLT: DoCastVictim(SPELL_FROST_BOLT); - events.RepeatEvent(urand(5000, 10000)); + events.Repeat(5000, 10000); break; case EVENT_NOVA: DoCastAOE(SPELL_FROST_BOLT_AOE); - events.RepeatEvent(urand(15000, 30000)); + events.Repeat(15000, 30000); break; case EVENT_CHAIN: { @@ -490,7 +484,7 @@ public: } if (!chained.empty()) Talk(SAY_CHAIN); - events.RepeatEvent(urand(100000, 180000)); + events.Repeat(100000, 180000); break; } case EVENT_CHAINED_SPELL: @@ -565,10 +559,8 @@ public: ++itr; } - if (chained.empty()) - events.PopEvent(); - else - events.RepeatEvent(5000); + if (!chained.empty()) + events.Repeat(5000); break; } @@ -596,23 +588,22 @@ public: Talk(SAY_SPECIAL); } - events.RepeatEvent(urand(20000, 50000)); + events.Repeat(20000, 50000); break; } case EVENT_FISSURE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_FISURE); - events.RepeatEvent(urand(10000, 45000)); + events.Repeat(10000, 45000); break; case EVENT_BLAST: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true)) DoCast(target, SPELL_FROST_BLAST); if (rand()%2) Talk(SAY_FROST_BLAST); - events.RepeatEvent(urand(30000, 90000)); + events.Repeat(30000, 90000); break; default: - events.PopEvent(); break; } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index ce605987890..52723b591a2 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -169,14 +169,14 @@ public: { victimGUID = guid; if (me->m_spells[0] && victimGUID) - if (Unit* victim = Unit::GetUnit(*me, victimGUID)) + if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID)) victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); } void JustDied(Unit* /*killer*/) override { if (me->m_spells[0] && victimGUID) - if (Unit* victim = Unit::GetUnit(*me, victimGUID)) + if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID)) victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); } }; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 528b2fec348..406ca3963a4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -123,11 +123,11 @@ public: // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn // and each mob will send its status at reset (meaning that it is alive) checkFeugenAlive = false; - if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) checkFeugenAlive = pFeugen->IsAlive(); checkStalaggAlive = false; - if (Creature* pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG))) checkStalaggAlive = pStalagg->IsAlive(); if (!checkFeugenAlive && !checkStalaggAlive) @@ -230,12 +230,12 @@ public: { if (!checkStalaggAlive) { - if (Creature* pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + if (Creature* pStalagg = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STALAGG))) pStalagg->Respawn(); } else { - if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) pFeugen->Respawn(); } } @@ -300,7 +300,7 @@ public: void Reset() override { - if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); powerSurgeTimer = urand(20000, 25000); @@ -322,7 +322,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_STAL_DEATH); - if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); } @@ -334,7 +334,7 @@ public: if (magneticPullTimer <= uiDiff) { - if (Creature* pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + if (Creature* pFeugen = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_FEUGEN))) { Unit* pStalaggVictim = me->GetVictim(); Unit* pFeugenVictim = pFeugen->GetVictim(); @@ -391,7 +391,7 @@ public: void Reset() override { - if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); staticFieldTimer = 5000; @@ -412,7 +412,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_FEUG_DEATH); - if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS))) + if (Creature* pThaddius = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THADDIUS))) if (pThaddius->AI()) pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 2570a44b0a0..5291e4baed3 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -664,7 +664,7 @@ public: Talk(SAY_BUFF_SPARK); } else if (spell->Id == SPELL_MALYGOS_BERSERK) - sCreatureTextMgr->SendChat(me, EMOTE_HIT_BERSERKER_TIMER, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + TalkToMap(EMOTE_HIT_BERSERKER_TIMER); } void MoveInLineOfSight(Unit* who) override @@ -1113,8 +1113,7 @@ public: npc_power_sparkAI(Creature* creature) : ScriptedAI(creature) { _instance = creature->GetInstanceScript(); - // Talk range was not enough for this encounter - sCreatureTextMgr->SendChat(me, EMOTE_POWER_SPARK_SUMMONED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + TalkToMap(EMOTE_POWER_SPARK_SUMMONED); MoveToMalygos(); } @@ -1810,7 +1809,7 @@ public: class spell_malygos_vortex_dummy_SpellScript : public SpellScript { - PrepareSpellScript(spell_malygos_vortex_dummy_SpellScript) + PrepareSpellScript(spell_malygos_vortex_dummy_SpellScript); bool Load() override { @@ -2282,7 +2281,7 @@ class spell_malygos_surge_of_power_warning_selector_25 : public SpellScriptLoade class spell_malygos_surge_of_power_warning_selector_25_SpellScript : public SpellScript { - PrepareSpellScript(spell_malygos_surge_of_power_warning_selector_25_SpellScript) + PrepareSpellScript(spell_malygos_surge_of_power_warning_selector_25_SpellScript); bool Load() override { @@ -2348,7 +2347,7 @@ class spell_malygos_surge_of_power_25 : public SpellScriptLoader class spell_malygos_surge_of_power_25_SpellScript : public SpellScript { - PrepareSpellScript(spell_malygos_surge_of_power_25_SpellScript) + PrepareSpellScript(spell_malygos_surge_of_power_25_SpellScript); bool Load() override { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 0870614ba78..585da8e28d3 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -299,7 +299,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader class spell_varos_energize_core_area_enemySpellScript : public SpellScript { - PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript) + PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript); void FilterTargets(std::list<WorldObject*>& targets) { @@ -343,7 +343,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader class spell_varos_energize_core_area_entrySpellScript : public SpellScript { - PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript) + PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript); void FilterTargets(std::list<WorldObject*>& targets) { diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index 727060578c8..24d145f097f 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -164,7 +164,7 @@ public: for (uint8 i = 0; i < 2; ++i) { - if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) + if (Creature* pStormforgedLieutenant = (ObjectAccessor::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) { if (!pStormforgedLieutenant->IsAlive()) pStormforgedLieutenant->Respawn(); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 880045b96ef..d0b8f75e711 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -164,7 +164,7 @@ public: for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { - if (Creature* temp = Unit::GetCreature(*me, *itr)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) { if (temp->IsAlive()) temp->DespawnOrUnsummon(); @@ -181,7 +181,7 @@ public: for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { - if (Creature* temp = Unit::GetCreature(*me, *itr)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) { // Only shatter brittle golems if (temp->IsAlive() && temp->GetEntry() == NPC_BRITTLE_GOLEM) diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index c81cd0b0b80..07cdfa3353c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -15,14 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Script Data Start -SDName: Boss krystallus -SDAuthor: LordVanMartin -SD%Complete: -SDComment: -SDCategory: -Script Data End */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellScript.h" @@ -30,17 +22,13 @@ Script Data End */ enum Spells { - SPELL_BOULDER_TOSS = 50843, - H_SPELL_BOULDER_TOSS = 59742, - SPELL_GROUND_SPIKE = 59750, - SPELL_GROUND_SLAM = 50827, - SPELL_SHATTER = 50810, - H_SPELL_SHATTER = 61546, - SPELL_SHATTER_EFFECT = 50811, - H_SPELL_SHATTER_EFFECT = 61547, - SPELL_STONED = 50812, - SPELL_STOMP = 48131, - H_SPELL_STOMP = 59744 + SPELL_BOULDER_TOSS = 50843, + SPELL_GROUND_SPIKE = 59750, + SPELL_GROUND_SLAM = 50827, + SPELL_SHATTER = 50810, + SPELL_SHATTER_EFFECT = 50811, + SPELL_STONED = 50812, + SPELL_STOMP = 48131 }; enum Yells @@ -51,133 +39,103 @@ enum Yells SAY_SHATTER = 3 }; -class boss_krystallus : public CreatureScript +enum Events { -public: - boss_krystallus() : CreatureScript("boss_krystallus") { } - - struct boss_krystallusAI : public ScriptedAI - { - boss_krystallusAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - uint32 uiBoulderTossTimer; - uint32 uiGroundSpikeTimer; - uint32 uiGroundSlamTimer; - uint32 uiShatterTimer; - uint32 uiStompTimer; - - bool bIsSlam; - - InstanceScript* instance; - - void Reset() override - { - bIsSlam = false; - - uiBoulderTossTimer = urand(3000, 9000); - uiGroundSpikeTimer = urand(9000, 14000); - uiGroundSlamTimer = urand(15000, 18000); - uiStompTimer = urand(20000, 29000); - uiShatterTimer = 0; - - instance->SetBossState(DATA_KRYSTALLUS, NOT_STARTED); - } - void EnterCombat(Unit* /*who*/) override - { - Talk(SAY_AGGRO); + EVENT_BOULDER_TOSS = 1, + EVENT_GROUND_SPIKE, + EVENT_GROUND_SLAM, + EVENT_STOMP, + EVENT_SHATTER +}; - instance->SetBossState(DATA_KRYSTALLUS, IN_PROGRESS); - } +class boss_krystallus : public CreatureScript +{ + public: + boss_krystallus() : CreatureScript("boss_krystallus") { } - void UpdateAI(uint32 diff) override + struct boss_krystallusAI : public BossAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_krystallusAI(Creature* creature) : BossAI(creature, DATA_KRYSTALLUS) { } - if (uiBoulderTossTimer <= diff) + void Reset() override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_BOULDER_TOSS); - uiBoulderTossTimer = urand(9000, 15000); - } else uiBoulderTossTimer -= diff; - - if (uiGroundSpikeTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_GROUND_SPIKE); - uiGroundSpikeTimer = urand(12000, 17000); - } else uiGroundSpikeTimer -= diff; - - if (uiStompTimer <= diff) - { - DoCast(me, SPELL_STOMP); - uiStompTimer = urand(20000, 29000); - } else uiStompTimer -= diff; - - if (uiGroundSlamTimer <= diff) - { - DoCast(me, SPELL_GROUND_SLAM); - bIsSlam = true; - uiShatterTimer = 10000; - uiGroundSlamTimer = urand(15000, 18000); - } else uiGroundSlamTimer -= diff; + _Reset(); + } - if (bIsSlam) + void EnterCombat(Unit* /*who*/) override { - if (uiShatterTimer <= diff) - { - DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER)); - } else uiShatterTimer -= diff; + Talk(SAY_AGGRO); + _EnterCombat(); + + events.ScheduleEvent(EVENT_BOULDER_TOSS, urand(3000, 9000)); + events.ScheduleEvent(EVENT_GROUND_SLAM, urand(15000, 18000)); + events.ScheduleEvent(EVENT_STOMP, urand(20000, 29000)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_GROUND_SPIKE, urand(9000, 14000)); } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) override - { - Talk(SAY_DEATH); - - instance->SetBossState(DATA_KRYSTALLUS, DONE); - } + void UpdateAI(uint32 diff) override + { + // Return since we have no target + if (!UpdateVictim()) + return; - void KilledUnit(Unit* victim) override - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + events.Update(diff); - Talk(SAY_KILL); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell) override - { - //this part should be in the core - if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) - { - /// @todo we need eventmap to kill this stuff - //clear this, if we are still performing - if (bIsSlam) + while (uint32 eventId = events.ExecuteEvent()) { - bIsSlam = false; - - //and correct movement, if not already - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) + switch (eventId) { - if (me->GetVictim()) - me->GetMotionMaster()->MoveChase(me->GetVictim()); + case EVENT_BOULDER_TOSS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + DoCast(target, SPELL_BOULDER_TOSS); + events.ScheduleEvent(EVENT_BOULDER_TOSS, urand(9000, 15000)); + break; + case EVENT_GROUND_SPIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_GROUND_SPIKE); + events.ScheduleEvent(EVENT_GROUND_SPIKE, urand(12000, 17000)); + break; + case EVENT_GROUND_SLAM: + DoCast(me, SPELL_GROUND_SLAM); + events.ScheduleEvent(EVENT_SHATTER, 10000); + events.ScheduleEvent(EVENT_GROUND_SLAM, urand(15000, 18000)); + break; + case EVENT_STOMP: + DoCast(me, SPELL_STOMP); + events.ScheduleEvent(EVENT_STOMP, urand(20000, 29000)); + break; + case EVENT_SHATTER: + DoCast(me, SPELL_SHATTER); + break; + default: + break; } } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DEATH); + _JustDied(); } - } - }; - CreatureAI* GetAI(Creature* creature) const override - { - return GetHallsOfStoneAI<boss_krystallusAI>(creature); - } + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetHallsOfStoneAI<boss_krystallusAI>(creature); + } }; class spell_krystallus_shatter : public SpellScriptLoader diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index f666f5d5874..cedf06a3154 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -211,7 +211,7 @@ public: if (!KaddrakGUIDList.empty()) for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) { - if (Creature* pKaddrak = Unit::GetCreature(*me, *itr)) + if (Creature* pKaddrak = ObjectAccessor::GetCreature(*me, *itr)) { if (pKaddrak->IsAlive()) pKaddrak->CastSpell(target, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true); @@ -331,7 +331,7 @@ public: return; for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) { - Creature* temp = Unit::GetCreature(*me, instance ? (*itr) : 0); + Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : 0); if (temp && temp->IsAlive()) temp->DespawnOrUnsummon(); } @@ -446,7 +446,7 @@ public: JumpToNextStep(0); break; case 5: - if (Creature* temp = (Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))) + if (Creature* temp = (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))) temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED); JumpToNextStep(8500); break; @@ -455,14 +455,14 @@ public: JumpToNextStep(6500); break; case 7: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_A_2_KADD); JumpToNextStep(12500); break; case 8: Talk(SAY_EVENT_A_3); instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true); - if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true; JumpToNextStep(5000); break; @@ -476,7 +476,7 @@ public: JumpToNextStep(6000); break; case 11: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_B_2_MARN); SpawnDwarf(1); JumpToNextStep(20000); @@ -484,7 +484,7 @@ public: case 12: Talk(SAY_EVENT_B_3); instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true); - if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bMarnakActivated = true; JumpToNextStep(10000); break; @@ -506,7 +506,7 @@ public: JumpToNextStep(20000); break; case 17: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_C_2_ABED); SpawnDwarf(1); JumpToNextStep(20000); @@ -514,7 +514,7 @@ public: case 18: Talk(SAY_EVENT_C_3); instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true); - if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) CAST_AI(npc_tribuna_controller::npc_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true; JumpToNextStep(5000); break; @@ -532,7 +532,7 @@ public: JumpToNextStep(20000); break; case 22: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_D_2_ABED); SpawnDwarf(1); JumpToNextStep(5000); @@ -555,7 +555,7 @@ public: JumpToNextStep(10000); break; case 27: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_D_4_ABED); SpawnDwarf(1); JumpToNextStep(10000); @@ -565,7 +565,7 @@ public: Talk(SAY_EVENT_END_01); me->SetStandState(UNIT_STAND_STATE_STAND); instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true); - if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, uiControllerGUID)) temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); bIsBattle = true; SetEscortPaused(false); @@ -578,7 +578,7 @@ public: JumpToNextStep(5500); break; case 30: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_03_ABED); JumpToNextStep(8500); break; @@ -587,7 +587,7 @@ public: JumpToNextStep(11500); break; case 32: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_05_ABED); JumpToNextStep(11500); break; @@ -596,7 +596,7 @@ public: JumpToNextStep(4500); break; case 34: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_07_ABED); JumpToNextStep(22500); break; @@ -605,7 +605,7 @@ public: JumpToNextStep(7500); break; case 36: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_09_KADD); JumpToNextStep(18500); break; @@ -614,7 +614,7 @@ public: JumpToNextStep(5500); break; case 38: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_11_KADD); JumpToNextStep(20500); break; @@ -623,7 +623,7 @@ public: JumpToNextStep(2500); break; case 40: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KADDRAK))) temp->AI()->Talk(SAY_EVENT_END_13_KADD); JumpToNextStep(19500); break; @@ -632,7 +632,7 @@ public: JumpToNextStep(10500); break; case 42: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_15_MARN); JumpToNextStep(6500); break; @@ -641,7 +641,7 @@ public: JumpToNextStep(6500); break; case 44: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_17_MARN); JumpToNextStep(25500); break; @@ -650,7 +650,7 @@ public: JumpToNextStep(23500); break; case 46: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MARNAK))) temp->AI()->Talk(SAY_EVENT_END_19_MARN); JumpToNextStep(3500); break; @@ -659,7 +659,7 @@ public: JumpToNextStep(8500); break; case 48: - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))) temp->AI()->Talk(SAY_EVENT_END_21_ABED); JumpToNextStep(5500); break; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 58df31a4471..011d1844adf 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -332,7 +332,7 @@ class boss_saronite_animus : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (Creature* Vezax = me->GetCreature(*me, instance->GetData64(BOSS_VEZAX))) + if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX))) Vezax->AI()->DoAction(ACTION_ANIMUS_DIE); } @@ -427,7 +427,7 @@ class npc_saronite_vapors : public CreatureScript DoCast(me, SPELL_SARONITE_VAPORS); me->DespawnOrUnsummon(30000); - if (Creature* Vezax = me->GetCreature(*me, instance->GetData64(BOSS_VEZAX))) + if (Creature* Vezax = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_VEZAX))) Vezax->AI()->DoAction(ACTION_VAPORS_DIE); } } @@ -494,13 +494,13 @@ class spell_general_vezax_mark_of_the_faceless_leech : public SpellScriptLoader FinishCast(SPELL_FAILED_NO_VALID_TARGETS); } - void Register() + void Register() override { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_general_vezax_mark_of_the_faceless_leech_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const override { return new spell_general_vezax_mark_of_the_faceless_leech_SpellScript(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index ef9bd9a8b12..6be3586de28 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -399,7 +399,7 @@ class npc_scorch_ground : public CreatureScript { if (_heatTimer <= uiDiff) { - Creature* construct = me->GetCreature(*me, _constructGUID); + Creature* construct = ObjectAccessor::GetCreature(*me, _constructGUID); if (construct && !construct->HasAura(SPELL_MOLTEN)) { me->AddAura(SPELL_HEAT, construct); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index e77350e2710..58969fd63c8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -234,7 +234,7 @@ class boss_kologarn : public CreatureScript // Victim gets 67351 if (eyebeamTarget) { - if (Unit* target = Unit::GetUnit(*summon, eyebeamTarget)) + if (Unit* target = ObjectAccessor::GetUnit(*summon, eyebeamTarget)) { summon->Attack(target, false); summon->GetMotionMaster()->MoveChase(target); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index cfa5429ea79..f284aacf996 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -89,7 +89,7 @@ class spell_ulduar_proximity_mines : public SpellScriptLoader class spell_ulduar_proximity_minesSpellScript : public SpellScript { - PrepareSpellScript(spell_ulduar_proximity_minesSpellScript) + PrepareSpellScript(spell_ulduar_proximity_minesSpellScript); void HandleScript(SpellEffIndex effIndex) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index c57c3b33d01..87192f39a5c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -457,7 +457,7 @@ class npc_xt002_heart : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* xt002 = _instance ? me->GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL; + Creature* xt002 = _instance ? ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002)) : NULL; if (!xt002 || !xt002->AI()) return; @@ -503,7 +503,7 @@ class npc_scrapbot : public CreatureScript _rangeCheckTimer = 500; - if (Creature* pXT002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); } @@ -511,7 +511,7 @@ class npc_scrapbot : public CreatureScript { if (_rangeCheckTimer <= diff) { - if (Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) { if (me->IsWithinMeleeRange(xt002)) { @@ -560,7 +560,7 @@ class npc_pummeller : public CreatureScript _trampleTimer = TIMER_TRAMPLE; _uppercutTimer = TIMER_UPPERCUT; - if (Creature* xt002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* xt002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) { Position pos = xt002->GetPosition(); me->GetMotionMaster()->MovePoint(0, pos); @@ -668,7 +668,7 @@ class npc_boombot : public CreatureScript me->SetFloatValue(UNIT_FIELD_MAXDAMAGE, 18000.0f); /// @todo proper waypoints? - if (Creature* pXT002 = me->GetCreature(*me, _instance->GetData64(BOSS_XT002))) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, _instance->GetData64(BOSS_XT002))) me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 4a5c0291ce0..41dd1a165f2 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -206,7 +206,7 @@ public: Summons.DespawnAll(); me->SetSpeed(MOVE_FLIGHT, 3.0f); - if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted()) + if ((ObjectAccessor::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted()) me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); instance->SetBossState(DATA_SKADI_THE_RUTHLESS, NOT_STARTED); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); @@ -217,7 +217,7 @@ public: me->SetCanFly(false); me->Dismount(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (!Unit::GetCreature(*me, m_uiGraufGUID)) + if (!ObjectAccessor::GetCreature(*me, m_uiGraufGUID)) me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); } @@ -469,7 +469,7 @@ public: if (!instance) return false; - if (Creature* pSkadi = Unit::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS))) + if (Creature* pSkadi = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_SKADI_THE_RUTHLESS))) player->CastSpell(pSkadi, SPELL_RAPID_FIRE, true); return false; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index a33d02fb083..de4d6c32c97 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -369,7 +369,7 @@ public: void DespawnBoatGhosts(uint64& m_uiCreatureGUID) { if (m_uiCreatureGUID) - if (Creature* temp = Unit::GetCreature(*me, m_uiCreatureGUID)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, m_uiCreatureGUID)) temp->DisappearAndDie(); m_uiCreatureGUID = 0; diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 205030947d1..ea5c5b9ee48 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -103,7 +103,7 @@ class boss_emalon : public CreatureScript { for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { - Creature* minion = Unit::GetCreature(*me, *itr); + Creature* minion = ObjectAccessor::GetCreature(*me, *itr); if (minion && minion->IsAlive() && !minion->GetVictim() && minion->AI()) minion->AI()->AttackStart(who); } @@ -143,7 +143,7 @@ class boss_emalon : public CreatureScript case EVENT_OVERCHARGE: if (!summons.empty()) { - Creature* minion = Unit::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons)); + Creature* minion = ObjectAccessor::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons)); if (minion && minion->IsAlive()) { minion->CastSpell(me, SPELL_OVERCHARGED, true); diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index 5cbd4cafffb..4aede5e5f46 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -242,7 +242,7 @@ public: if (!m_waterElements.empty()) { for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) - if (Creature* temp = Unit::GetCreature(*me, *itr)) + if (Creature* temp = ObjectAccessor::GetCreature(*me, *itr)) if (temp->IsAlive()) { bIsWaterElementsAlive = true; @@ -362,7 +362,7 @@ public: { if (uiRangeCheck_Timer < uiDiff) { - if (Creature* pIchoron = Unit::GetCreature(*me, instance->GetData64(DATA_ICHORON))) + if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON))) { if (me->IsWithinDist(pIchoron, 2.0f, false)) { @@ -379,7 +379,7 @@ public: void JustDied(Unit* /*killer*/) override { DoCast(me, SPELL_SPLASH); - if (Creature* pIchoron = Unit::GetCreature(*me, instance->GetData64(DATA_ICHORON))) + if (Creature* pIchoron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ICHORON))) if (pIchoron->AI()) pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index de08022b5ed..2bac444a558 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -254,7 +254,7 @@ public: if (uiRangeCheck_Timer < uiDiff) { - if (Creature* pXevozz = Unit::GetCreature(*me, instance->GetData64(DATA_XEVOZZ))) + if (Creature* pXevozz = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XEVOZZ))) { float fDistance = me->GetDistance2d(pXevozz); if (fDistance <= 3) diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index a4f142e1c89..b623d5e6ddc 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -535,7 +535,7 @@ public: { me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); me->DisappearAndDie(); - Creature* pSaboPort = Unit::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL)); + Creature* pSaboPort = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SABOTEUR_PORTAL)); if (pSaboPort) pSaboPort->DisappearAndDie(); instance->SetData(DATA_START_BOSS_ENCOUNTER, 1); diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index c226edf28b8..38d73e0673d 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1071,8 +1071,8 @@ public: if (phaseTimer <= diff) { - Creature* talbot = me->GetCreature(*me, talbotGUID); - Creature* arthas = me->GetCreature(*me, arthasGUID); + Creature* talbot = ObjectAccessor::GetCreature(*me, talbotGUID); + Creature* arthas = ObjectAccessor::GetCreature(*me, arthasGUID); switch (phase) { case 1: @@ -1209,9 +1209,9 @@ public: break; case 17: - if (Creature* leryssa = me->GetCreature(*me, leryssaGUID)) + if (Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID)) leryssa->RemoveFromWorld(); - if (Creature* arlos= me->GetCreature(*me, arlosGUID)) + if (Creature* arlos= ObjectAccessor::GetCreature(*me, arlosGUID)) arlos->RemoveFromWorld(); if (talbot) talbot->RemoveFromWorld(); @@ -1230,16 +1230,16 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* talbot = me->GetCreature(*me, talbotGUID)) + if (Creature* talbot = ObjectAccessor::GetCreature(*me, talbotGUID)) talbot->RemoveFromWorld(); - if (Creature* leryssa = me->GetCreature(*me, leryssaGUID)) + if (Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID)) leryssa->RemoveFromWorld(); - if (Creature* arlos = me->GetCreature(*me, arlosGUID)) + if (Creature* arlos = ObjectAccessor::GetCreature(*me, arlosGUID)) arlos->RemoveFromWorld(); - if (Creature* arthas = me->GetCreature(*me, arthasGUID)) + if (Creature* arthas = ObjectAccessor::GetCreature(*me, arthasGUID)) arthas->RemoveFromWorld(); } }; @@ -1433,8 +1433,8 @@ public: if (!leryssaGUID || !arlosGUID) return; - Creature* leryssa = Unit::GetCreature(*me, leryssaGUID); - Creature* arlos = Unit::GetCreature(*me, arlosGUID); + Creature* leryssa = ObjectAccessor::GetCreature(*me, leryssaGUID); + Creature* arlos = ObjectAccessor::GetCreature(*me, arlosGUID); if (!leryssa || !arlos) return; diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp index a5ff2271316..e4bd9c469fb 100644 --- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp @@ -97,7 +97,7 @@ public: } - if (Creature* pOrb = me->GetCreature(*me, targetGUID)) + if (Creature* pOrb = ObjectAccessor::GetCreature(*me, targetGUID)) DoCast(pOrb, SPELL_TRANSITUS_SHIELD_BEAM); } diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index e98d424abd5..d0fd948ce6a 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -85,18 +85,18 @@ public: _mrfloppyGUID = Mrfloppy->GetGUID(); break; case 10: - if (Unit::GetCreature(*me, _mrfloppyGUID)) + if (ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { Talk(SAY_WORGHAGGRO1); me->SummonCreature(NPC_HUNGRY_WORG, me->GetPositionX()+5, me->GetPositionY()+2, me->GetPositionZ()+1, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); } break; case 11: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); break; case 17: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); Talk(SAY_WORGRAGGRO3); if (Creature* RWORG = me->SummonCreature(NPC_RAVENOUS_WORG, me->GetPositionX()+10, me->GetPositionY()+8, me->GetPositionZ()+2, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000)) @@ -106,31 +106,31 @@ public: } break; case 18: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { - if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID)) + if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); DoCast(Mrfloppy, SPELL_MRFLOPPY); } break; case 19: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) { - if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID)) + if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) Mrfloppy->EnterVehicle(RWORG); } } break; case 20: - if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID)) + if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) RWORG->HandleEmoteCommand(34); break; case 21: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { - if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID)) + if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) { RWORG->Kill(Mrfloppy); Mrfloppy->ExitVehicle(); @@ -141,11 +141,11 @@ public: } break; case 22: - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) { if (Mrfloppy->isDead()) { - if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID)) + if (Creature* RWORG = ObjectAccessor::GetCreature(*me, _RavenousworgGUID)) RWORG->DisappearAndDie(); me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); Mrfloppy->setDeathState(ALIVE); @@ -167,7 +167,7 @@ public: break; case 27: me->DisappearAndDie(); - if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID)) + if (Creature* Mrfloppy = ObjectAccessor::GetCreature(*me, _mrfloppyGUID)) Mrfloppy->DisappearAndDie(); break; } diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 93e1f19b195..32b9805470e 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -595,14 +595,14 @@ public: break; case EVENT_INTRO_1: { - if (Creature* Dalfors = me->GetCreature(*me, guidDalfors)) + if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors)) Dalfors->AI()->Talk(DALFORS_SAY_PRE_1); events.ScheduleEvent(EVENT_INTRO_2, 5000); } break; case EVENT_INTRO_2: { - if (Creature* Dalfors = me->GetCreature(*me, guidDalfors)) + if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors)) { Dalfors->SetFacingTo(6.215f); Dalfors->AI()->Talk(DALFORS_SAY_PRE_2); @@ -612,37 +612,37 @@ public: break; case EVENT_INTRO_3: { - if (Creature* Dalfors = me->GetCreature(*me, guidDalfors)) + if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors)) { Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[2]); Dalfors->SetHomePosition(DalforsPos[2]); } - if (Creature* Priest1 = me->GetCreature(*me, guidPriest[0])) + if (Creature* Priest1 = ObjectAccessor::GetCreature(*me, guidPriest[0])) { Priest1->SetFacingTo(5.7421f); Priest1->SetHomePosition(Priest1Pos[1]); } - if (Creature* Priest2 = me->GetCreature(*me, guidPriest[1])) + if (Creature* Priest2 = ObjectAccessor::GetCreature(*me, guidPriest[1])) { Priest2->SetFacingTo(5.7421f); Priest2->SetHomePosition(Priest2Pos[1]); } - if (Creature* Priest3 = me->GetCreature(*me, guidPriest[2])) + if (Creature* Priest3 = ObjectAccessor::GetCreature(*me, guidPriest[2])) { Priest3->SetFacingTo(5.7421f); Priest3->SetHomePosition(Priest3Pos[1]); } - if (Creature* Mason1 = me->GetCreature(*me, guidMason[0])) + if (Creature* Mason1 = ObjectAccessor::GetCreature(*me, guidMason[0])) { Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[2]); Mason1->SetHomePosition(Mason1Pos[2]); } - if (Creature* Mason2 = me->GetCreature(*me, guidMason[1])) + if (Creature* Mason2 = ObjectAccessor::GetCreature(*me, guidMason[1])) { Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[2]); Mason2->SetHomePosition(Mason2Pos[2]); } - if (Creature* Mason3 = me->GetCreature(*me, guidMason[2])) + if (Creature* Mason3 = ObjectAccessor::GetCreature(*me, guidMason[2])) { Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[2]); Mason3->SetHomePosition(Mason3Pos[2]); @@ -653,17 +653,17 @@ public: break; case EVENT_MASON_ACTION: { - if (Creature* Mason1 = me->GetCreature(*me, guidMason[0])) + if (Creature* Mason1 = ObjectAccessor::GetCreature(*me, guidMason[0])) { Mason1->SetFacingTo(2.8972f); Mason1->AI()->SetData(1, 1); // triggers SAI actions on npc } - if (Creature* Mason2 = me->GetCreature(*me, guidMason[1])) + if (Creature* Mason2 = ObjectAccessor::GetCreature(*me, guidMason[1])) { Mason2->SetFacingTo(3.1241f); Mason2->AI()->SetData(1, 1); // triggers SAI actions on npc } - if (Creature* Mason3 = me->GetCreature(*me, guidMason[2])) + if (Creature* Mason3 = ObjectAccessor::GetCreature(*me, guidMason[2])) { Mason3->SetFacingTo(3.6651f); Mason3->AI()->SetData(1, 1); // triggers SAI actions on npc @@ -674,7 +674,7 @@ public: { if (Creature* LK = GetClosestCreatureWithEntry(me, NPC_LK, 100)) LK->AI()->Talk(LK_TALK_1); - if (Creature* Dalfors = me->GetCreature(*me, guidDalfors)) + if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors)) Dalfors->AI()->Talk(DALFORS_SAY_START); events.ScheduleEvent(EVENT_WAVE_SPAWN, 1000); } @@ -763,7 +763,7 @@ public: } if (PhaseCount == 8) - if (Creature* Halof = me->GetCreature(*me, guidHalof)) + if (Creature* Halof = ObjectAccessor::GetCreature(*me, guidHalof)) if (Halof->isDead()) { DoCast(me, SPELL_CRUSADERS_SPIRE_VICTORY, true); @@ -771,7 +771,7 @@ public: Summons.DespawnEntry(NPC_REANIMATED_CAPTAIN); Summons.DespawnEntry(NPC_SCOURGE_DRUDGE); Summons.DespawnEntry(NPC_HALOF_THE_DEATHBRINGER); - if (Creature* Dalfors = me->GetCreature(*me, guidDalfors)) + if (Creature* Dalfors = ObjectAccessor::GetCreature(*me, guidDalfors)) Dalfors->AI()->Talk(DALFORS_YELL_FINISHED); events.ScheduleEvent(EVENT_ENDED, 10000); } @@ -963,35 +963,35 @@ class npc_margrave_dhakar : public CreatureScript } case EVENT_LK_SAY_1: { - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->AI()->Talk(SAY_LK_1); _events.ScheduleEvent(EVENT_LK_SAY_2, 5000); break; } case EVENT_LK_SAY_2: { - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->AI()->Talk(SAY_LK_2); _events.ScheduleEvent(EVENT_LK_SAY_3, 5000); break; } case EVENT_LK_SAY_3: { - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->AI()->Talk(SAY_LK_3); _events.ScheduleEvent(EVENT_LK_SAY_4, 5000); break; } case EVENT_LK_SAY_4: { - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->AI()->Talk(SAY_LK_4); _events.ScheduleEvent(EVENT_OUTRO, 12000); break; } case EVENT_LK_SAY_5: { - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->AI()->Talk(SAY_LK_5); _events.ScheduleEvent(EVENT_OUTRO, 8000); break; @@ -1001,7 +1001,7 @@ class npc_margrave_dhakar : public CreatureScript if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true)) olakin->AI()->Talk(SAY_OLAKIN_PAY); - if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _lichKingGuid)) lichKing->DespawnOrUnsummon(0); _events.ScheduleEvent(EVENT_START, 5000); diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 78b9a99b2e4..cf8c4cd9b36 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -91,7 +91,7 @@ public: { if (caster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE) { - if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID)) + if (Creature* rageclaw = ObjectAccessor::GetCreature(*me, _rageclawGUID)) { UnlockRageclaw(caster, rageclaw); caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID); diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 9ab35aa188b..ea877435acf 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -223,7 +223,7 @@ public: summoned->SetDisplayId(soulmodel); summoned->setFaction(me->getFaction()); - if (Unit* target = Unit::GetUnit(*me, soulholder)) + if (Unit* target = ObjectAccessor::GetUnit(*me, soulholder)) { CAST_AI(npc_stolen_soul::npc_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index bd65cd9fc89..26e9df6620c 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -92,7 +92,7 @@ public: summoned->SetLevel(me->getLevel()); summoned->AddUnitState(UNIT_STATE_ROOT); - if (Unit* pFocusedTarget = Unit::GetUnit(*me, FocusedTargetGUID)) + if (Unit* pFocusedTarget = ObjectAccessor::GetUnit(*me, FocusedTargetGUID)) summoned->AI()->AttackStart(pFocusedTarget); } } diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 427265e2562..5edae14d47a 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -155,11 +155,11 @@ public: case EVENT_SET_CHANNELERS: { for (std::list<uint64>::const_iterator itr = bloodmage.begin(); itr != bloodmage.end(); ++itr) - if (Creature* bloodmage = (Unit::GetCreature(*me, *itr))) + if (Creature* bloodmage = (ObjectAccessor::GetCreature(*me, *itr))) bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); for (std::list<uint64>::const_iterator itr = deathshaper.begin(); itr != deathshaper.end(); ++itr) - if (Creature* deathshaper = (Unit::GetCreature(*me, *itr))) + if (Creature* deathshaper = (ObjectAccessor::GetCreature(*me, *itr))) deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000); diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index 1f8c090230b..0004df68016 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -150,7 +150,7 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { - Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); //only on alive players if (target && target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER) targets.push_back(target); @@ -184,7 +184,7 @@ public: void RevertThreatOnTarget(uint64 guid) { - if (Unit* unit = Unit::GetUnit(*me, guid)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, guid)) { if (DoGetThreat(unit)) DoModifyThreatPercent(unit, -100); diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index f0498d8a5c2..b1c3d607396 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -596,9 +596,9 @@ public: if (Conversation[count].creature == ILLIDAN_STORMRAGE) creature = me; else if (Conversation[count].creature == AKAMA) - creature = (Unit::GetCreature((*me), AkamaGUID)); + creature = (ObjectAccessor::GetCreature((*me), AkamaGUID)); else if (Conversation[count].creature == MAIEV_SHADOWSONG) - creature = (Unit::GetCreature((*me), MaievGUID)); + creature = (ObjectAccessor::GetCreature((*me), MaievGUID)); if (creature) { @@ -831,7 +831,7 @@ public: { if (GlaiveGUID[i]) { - Unit* Glaive = Unit::GetUnit(*me, GlaiveGUID[i]); + Unit* Glaive = ObjectAccessor::GetUnit(*me, GlaiveGUID[i]); if (Glaive) { Glaive->CastSpell(me, SPELL_GLAIVE_RETURNS, false); // Make it look like the Glaive flies back up to us @@ -1437,7 +1437,7 @@ public: std::vector<Unit*> eliteList; for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->GetEntry() == ILLIDARI_ELITE) eliteList.push_back(unit); } @@ -1588,9 +1588,9 @@ public: Unit* Spirit[2] = { NULL, NULL }; if (ChannelCount <= 5) { - Channel = Unit::GetUnit(*me, ChannelGUID); - Spirit[0] = Unit::GetUnit(*me, SpiritGUID[0]); - Spirit[1] = Unit::GetUnit(*me, SpiritGUID[1]); + Channel = ObjectAccessor::GetUnit(*me, ChannelGUID); + Spirit[0] = ObjectAccessor::GetUnit(*me, SpiritGUID[0]); + Spirit[1] = ObjectAccessor::GetUnit(*me, SpiritGUID[1]); if (!Channel || !Spirit[0] || !Spirit[1]) return; } @@ -2007,7 +2007,7 @@ public: // if (IllidanGUID && !SummonedBeams) // { - // if (Unit* Illidan = Unit::GetUnit(*me, IllidanGUID) + // if (Unit* Illidan = ObjectAccessor::GetUnit(*me, IllidanGUID) // { // /// @todo Find proper spells and properly apply 'caged' Illidan effect // } @@ -2068,7 +2068,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Unit* target = Unit::GetUnit(*me, TargetGUID)) + if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID)) target->RemoveAurasDueToSpell(SPELL_PARALYZE); } @@ -2157,7 +2157,7 @@ public: if (!me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !me->EnsureVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2)) { - if (Creature* illidan = Unit::GetCreature((*me), IllidanGUID))// summon only in 1. phase + if (Creature* illidan = ObjectAccessor::GetCreature((*me), IllidanGUID))// summon only in 1. phase if (CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) me->CastSpell(me->GetVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); // do not stack } diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index ac91c2ac034..db3fcea35db 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -245,7 +245,7 @@ public: { if (TargetGUID[i]) { - if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i])) + if (Unit* unit = ObjectAccessor::GetUnit(*me, TargetGUID[i])) unit->CastSpell(unit, SPELL_ATTRACTION, true); TargetGUID[i] = 0; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 39edb6b04aa..9b304c3cd7b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -229,7 +229,7 @@ public: ThreatContainer::StorageType threatlist = target->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit) { DoModifyThreatPercent(unit, -100); @@ -258,7 +258,7 @@ public: Creature* Essence = NULL; if (EssenceGUID) { - Essence = Unit::GetCreature(*me, EssenceGUID); + Essence = ObjectAccessor::GetCreature(*me, EssenceGUID); if (!Essence) { EnterEvadeMode(); @@ -378,7 +378,7 @@ public: void npc_enslaved_soul::npc_enslaved_soulAI::JustDied(Unit* /*killer*/) { if (ReliquaryGUID) - if (Creature* Reliquary = (Unit::GetCreature((*me), ReliquaryGUID))) + if (Creature* Reliquary = (ObjectAccessor::GetCreature((*me), ReliquaryGUID))) ++(CAST_AI(boss_reliquary_of_souls::boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount); DoCast(me, SPELL_SOUL_RELEASE, true); @@ -454,7 +454,7 @@ public: ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); for (; itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->IsAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players targets.push_back(unit); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 8e5eb5ca888..b59d073c17d 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -777,7 +777,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid))) + if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } @@ -883,7 +883,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid))) + if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } @@ -973,7 +973,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid))) + if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } @@ -1053,7 +1053,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid))) + if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } @@ -1135,7 +1135,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - if (Creature* summoner = (Unit::GetCreature((*me), summonerGuid))) + if (Creature* summoner = (ObjectAccessor::GetCreature((*me), summonerGuid))) CAST_AI(npc_creature_generator_akama::npc_creature_generator_akamaAI, summoner->AI())->JustSummoned(me); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 98a349f3606..a705659337f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -178,7 +178,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && me->IsWithinMeleeRange(unit)) { if (unit->GetHealth() > health) diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 35521a783be..0d9537b8b7a 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -95,7 +95,7 @@ public: { DoZoneInCombat(); - Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); + Creature* Teron = (ObjectAccessor::GetCreature((*me), TeronGUID)); if ((Teron) && (!Teron->IsAlive() || Teron->IsInEvadeMode())) Despawn(); } @@ -177,7 +177,7 @@ public: std::list<Unit*> targets; for (; itr != threatlist.end(); ++itr) { - Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (unit && unit->IsAlive()) targets.push_back(unit); } @@ -200,7 +200,7 @@ public: if (CheckTeronTimer <= diff) { - Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); + Creature* Teron = (ObjectAccessor::GetCreature((*me), TeronGUID)); if (!Teron || !Teron->IsAlive() || Teron->IsInEvadeMode()) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); @@ -324,7 +324,7 @@ public: ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->IsAlive()) { float threat = DoGetThreat(unit); @@ -344,7 +344,7 @@ public: Unit* ghost = NULL; if (GhostGUID) - ghost = Unit::GetUnit(*me, GhostGUID); + ghost = ObjectAccessor::GetUnit(*me, GhostGUID); if (ghost && ghost->IsAlive() && ghost->HasAura(SPELL_SHADOW_OF_DEATH)) { /*float x, y, z; @@ -391,7 +391,7 @@ public: Done = true; if (AggroTargetGUID) { - Unit* unit = Unit::GetUnit(*me, AggroTargetGUID); + Unit* unit = ObjectAccessor::GetUnit(*me, AggroTargetGUID); if (unit) AttackStart(unit); diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 5228f891294..2362f534b05 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -141,7 +141,7 @@ public: if (!SpineTargetGUID) return false; - Unit* target = Unit::GetUnit(*me, SpineTargetGUID); + Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID); if (target && target->HasAura(SPELL_IMPALING_SPINE)) target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); SpineTargetGUID=0; diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 4a4addd253e..8fd9a421a49 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -182,7 +182,7 @@ public: { if (AggroYellTimer <= diff) { - if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter])) + if (Creature* pMember = ObjectAccessor::GetCreature(*me, Council[YellCounter])) { pMember->AI()->Talk(CouncilAggro[YellCounter].entry); AggroYellTimer = CouncilAggro[YellCounter].timer; @@ -197,7 +197,7 @@ public: { if (EnrageTimer <= diff) { - if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter])) + if (Creature* pMember = ObjectAccessor::GetCreature(*me, Council[YellCounter])) { pMember->CastSpell(pMember, SPELL_BERSERK, true); pMember->AI()->Talk(CouncilEnrage[YellCounter].entry); @@ -251,7 +251,7 @@ public: Creature* pMember = NULL; for (uint8 i = 0; i < 4; ++i) { - pMember = Unit::GetCreature((*me), Council[i]); + pMember = ObjectAccessor::GetCreature((*me), Council[i]); if (!pMember) continue; @@ -330,7 +330,7 @@ public: return; } - Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount])); + Creature* pMember = (ObjectAccessor::GetCreature(*me, Council[DeathCount])); if (pMember && pMember->IsAlive()) pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); ++DeathCount; @@ -347,7 +347,7 @@ public: { if (Council[i]) { - if (Creature* Member = (Unit::GetCreature((*me), Council[i]))) + if (Creature* Member = (ObjectAccessor::GetCreature((*me), Council[i]))) { // This is the evade/death check. if (Member->IsAlive() && !Member->GetVictim()) @@ -407,7 +407,7 @@ struct boss_illidari_councilAI : public ScriptedAI { for (uint8 i = 0; i < 4; ++i) { - if (Unit* unit = Unit::GetUnit(*me, Council[i])) + if (Unit* unit = ObjectAccessor::GetUnit(*me, Council[i])) if (unit != me && unit->GetVictim()) { AttackStart(unit->GetVictim()); @@ -425,7 +425,7 @@ struct boss_illidari_councilAI : public ScriptedAI damage /= 4; for (uint8 i = 0; i < 4; ++i) { - if (Creature* unit = Unit::GetCreature(*me, Council[i])) + if (Creature* unit = ObjectAccessor::GetCreature(*me, Council[i])) if (unit != me && damage < unit->GetHealth()) { unit->ModifyHealth(-int32(damage)); @@ -493,7 +493,7 @@ public: member = urand(1, 3); if (member != 2) // No need to create another pointer to us using Unit::GetUnit - unit = Unit::GetUnit(*me, Council[member]); + unit = ObjectAccessor::GetUnit(*me, Council[member]); return unit; } @@ -507,7 +507,7 @@ public: } for (uint8 i = 0; i < 4; ++i) { - Unit* unit = Unit::GetUnit(*me, Council[i]); + Unit* unit = ObjectAccessor::GetUnit(*me, Council[i]); if (unit) unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID()); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 6d43b0e910c..c6b62ee8de7 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -216,7 +216,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) { AttackStart(target); GetAdvisors(); @@ -357,7 +357,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -484,7 +484,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -515,7 +515,7 @@ public: if (Spitfire_Timer <= diff) { DoCast(me, SPELL_SPITFIRE_TOTEM); - if (Unit* SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM)) + if (Unit* SpitfireTotem = ObjectAccessor::GetUnit(*me, CREATURE_SPITFIRE_TOTEM)) SpitfireTotem->ToCreature()->AI()->AttackStart(me->GetVictim()); Spitfire_Timer = 60000; @@ -599,7 +599,7 @@ public: //Only if not incombat check if the event is started if (!me->IsInCombat() && instance->GetData(DATA_KARATHRESSEVENT)) { - if (Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) + if (Unit* target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESSEVENT_STARTER))) AttackStart(target); } @@ -675,13 +675,13 @@ public: switch (rand()%4) { case 0: - unit = Unit::GetUnit(*me, instance->GetData64(DATA_KARATHRESS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESS)); break; case 1: - unit = Unit::GetUnit(*me, instance->GetData64(DATA_SHARKKIS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SHARKKIS)); break; case 2: - unit = Unit::GetUnit(*me, instance->GetData64(DATA_TIDALVESS)); + unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_TIDALVESS)); break; case 3: unit = me; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index c4d21d30328..bcde75584fb 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -162,7 +162,7 @@ public: { for (uint8 i = 0; i < 2; ++i) { - if (Creature* mob = Unit::GetCreature(*me, beams[i])) + if (Creature* mob = ObjectAccessor::GetCreature(*me, beams[i])) { mob->setDeathState(DEAD); mob->RemoveCorpse(); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index dbf0c419fad..0745a85bf02 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -207,7 +207,7 @@ public: { if (ShieldGeneratorChannel[i]) { - if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i])) + if (Unit* remo = ObjectAccessor::GetUnit(*me, ShieldGeneratorChannel[i])) { remo->setDeathState(JUST_DIED); ShieldGeneratorChannel[i] = 0; @@ -431,7 +431,7 @@ public: std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (target && target->IsWithinDistInMap(me, 5)) // if in melee range { inMeleeRange = true; @@ -620,7 +620,7 @@ public: if (me->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3)) DoCast(me, SPELL_SURGE); } - if (Creature* vashj = Unit::GetCreature(*me, VashjGUID)) + if (Creature* vashj = ObjectAccessor::GetCreature(*me, VashjGUID)) if (!vashj->IsInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase != 2 || vashj->isDead()) me->Kill(me); Move = 1000; @@ -662,7 +662,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (Creature* vashj = Unit::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))) + if (Creature* vashj = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_LADYVASHJ))) CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->EventTaintedElementalDeath(); } @@ -778,7 +778,7 @@ public: if (CheckTimer <= diff) { // check if vashj is death - Unit* Vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); + Unit* Vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); if (!Vashj || !Vashj->IsAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3) { // remove @@ -833,7 +833,7 @@ public: { if (CheckTimer <= diff) { - Unit* vashj = Unit::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); + Unit* vashj = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LADYVASHJ)); if (vashj && vashj->IsAlive()) { @@ -865,7 +865,7 @@ public: return true; } - Creature* vashj = Unit::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ)); + Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetData64(DATA_LADYVASHJ)); if (vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) { if (GameObject* gObj = targets.GetGOTarget()) @@ -901,7 +901,7 @@ public: } // get and remove channel - if (Unit* channel = Unit::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) + if (Unit* channel = ObjectAccessor::GetCreature(*vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) channel->setDeathState(JUST_DIED); // call Unsummon() instance->SetData(identifier, 1); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 462babdc597..cc09952d336 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -112,7 +112,7 @@ public: void JustDied(Unit* /*killer*/) override { - Unit* unit = Unit::GetUnit(*me, victimGUID); + Unit* unit = ObjectAccessor::GetUnit(*me, victimGUID); if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER)) unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); } @@ -141,7 +141,7 @@ public: if (me->EnsureVictim()->GetGUID() != victimGUID) { DoModifyThreatPercent(me->GetVictim(), -100); - Unit* owner = Unit::GetUnit(*me, victimGUID); + Unit* owner = ObjectAccessor::GetUnit(*me, victimGUID); if (owner && owner->IsAlive()) { me->AddThreat(owner, 999999); @@ -249,7 +249,7 @@ public: { for (uint8 i = 0; i < 3; ++i) { - if (Creature* add = Unit::GetCreature(*me, SpellBinderGUID[i])) + if (Creature* add = ObjectAccessor::GetCreature(*me, SpellBinderGUID[i])) add->DisappearAndDie(); float nx = x; @@ -297,7 +297,7 @@ public: uint8 AliveChannelers = 0; for (uint8 i = 0; i < 3; ++i) { - Unit* add = Unit::GetUnit(*me, SpellBinderGUID[i]); + Unit* add = ObjectAccessor::GetUnit(*me, SpellBinderGUID[i]); if (add && add->IsAlive()) ++AliveChannelers; } @@ -350,7 +350,7 @@ public: if (InnderDemon[i]) { //delete creature - Creature* creature = Unit::GetCreature((*me), InnderDemon[i]); + Creature* creature = ObjectAccessor::GetCreature((*me), InnderDemon[i]); if (creature && creature->IsAlive()) { creature->DespawnOrUnsummon(); @@ -368,10 +368,10 @@ public: { if (InnderDemon[i] > 0) { - Creature* unit = Unit::GetCreature((*me), InnderDemon[i]); + Creature* unit = ObjectAccessor::GetCreature((*me), InnderDemon[i]); if (unit && unit->IsAlive()) { - Unit* unit_target = Unit::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM)); + Unit* unit_target = ObjectAccessor::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM)); if (unit_target && unit_target->IsAlive()) { unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true); @@ -397,7 +397,7 @@ public: //despawn copy if (Demon) { - if (Creature* pDemon = Unit::GetCreature(*me, Demon)) + if (Creature* pDemon = ObjectAccessor::GetCreature(*me, Demon)) pDemon->DespawnOrUnsummon(); } instance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE); @@ -518,7 +518,7 @@ public: std::vector<Unit*> TargetList; for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { - Unit* tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + Unit* tempTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->EnsureVictim()->GetGUID() && TargetList.size()<5) TargetList.push_back(tempTarget); } @@ -701,7 +701,7 @@ public: Earthshock_Timer = urand(5000, 10000); instance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); - Creature* leotheras = Unit::GetCreature(*me, leotherasGUID); + Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID); if (leotheras && leotheras->IsAlive()) CAST_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); } @@ -724,7 +724,7 @@ public: { if (leotherasGUID) { - Creature* leotheras = Unit::GetCreature(*me, leotherasGUID); + Creature* leotheras = ObjectAccessor::GetCreature(*me, leotherasGUID); if (leotheras && leotheras->IsAlive()) DoCast(leotheras, BANISH_BEAM); } @@ -739,7 +739,7 @@ public: if (!me->IsInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { Unit* victim = NULL; - victim = Unit::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); if (victim) AttackStart(victim); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp index 4f8c9390ba4..7e37c22565a 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp @@ -98,7 +98,7 @@ public: void JustDied(Unit* /*killer*/) override { for (std::list<uint64>::const_iterator i = Striders.begin(); i != Striders.end(); ++i) - if (Creature* strider = Unit::GetCreature(*me, *i)) + if (Creature* strider = ObjectAccessor::GetCreature(*me, *i)) strider->DisappearAndDie(); } @@ -132,7 +132,7 @@ public: { if (LevitatedTarget_Timer <= diff) { - if (Unit* target = Unit::GetUnit(*me, LevitatedTarget)) + if (Unit* target = ObjectAccessor::GetUnit(*me, LevitatedTarget)) { if (!target->HasAura(SPELL_LEVITATE)) { diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index c1e9d0a2b91..89aad2534f0 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -530,7 +530,7 @@ public: std::vector<Unit*> target_list; for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); //15 yard radius minimum if (target && target->IsWithinDist(me, 15, false)) target_list.push_back(target); diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 066772cb0f7..c85a26a25ab 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -118,7 +118,7 @@ class boss_kelidan_the_breaker : public CreatureScript } for (uint8 i=0; i<5; ++i) { - Creature* channeler = Unit::GetCreature(*me, Channelers[i]); + Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (who && channeler && !channeler->IsInCombat()) channeler->AI()->AttackStart(who); } @@ -128,7 +128,7 @@ class boss_kelidan_the_breaker : public CreatureScript { for (uint8 i=0; i<5; ++i) { - Creature* channeler = Unit::GetCreature(*me, Channelers[i]); + Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (channeler && channeler->IsAlive()) return; } @@ -147,7 +147,7 @@ class boss_kelidan_the_breaker : public CreatureScript uint8 i; for (i=0; i<5; ++i) { - Creature* channeler = Unit::GetCreature(*me, Channelers[i]); + Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (channeler && channeler->GetGUID() == channeler1->GetGUID()) break; } @@ -158,7 +158,7 @@ class boss_kelidan_the_breaker : public CreatureScript { for (uint8 i=0; i<5; ++i) { - Creature* channeler = Unit::GetCreature(*me, Channelers[i]); + Creature* channeler = ObjectAccessor::GetCreature(*me, Channelers[i]); if (!channeler || channeler->isDead()) channeler = me->SummonCreature(ENTRY_CHANNELER, ShadowmoonChannelers[i][0], ShadowmoonChannelers[i][1], ShadowmoonChannelers[i][2], ShadowmoonChannelers[i][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); if (channeler) @@ -313,7 +313,7 @@ class npc_shadowmoon_channeler : public CreatureScript if (Creature* Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100)) { uint64 channeler = CAST_AI(boss_kelidan_the_breaker::boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(me); - if (Unit* channeled = Unit::GetUnit(*me, channeler)) + if (Unit* channeled = ObjectAccessor::GetUnit(*me, channeler)) DoCast(channeled, SPELL_CHANNELING); } check_Timer = 5000; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 424090c87d0..b15bd18c97c 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -124,7 +124,7 @@ class boss_nazan : public CreatureScript if (flight) // phase 1 - the flight { - Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID); + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20))) { flight = false; @@ -300,7 +300,7 @@ class boss_vazruden_the_herald : public CreatureScript { if (summoned) { - Creature* Nazan = Unit::GetCreature(*me, NazanGUID); + Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); if (!Nazan) Nazan = me->FindNearestCreature(NPC_NAZAN, 5000); if (Nazan) @@ -309,7 +309,7 @@ class boss_vazruden_the_herald : public CreatureScript NazanGUID = 0; } - Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID); + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); if (!Vazruden) Vazruden = me->FindNearestCreature(NPC_VAZRUDEN, 5000); if (Vazruden) @@ -404,8 +404,8 @@ class boss_vazruden_the_herald : public CreatureScript default: // adds do the job now if (check <= diff) { - Creature* Nazan = Unit::GetCreature(*me, NazanGUID); - Creature* Vazruden = Unit::GetCreature(*me, VazrudenGUID); + Creature* Nazan = ObjectAccessor::GetCreature(*me, NazanGUID); + Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID); if ((Nazan && Nazan->IsAlive()) || (Vazruden && Vazruden->IsAlive())) { if ((Nazan && Nazan->GetVictim()) || (Vazruden && Vazruden->GetVictim())) diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 91aad3c00eb..1bdaf4fc260 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -257,7 +257,7 @@ class boss_magtheridon : public CreatureScript { // to avoid multiclicks from 1 cube if (uint64 guid = Cube[cubeGUID]) - DebuffClicker(Unit::GetUnit(*me, guid)); + DebuffClicker(ObjectAccessor::GetUnit(*me, guid)); Cube[cubeGUID] = clickerGUID; NeedCheckCube = true; } @@ -280,7 +280,7 @@ class boss_magtheridon : public CreatureScript // if not - apply mind exhaustion and delete from clicker's list for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i) { - Unit* clicker = Unit::GetUnit(*me, (*i).second); + Unit* clicker = ObjectAccessor::GetUnit(*me, (*i).second); if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP)) { DebuffClicker(clicker); @@ -588,7 +588,7 @@ public: if (instance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; - Creature* Magtheridon =Unit::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON)); + Creature* Magtheridon =ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_MAGTHERIDON)); if (!Magtheridon || !Magtheridon->IsAlive()) return true; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 187e5b4993b..88c3041b62c 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -323,7 +323,7 @@ class npc_fel_orc_convert : public CreatureScript { events.ScheduleEvent(EVENT_HEMORRHAGE, 3000); - if (Creature* Kurse = Unit::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) + if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) if (me->IsWithinDist(Kurse, 45.0f)) Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_AGGRO); } @@ -333,7 +333,7 @@ class npc_fel_orc_convert : public CreatureScript if (instance->GetBossState(DATA_NETHEKURSE) != IN_PROGRESS) return; - if (Creature* Kurse = Unit::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) + if (Creature* Kurse = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE))) Kurse->AI()->SetData(SETDATA_DATA, SETDATA_PEON_DEATH); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 69be4b46eff..b03fc651e12 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -142,13 +142,13 @@ class boss_warbringer_omrogg : public CreatureScript void Reset() override { - if (Unit* LeftHead = Unit::GetUnit(*me, LeftHeadGUID)) + if (Unit* LeftHead = ObjectAccessor::GetUnit(*me, LeftHeadGUID)) { LeftHead->setDeathState(JUST_DIED); LeftHeadGUID = 0; } - if (Unit* RightHead = Unit::GetUnit(*me, RightHeadGUID)) + if (Unit* RightHead = ObjectAccessor::GetUnit(*me, RightHeadGUID)) { RightHead->setDeathState(JUST_DIED); RightHeadGUID = 0; @@ -172,8 +172,8 @@ class boss_warbringer_omrogg : public CreatureScript void DoYellForThreat() { - Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID); - Creature* RightHead = Unit::GetCreature(*me, RightHeadGUID); + Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); + Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); if (!LeftHead || !RightHead) return; @@ -193,7 +193,7 @@ class boss_warbringer_omrogg : public CreatureScript me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID)) + if (Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID)) { iaggro = rand()%3; @@ -221,8 +221,8 @@ class boss_warbringer_omrogg : public CreatureScript void KilledUnit(Unit* /*victim*/) override { - Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID); - Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID); + Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); + Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); if (!LeftHead || !RightHead) return; @@ -247,8 +247,8 @@ class boss_warbringer_omrogg : public CreatureScript void JustDied(Unit* /*killer*/) override { - Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID); - Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID); + Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); + Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); if (!LeftHead || !RightHead) return; @@ -266,8 +266,8 @@ class boss_warbringer_omrogg : public CreatureScript { Delay_Timer = 3500; - Creature* LeftHead = Creature::GetCreature(*me, LeftHeadGUID); - Creature* RightHead = Creature::GetCreature(*me, RightHeadGUID); + Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); + Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); if (!LeftHead || !RightHead) return; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index f918038b369..66aa02bbeaf 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -145,7 +145,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript { for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) { - Creature* creature = Unit::GetCreature(*me, *itr); + Creature* creature = ObjectAccessor::GetCreature(*me, *itr); if (creature && creature->IsAlive()) { creature->GetMotionMaster()->Clear(true); @@ -157,7 +157,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { - Creature* creature = Unit::GetCreature(*me, *itr); + Creature* creature = ObjectAccessor::GetCreature(*me, *itr); if (creature && creature->IsAlive()) { creature->GetMotionMaster()->Clear(true); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index ead163b3a82..bcc8b0c5a48 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -494,7 +494,7 @@ class npc_ember_of_alar : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (instance->GetData(DATA_ALAREVENT) == 2) { - if (Unit* Alar = Unit::GetUnit(*me, instance->GetData64(DATA_ALAR))) + if (Unit* Alar = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALAR))) { int32 AlarHealth = int32(Alar->GetHealth()) - int32(Alar->CountPctFromMaxHealth(3)); if (AlarHealth > 0) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 5f92445f9dd..2cac4a0be1a 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -464,7 +464,7 @@ class npc_solarium_priest : public CreatureScript switch (urand(0, 1)) { case 0: - target = Unit::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER)); + target = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ASTROMANCER)); break; case 1: target = me; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 016e68a4e8d..a24e1d5d34f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -143,7 +143,7 @@ uint32 m_auiSpellSummonWeapon[]= }; const float CAPERNIAN_DISTANCE = 20.0f; //she casts away from the target -const float KAEL_VISIBLE_RANGE = 50.0f; +//const float KAEL_VISIBLE_RANGE = 50.0f; const float afGravityPos[3] = {795.0f, 0.0f, 70.0f}; @@ -183,7 +183,7 @@ struct advisorbase_ai : public ScriptedAI //reset encounter if (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3) - if (Creature* Kaelthas = Unit::GetCreature(*me, instance->GetData64(DATA_KAELTHAS))) + if (Creature* Kaelthas = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KAELTHAS))) Kaelthas->AI()->EnterEvadeMode(); } @@ -262,7 +262,7 @@ struct advisorbase_ai : public ScriptedAI DelayRes_Timer = 0; FakeDeath = false; - Unit* Target = Unit::GetUnit(*me, DelayRes_Target); + Unit* Target = ObjectAccessor::GetUnit(*me, DelayRes_Target); if (!Target) Target = me->GetVictim(); @@ -351,7 +351,7 @@ class boss_kaelthas : public CreatureScript { for (uint8 i = 0; i < MAX_ADVISORS; ++i) { - if (Creature* creature = Unit::GetCreature(*me, m_auiAdvisorGuid[i])) + if (Creature* creature = ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[i])) { creature->Respawn(); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -468,7 +468,7 @@ class boss_kaelthas : public CreatureScript for (uint8 i = 0; i < MAX_ADVISORS; ++i) { - if (Unit* pAdvisor = Unit::GetUnit(*me, m_auiAdvisorGuid[i])) + if (Unit* pAdvisor = ObjectAccessor::GetUnit(*me, m_auiAdvisorGuid[i])) pAdvisor->Kill(pAdvisor); } } @@ -502,7 +502,7 @@ class boss_kaelthas : public CreatureScript case 1: if (Phase_Timer <= diff) { - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[0])); if (Advisor) { @@ -520,7 +520,7 @@ class boss_kaelthas : public CreatureScript //Subphase 2 - Start case 2: - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[0])); if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { @@ -536,7 +536,7 @@ class boss_kaelthas : public CreatureScript case 3: if (Phase_Timer <= diff) { - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[1])); if (Advisor) { @@ -554,7 +554,7 @@ class boss_kaelthas : public CreatureScript //Subphase 3 - Start case 4: - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[1])); if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { @@ -570,7 +570,7 @@ class boss_kaelthas : public CreatureScript case 5: if (Phase_Timer <= diff) { - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[2])); if (Advisor) { @@ -588,7 +588,7 @@ class boss_kaelthas : public CreatureScript //Subphase 4 - Start case 6: - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[2])); if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { @@ -604,7 +604,7 @@ class boss_kaelthas : public CreatureScript case 7: if (Phase_Timer <= diff) { - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[3])); if (Advisor) { @@ -623,7 +623,7 @@ class boss_kaelthas : public CreatureScript //End of phase 1 case 8: - Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3])); + Advisor = (ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[3])); if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD)) { @@ -692,7 +692,7 @@ class boss_kaelthas : public CreatureScript Creature* Advisor; for (uint8 i = 0; i < MAX_ADVISORS; ++i) { - Advisor = Unit::GetCreature(*me, m_auiAdvisorGuid[i]); + Advisor = ObjectAccessor::GetCreature(*me, m_auiAdvisorGuid[i]); if (!Advisor) TC_LOG_ERROR("scripts", "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); @@ -896,7 +896,7 @@ class boss_kaelthas : public CreatureScript // 1) Kael'thas will portal the whole raid right into his body for (i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { //Use work around packet to prevent player from being dropped from combat @@ -917,7 +917,7 @@ class boss_kaelthas : public CreatureScript // 2) At that point he will put a Gravity Lapse debuff on everyone for (i = threatlist.begin(); i != threatlist.end(); ++i) { - if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) { DoCast(unit, SPELL_KNOCKBACK, true); //Gravity lapse - needs an exception in Spell system to work @@ -949,7 +949,7 @@ class boss_kaelthas : public CreatureScript //Remove flight for (i = threatlist.begin(); i != threatlist.end(); ++i) { - if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) { //Using packet workaround WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12); @@ -1288,7 +1288,7 @@ class boss_grand_astromancer_capernian : public CreatureScript ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i!= threatlist.end(); ++i) { - Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); //if in melee range if (unit && unit->IsWithinDistInMap(me, 5)) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index 58b5972c25c..634d54ed58b 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -122,7 +122,7 @@ class boss_void_reaver : public CreatureScript std::vector<Unit*> target_list; for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (!target) continue; // exclude pets & totems, 18 yard radius minimum diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index 53727db2f4b..2c15a6dd30d 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -151,7 +151,7 @@ class boss_high_botanist_freywinn : public CreatureScript { for (std::list<uint64>::iterator itr = Adds_List.begin(); itr != Adds_List.end(); ++itr) { - if (Unit* temp = Unit::GetUnit(*me, *itr)) + if (Unit* temp = ObjectAccessor::GetUnit(*me, *itr)) { if (!temp->IsAlive()) { diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index c9dd31cdc76..a1335290d5a 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -97,7 +97,7 @@ class npc_warp_splinter_treant : public CreatureScript { if (WarpGuid && check_Timer <= diff) { - if (Unit* Warp = Unit::GetUnit(*me, WarpGuid)) + if (Unit* Warp = ObjectAccessor::GetUnit(*me, WarpGuid)) { if (me->IsWithinMeleeRange(Warp, 2.5f)) { diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 7b9b2be4674..0da70207a04 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -318,7 +318,7 @@ public: if (type != POINT_MOTION_TYPE || id != 1) return; - if (Creature* helboar = me->GetCreature(*me, helboarGUID)) + if (Creature* helboar = ObjectAccessor::GetCreature(*me, helboarGUID)) { helboar->RemoveCorpse(); DoCast(SPELL_SUMMON_POO); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 8fac7853f26..cb75ee3b2ad 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -243,7 +243,7 @@ public: case 1: if (someplayer) { - Unit* u = Unit::GetUnit(*me, someplayer); + Unit* u = ObjectAccessor::GetUnit(*me, someplayer); if (u && u->GetTypeId() == TYPEID_PLAYER) Talk(EMOTE_START, u); } @@ -795,7 +795,7 @@ public: for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { if (unit->GetCreateMana() > 0) UnitsWithMana.push_back(unit); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 4efa108429a..116beb3d081 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -133,7 +133,7 @@ public: { if (bCanEat && !bIsEating) { - if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, uiPlayerGUID)) { if (GameObject* go = unit->FindNearestGameObject(GO_CARCASS, 10)) { @@ -273,7 +273,7 @@ public: { if (PlayerGUID) { - Unit* player = Unit::GetUnit(*me, PlayerGUID); + Unit* player = ObjectAccessor::GetUnit(*me, PlayerGUID); if (player) DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true); @@ -1225,7 +1225,7 @@ public: if (TorlothAnim[AnimationCount].creature == 1) { - creature = (Unit::GetCreature(*me, LordIllidanGUID)); + creature = (ObjectAccessor::GetCreature(*me, LordIllidanGUID)); if (!creature) return; @@ -1326,7 +1326,7 @@ public: break; } - if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) + if (Creature* LordIllidan = (ObjectAccessor::GetCreature(*me, LordIllidanGUID))) LordIllidan->AI()->EnterEvadeMode(); } }; @@ -1507,7 +1507,7 @@ public: void JustDied(Unit* /*killer*/) override { me->RemoveCorpse(); - if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) + if (Creature* LordIllidan = (ObjectAccessor::GetCreature(*me, LordIllidanGUID))) if (LordIllidan) CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); } @@ -1867,13 +1867,6 @@ public: { npc_shadowmoon_tuber_nodeAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() override - { - tapped = false; - tuberGUID = 0; - resetTimer = 60000; - } - void SetData(uint32 id, uint32 data) override { if (id == TYPE_BOAR && data == DATA_BOAR) @@ -1884,49 +1877,23 @@ public: // Despawn the tuber if (GameObject* tuber = me->FindNearestGameObject(GO_SHADOWMOON_TUBER_MOUND, 5.0f)) { - tuberGUID = tuber->GetGUID(); - // @Workaround: find how to properly despawn the GO - tuber->SetPhaseMask(2, true); + tuber->SetLootState(GO_JUST_DEACTIVATED); + me->DespawnOrUnsummon(); } } } void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override { - if (!tapped && spell->Id == SPELL_WHISTLE) + if (spell->Id == SPELL_WHISTLE) { if (Creature* boar = me->FindNearestCreature(NPC_BOAR_ENTRY, 30.0f)) { - // Disable trigger and force nearest boar to walk to him - tapped = true; boar->SetWalk(false); boar->GetMotionMaster()->MovePoint(POINT_TUBER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); } } } - - void UpdateAI(uint32 diff) override - { - if (tapped) - { - if (resetTimer <= diff) - { - // Respawn the tuber - if (tuberGUID) - if (GameObject* tuber = GameObject::GetGameObject(*me, tuberGUID)) - // @Workaround: find how to properly respawn the GO - tuber->SetPhaseMask(1, true); - - Reset(); - } - else - resetTimer -= diff; - } - } - private: - bool tapped; - uint64 tuberGUID; - uint32 resetTimer; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a97c5b8c18f..0dd38c74fef 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -570,7 +570,7 @@ class spell_gen_break_shield: public SpellScriptLoader class spell_gen_break_shield_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_break_shield_SpellScript) + PrepareSpellScript(spell_gen_break_shield_SpellScript); void HandleScriptEffect(SpellEffIndex effIndex) { @@ -732,7 +732,7 @@ class spell_gen_chaos_blast : public SpellScriptLoader class spell_gen_chaos_blast_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_chaos_blast_SpellScript) + PrepareSpellScript(spell_gen_chaos_blast_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -969,7 +969,7 @@ class spell_gen_count_pct_from_max_hp : public SpellScriptLoader class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) + PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript); public: spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } @@ -1463,6 +1463,7 @@ class spell_gen_elune_candle : public SpellScriptLoader class spell_gen_elune_candle_SpellScript : public SpellScript { PrepareSpellScript(spell_gen_elune_candle_SpellScript); + bool Validate(SpellInfo const* /*spellInfo*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD) || @@ -1528,7 +1529,7 @@ class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader class spell_gen_gadgetzan_transporter_backfire_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript) + PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -1629,7 +1630,7 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader class spell_gen_gnomish_transporter_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript) + PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -1926,7 +1927,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader class spell_gen_mounted_charge_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_mounted_charge_SpellScript) + PrepareSpellScript(spell_gen_mounted_charge_SpellScript); void HandleScriptEffect(SpellEffIndex effIndex) { @@ -2627,7 +2628,7 @@ class spell_gen_parachute_ic : public SpellScriptLoader class spell_gen_parachute_ic_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_parachute_ic_AuraScript) + PrepareAuraScript(spell_gen_parachute_ic_AuraScript); void HandleTriggerSpell(AuraEffect const* /*aurEff*/) { @@ -2675,30 +2676,28 @@ class spell_gen_pet_summoned : public SpellScriptLoader if (player->GetLastPetNumber()) { PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET; - if (Pet* newPet = new Pet(player, newPetType)) + Pet* newPet = new Pet(player, newPetType); + if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true)) { - if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true)) - { - // revive the pet if it is dead - if (newPet->getDeathState() == DEAD) - newPet->setDeathState(ALIVE); + // revive the pet if it is dead + if (newPet->getDeathState() == DEAD) + newPet->setDeathState(ALIVE); - newPet->SetFullHealth(); - newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType())); + newPet->SetFullHealth(); + newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType())); - switch (newPet->GetEntry()) - { - case NPC_DOOMGUARD: - case NPC_INFERNAL: - newPet->SetEntry(NPC_IMP); - break; - default: - break; - } + switch (newPet->GetEntry()) + { + case NPC_DOOMGUARD: + case NPC_INFERNAL: + newPet->SetEntry(NPC_IMP); + break; + default: + break; } - else - delete newPet; } + else + delete newPet; } } @@ -3110,7 +3109,7 @@ class spell_gen_spectator_cheer_trigger : public SpellScriptLoader class spell_gen_spectator_cheer_trigger_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript) + PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript); void HandleDummy(SpellEffIndex /*effIndex*/) { @@ -3602,7 +3601,7 @@ class spell_gen_vendor_bark_trigger : public SpellScriptLoader class spell_gen_vendor_bark_trigger_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_vendor_bark_trigger_SpellScript) + PrepareSpellScript(spell_gen_vendor_bark_trigger_SpellScript); void HandleDummy(SpellEffIndex /* effIndex */) { diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index dc0c70975dd..85bf85fa2d2 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -296,7 +296,7 @@ class spell_pilgrims_bounty_buff_food : public SpellScriptLoader class spell_pilgrims_bounty_buff_food_AuraScript : public AuraScript { - PrepareAuraScript(spell_pilgrims_bounty_buff_food_AuraScript) + PrepareAuraScript(spell_pilgrims_bounty_buff_food_AuraScript); private: uint32 const _triggeredSpellId; diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index e780b88c6be..eb03b47e6fe 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -842,15 +842,16 @@ class spell_hun_sniper_training : public SpellScriptLoader PreventDefaultAction(); if (aurEff->GetAmount() <= 0) { - Unit* caster = GetCaster(); + Unit* target = GetTarget(); uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1; - if (Unit* target = GetTarget()) - if (!target->HasAura(spellId)) - { - SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId); - Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(GetSpellInfo()) ? caster : target; - triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff); - } + + target->CastSpell(target, spellId, true, 0, aurEff); + if (Player* playerTarget = GetUnitOwner()->ToPlayer()) + { + int32 baseAmount = aurEff->GetBaseAmount(); + int32 amount = playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount); + GetEffect(EFFECT_0)->SetAmount(amount); + } } } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index e4563ba07fe..c4a521ea41d 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2231,7 +2231,8 @@ class spell_item_nitro_boots : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { Unit* caster = GetCaster(); - caster->CastSpell(caster, roll_chance_i(95) ? SPELL_NITRO_BOOTS_SUCCESS : SPELL_NITRO_BOOTS_BACKFIRE, true, GetCastItem()); + bool success = caster->GetMap()->IsDungeon() || roll_chance_i(95); + caster->CastSpell(caster, success ? SPELL_NITRO_BOOTS_SUCCESS : SPELL_NITRO_BOOTS_BACKFIRE, true, GetCastItem()); } void Register() override diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index de82d1b9780..d804c0cfc8b 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -337,7 +337,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -538,7 +538,7 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 013887234bf..bc568904b80 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -850,7 +850,7 @@ class spell_sha_lava_lash : public SpellScriptLoader class spell_sha_lava_lash_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_lava_lash_SpellScript) + PrepareSpellScript(spell_sha_lava_lash_SpellScript); bool Load() override { @@ -927,7 +927,7 @@ class spell_sha_lava_surge_proc : public SpellScriptLoader class spell_sha_lava_surge_proc_SpellScript : public SpellScript { - PrepareSpellScript(spell_sha_lava_surge_proc_SpellScript) + PrepareSpellScript(spell_sha_lava_surge_proc_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 73093037689..fb438c38efb 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -461,11 +461,11 @@ public: if (player->GetQuestStatus(QUEST_THE_LONESOME_WATCHER) != QUEST_STATUS_INCOMPLETE) return false; - Creature* stormforgedMonitor = Creature::GetCreature(*player, stormforgedMonitorGUID); + Creature* stormforgedMonitor = ObjectAccessor::GetCreature(*player, stormforgedMonitorGUID); if (stormforgedMonitor) return false; - Creature* stormforgedEradictor = Creature::GetCreature(*player, stormforgedEradictorGUID); + Creature* stormforgedEradictor = ObjectAccessor::GetCreature(*player, stormforgedEradictorGUID); if (stormforgedEradictor) return false; diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 362c02e1af5..950b4cd10e9 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -781,4 +781,4 @@ void AddSC_emerald_dragons() // dragon spellscripts new spell_dream_fog_sleep(); new spell_mark_of_nature(); -}; +} diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 416cab8efcd..21a81d37868 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -282,7 +282,7 @@ public: { if (exileTimer <= diff) { - if (Unit* temp = Unit::GetUnit(*me, playerGUID)) + if (Unit* temp = ObjectAccessor::GetUnit(*me, playerGUID)) { temp->CastSpell(temp, SPELL_EXILE, true); temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true); @@ -347,7 +347,7 @@ public: { if (exileTimer <= diff) { - if (Unit* temp = Unit::GetUnit(*me, playerGUID)) + if (Unit* temp = ObjectAccessor::GetUnit(*me, playerGUID)) { temp->CastSpell(temp, SPELL_EXILE, true); temp->CastSpell(temp, SPELL_BANISH_TELEPORT, true); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f9aa65c6b07..321c3d67dc5 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -56,6 +56,7 @@ EndContentData */ #include "CellImpl.h" #include "SpellAuras.h" #include "Pet.h" +#include "CreatureTextMgr.h" /*######## # npc_air_force_bots @@ -175,7 +176,7 @@ public: Creature* GetSummonedGuard() { - Creature* creature = Unit::GetCreature(*me, SpawnedGUID); + Creature* creature = ObjectAccessor::GetCreature(*me, SpawnedGUID); if (creature && creature->IsAlive()) return creature; @@ -665,7 +666,7 @@ public: std::list<uint64>::const_iterator itr; for (itr = Patients.begin(); itr != Patients.end(); ++itr) { - if (Creature* patient = Unit::GetCreature((*me), *itr)) + if (Creature* patient = ObjectAccessor::GetCreature((*me), *itr)) patient->setDeathState(JUST_DIED); } } @@ -762,7 +763,7 @@ public: if (player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) if (DoctorGUID) - if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID)) + if (Creature* doctor = ObjectAccessor::GetCreature(*me, DoctorGUID)) CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord); //make not selectable @@ -808,7 +809,7 @@ public: me->SetFlag(UNIT_DYNAMIC_FLAGS, 32); if (DoctorGUID) - if (Creature* doctor = Unit::GetCreature((*me), DoctorGUID)) + if (Creature* doctor = ObjectAccessor::GetCreature((*me), DoctorGUID)) CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord); } } @@ -1058,7 +1059,7 @@ public: { if (RunAwayTimer <= diff) { - if (Unit* unit = Unit::GetUnit(*me, CasterGUID)) + if (Unit* unit = ObjectAccessor::GetUnit(*me, CasterGUID)) { switch (me->GetEntry()) { @@ -1211,6 +1212,11 @@ public: player->SEND_GOSSIP_MENU(10239, creature->GetGUID()); else canBuy = true; break; + case 48510: //Kall Worthaton + if (player->GetReputationRank(1133) != REP_EXALTED && race != RACE_GOBLIN) + player->SEND_GOSSIP_MENU(17494, creature->GetGUID()); + else canBuy = true; + break; } if (canBuy) @@ -2312,7 +2318,7 @@ public: { if (jumpTimer <= diff) { - if (Unit* rabbit = Unit::GetUnit(*me, rabbitGUID)) + if (Unit* rabbit = ObjectAccessor::GetUnit(*me, rabbitGUID)) DoCast(rabbit, SPELL_SPRING_RABBIT_JUMP); jumpTimer = urand(5000, 10000); } else jumpTimer -= diff; @@ -2346,6 +2352,60 @@ public: }; }; +class npc_imp_in_a_ball : public CreatureScript +{ +private: + enum + { + SAY_RANDOM, + + EVENT_TALK = 1, + }; + +public: + npc_imp_in_a_ball() : CreatureScript("npc_imp_in_a_ball") { } + + struct npc_imp_in_a_ballAI : public ScriptedAI + { + npc_imp_in_a_ballAI(Creature* creature) : ScriptedAI(creature) + { + summonerGUID = 0; + } + + void IsSummonedBy(Unit* summoner) override + { + if (summoner->GetTypeId() == TYPEID_PLAYER) + { + summonerGUID = summoner->GetGUID(); + events.ScheduleEvent(EVENT_TALK, 3000); + } + } + + void UpdateAI(uint32 diff) override + { + events.Update(diff); + + if (events.ExecuteEvent() == EVENT_TALK) + { + if (Player* owner = ObjectAccessor::GetPlayer(*me, summonerGUID)) + { + sCreatureTextMgr->SendChat(me, SAY_RANDOM, owner, + owner->GetGroup() ? CHAT_MSG_MONSTER_PARTY : CHAT_MSG_MONSTER_WHISPER, LANG_ADDON, TEXT_RANGE_NORMAL); + } + } + } + + private: + EventMap events; + uint64 summonerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_imp_in_a_ballAI(creature); + } +}; + void AddSC_npcs_special() { new npc_air_force_bots(); @@ -2368,4 +2428,5 @@ void AddSC_npcs_special() new npc_experience(); new npc_firework(); new npc_spring_rabbit(); + new npc_imp_in_a_ball(); } diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h index d6ba98e4ed4..9121fbe2a97 100644 --- a/src/server/shared/Containers.h +++ b/src/server/shared/Containers.h @@ -64,6 +64,34 @@ namespace Trinity std::advance(it, urand(0, container.size() - 1)); return *it; } + + /** + * @fn bool Trinity::Containers::Intersects(Iterator first1, Iterator last1, Iterator first2, Iterator last2) + * + * @brief Checks if two SORTED containers have a common element + * + * @param first1 Iterator pointing to start of the first container + * @param last1 Iterator pointing to end of the first container + * @param first2 Iterator pointing to start of the second container + * @param last2 Iterator pointing to end of the second container + * + * @return true if containers have a common element, false otherwise. + */ + template<class Iterator1, class Iterator2> + bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) + { + while (first1 != last1 && first2 != last2) + { + if (*first1 < *first2) + ++first1; + else if (*first2 < *first1) + ++first2; + else + return true; + } + + return false; + } } //! namespace Containers } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index c60458323f7..9c56c75bf71 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -49,8 +49,10 @@ class DatabaseWorkerPool { public: /* Activity state */ - DatabaseWorkerPool() : _queue(new ACE_Activation_Queue()), _connectionInfo(NULL) + DatabaseWorkerPool() : _connectionInfo(NULL) { + _messageQueue = new ACE_Message_Queue<ACE_SYNCH>(8 * 1024 * 1024, 8 * 1024 * 1024); + _queue = new ACE_Activation_Queue(_messageQueue); memset(_connectionCount, 0, sizeof(_connectionCount)); _connections.resize(IDX_SIZE); @@ -97,7 +99,7 @@ class DatabaseWorkerPool (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else TC_LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " - "for specific errors.", GetDatabaseName()); + "for specific errors. Read wiki at http://collab.kpsn.org/display/tc/TrinityCore+Home", GetDatabaseName()); return res; } @@ -131,6 +133,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; + delete _messageQueue; TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName()); @@ -520,6 +523,7 @@ class DatabaseWorkerPool IDX_SIZE }; + ACE_Message_Queue<ACE_SYNCH>* _messageQueue; //! Message Queue used by ACE_Activation_Queue ACE_Activation_Queue* _queue; //! Queue shared by async worker threads. std::vector< std::vector<T*> > _connections; uint32 _connectionCount[2]; //! Counter of MySQL connections; diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index 3b6bd3d2cc8..81825c9055b 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -45,7 +45,7 @@ inline LPTSTR ErrorMessage(DWORD dw) sprintf(msgBuf, "Unknown error: %u", dw); return msgBuf; } - + } //============================== Global Variables ============================= diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h index f6d6b7f4b9e..e1cc3050929 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.h +++ b/src/server/shared/Debugging/WheatyExceptionReport.h @@ -83,7 +83,7 @@ struct SymbolPair bool operator<(const SymbolPair& other) const { - return _offset < other._offset || + return _offset < other._offset || (_offset == other._offset && _type < other._type); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index bc002668b3b..dc9bda62bfb 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -250,13 +250,13 @@ void Log::ReadLoggersFromConfig() AppenderConsole* appender = new AppenderConsole(NextAppenderId(), "Console", LOG_LEVEL_DEBUG, APPENDER_FLAGS_NONE); appenders[appender->getId()] = appender; - Logger& rootLogger = loggers[LOGGER_ROOT]; - rootLogger.Create(LOGGER_ROOT, LOG_LEVEL_ERROR); - rootLogger.addAppender(appender->getId(), appender); + Logger& logger = loggers[LOGGER_ROOT]; + logger.Create(LOGGER_ROOT, LOG_LEVEL_ERROR); + logger.addAppender(appender->getId(), appender); - Logger& serverLogger = loggers["server"]; - serverLogger.Create("server", LOG_LEVEL_INFO); - serverLogger.addAppender(appender->getId(), appender); + logger = loggers["server"]; + logger.Create("server", LOG_LEVEL_ERROR); + logger.addAppender(appender->getId(), appender); } } @@ -267,7 +267,7 @@ void Log::vlog(std::string const& filter, LogLevel level, char const* str, va_li write(new LogMessage(level, filter, text)); } -void Log::write(LogMessage* msg) +void Log::write(LogMessage* msg) const { Logger const* logger = GetLoggerByType(msg->type); msg->text.append("\n"); @@ -376,7 +376,6 @@ void Log::Close() delete worker; worker = NULL; loggers.clear(); - cachedLoggers.clear(); for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { delete it->second; diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5fa638e2f40..a118e6e8773 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -35,7 +35,6 @@ class Log friend class ACE_Singleton<Log, ACE_Thread_Mutex>; typedef std::unordered_map<std::string, Logger> LoggerMap; - typedef std::unordered_map<std::string, Logger const*> CachedLoggerContainer; private: Log(); @@ -44,7 +43,7 @@ class Log public: void LoadFromConfig(); void Close(); - bool ShouldLog(std::string const& type, LogLevel level); + bool ShouldLog(std::string const& type, LogLevel level) const; bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); void outMessage(std::string const& f, LogLevel level, char const* str, ...) ATTR_PRINTF(4, 5); @@ -57,9 +56,9 @@ class Log private: static std::string GetTimestampStr(); void vlog(std::string const& f, LogLevel level, char const* str, va_list argptr); - void write(LogMessage* msg); + void write(LogMessage* msg) const; - Logger const* GetLoggerByType(std::string const& type); + Logger const* GetLoggerByType(std::string const& type) const; Appender* GetAppenderByName(std::string const& name); uint8 NextAppenderId(); void CreateAppenderFromConfig(std::string const& name); @@ -69,7 +68,6 @@ class Log AppenderMap appenders; LoggerMap loggers; - CachedLoggerContainer cachedLoggers; uint8 AppenderId; std::string m_logsDir; @@ -78,37 +76,29 @@ class Log LogWorker* worker; }; -inline Logger const* Log::GetLoggerByType(std::string const& originalType) +inline Logger const* Log::GetLoggerByType(std::string const& type) const { - // Check if already cached - CachedLoggerContainer::const_iterator itCached = cachedLoggers.find(originalType); - if (itCached != cachedLoggers.end()) - return itCached->second; - - Logger const* logger = NULL; - std::string type(originalType); - - do - { - // Search for the logger "type.subtype" - LoggerMap::const_iterator it = loggers.find(type); - if (it == loggers.end()) - { - // Search for the logger "type", if our logger contains '.', otherwise search for LOGGER_ROOT - size_t found = type.find_last_of("."); - type = found != std::string::npos ? type.substr(0, found) : LOGGER_ROOT; - } - else - logger = &(it->second); - } - while (!logger); - - cachedLoggers[originalType] = logger; - return logger; + LoggerMap::const_iterator it = loggers.find(type); + if (it != loggers.end()) + return &(it->second); + + if (type == LOGGER_ROOT) + return NULL; + + std::string parentLogger = LOGGER_ROOT; + size_t found = type.find_last_of("."); + if (found != std::string::npos) + parentLogger = type.substr(0,found); + + return GetLoggerByType(parentLogger); } -inline bool Log::ShouldLog(std::string const& type, LogLevel level) +inline bool Log::ShouldLog(std::string const& type, LogLevel level) const { + // TODO: Use cache to store "Type.sub1.sub2": "Type" equivalence, should + // Speed up in cases where requesting "Type.sub1.sub2" but only configured + // Logger "Type" + Logger const* logger = GetLoggerByType(type); if (!logger) return false; diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index b8cb5215665..f446592e922 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -27,11 +27,10 @@ ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) { std::ostringstream ss; - ACE_Stack_Trace trace; ss << "Attempted to " << (add ? "put" : "get") << " value with size: " << valueSize << " in ByteBuffer (pos: " << pos << " size: " << size - << ")\n\n" << trace.c_str(); + << ")"; message().assign(ss.str()); } @@ -40,12 +39,10 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, size_t valueSize) { std::ostringstream ss; - ACE_Stack_Trace trace; ss << "Attempted to put a " << (valueSize > 0 ? "NULL-pointer" : "zero-sized value") - << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n" - << trace.c_str(); + << " in ByteBuffer (pos: " << pos << " size: " << size << ")"; message().assign(ss.str()); } diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 906633a1254..418f6677e76 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -31,6 +31,7 @@ #include <vector> #include <cstring> #include <time.h> +#include <math.h> // Root of ByteBuffer exception hierarchy class ByteBufferException : public std::exception @@ -340,12 +341,16 @@ class ByteBuffer ByteBuffer &operator>>(float &value) { value = read<float>(); + if (!std::isfinite(value)) + throw ByteBufferException(); return *this; } ByteBuffer &operator>>(double &value) { value = read<double>(); + if (!std::isfinite(value)) + throw ByteBufferException(); return *this; } @@ -505,9 +510,19 @@ class ByteBuffer return *this; } - uint8 * contents() { return &_storage[0]; } + uint8 * contents() + { + if (_storage.empty()) + throw ByteBufferException(); + return &_storage[0]; + } - const uint8 *contents() const { return &_storage[0]; } + const uint8 *contents() const + { + if (_storage.empty()) + throw ByteBufferException(); + return &_storage[0]; + } size_t size() const { return _storage.size(); } bool empty() const { return _storage.empty(); } diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 0fa50c68203..bf70bdf406a 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -26,6 +26,7 @@ #include <string> #include <vector> #include <list> +#include <map> #include <ace/INET_Addr.h> // Searcher for map of structs @@ -567,4 +568,353 @@ bool CompareValues(ComparisionType type, T val1, T val2) } } +class EventMap +{ + /** + * Internal storage type. + * Key: Time as uint32 when the event should occur. + * Value: The event data as uint32. + * + * Structure of event data: + * - Bit 0 - 15: Event Id. + * - Bit 16 - 23: Group + * - Bit 24 - 31: Phase + * - Pattern: 0xPPGGEEEE + */ + typedef std::multimap<uint32, uint32> EventStore; + + public: + EventMap() : _time(0), _phase(0), _lastEvent(0) { } + + /** + * @name Reset + * @brief Removes all scheduled events and resets time and phase. + */ + void Reset() + { + _eventMap.clear(); + _time = 0; + _phase = 0; + } + + /** + * @name Update + * @brief Updates the timer of the event map. + * @param time Value to be added to time. + */ + void Update(uint32 time) + { + _time += time; + } + + /** + * @name GetTimer + * @return Current timer value. + */ + uint32 GetTimer() const + { + return _time; + } + + /** + * @name GetPhaseMask + * @return Active phases as mask. + */ + uint8 GetPhaseMask() const + { + return _phase; + } + + /** + * @name Empty + * @return True, if there are no events scheduled. + */ + bool Empty() const + { + return _eventMap.empty(); + } + + /** + * @name SetPhase + * @brief Sets the phase of the map (absolute). + * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase. + */ + void SetPhase(uint8 phase) + { + if (!phase) + _phase = 0; + else if (phase <= 8) + _phase = (1 << (phase - 1)); + } + + /** + * @name AddPhase + * @brief Activates the given phase (bitwise). + * @param phase Phase which should be activated. Values: 1 - 8 + */ + void AddPhase(uint8 phase) + { + if (phase && phase <= 8) + _phase |= (1 << (phase - 1)); + } + + /** + * @name RemovePhase + * @brief Deactivates the given phase (bitwise). + * @param phase Phase which should be deactivated. Values: 1 - 8. + */ + void RemovePhase(uint8 phase) + { + if (phase && phase <= 8) + _phase &= ~(1 << (phase - 1)); + } + + /** + * @name ScheduleEvent + * @brief Creates new event entry in map. + * @param eventId The id of the new event. + * @param time The time in milliseconds until the event occurs. + * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. + * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. + */ + void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0) + { + if (group && group <= 8) + eventId |= (1 << (group + 15)); + + if (phase && phase <= 8) + eventId |= (1 << (phase + 23)); + + _eventMap.insert(EventStore::value_type(_time + time, eventId)); + } + + /** + * @name RescheduleEvent + * @brief Cancels the given event and reschedules it. + * @param eventId The id of the event. + * @param time The time in milliseconds until the event occurs. + * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. + * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. + */ + void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0) + { + CancelEvent(eventId); + ScheduleEvent(eventId, time, group, phase); + } + + /** + * @name RepeatEvent + * @brief Repeats the mostly recently executed event. + * @param time Time until the event occurs. + */ + void Repeat(uint32 time) + { + _eventMap.insert(EventStore::value_type(_time + time, _lastEvent)); + } + + /** + * @name RepeatEvent + * @brief Repeats the mostly recently executed event. + * @param time Time until the event occurs. Equivalent to Repeat(urand(minTime, maxTime). + */ + void Repeat(uint32 minTime, uint32 maxTime) + { + Repeat(urand(minTime, maxTime)); + } + + /** + * @name ExecuteEvent + * @brief Returns the next event to execute and removes it from map. + * @return Id of the event to execute. + */ + uint32 ExecuteEvent() + { + while (!Empty()) + { + EventStore::iterator itr = _eventMap.begin(); + + if (itr->first > _time) + return 0; + else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase)) + _eventMap.erase(itr); + else + { + uint32 eventId = (itr->second & 0x0000FFFF); + _lastEvent = itr->second; // include phase/group + _eventMap.erase(itr); + return eventId; + } + } + + return 0; + } + + /** + * @name DelayEvents + * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0. + * @param delay Amount of delay. + */ + void DelayEvents(uint32 delay) + { + _time = delay < _time ? _time - delay : 0; + } + + /** + * @name DelayEvents + * @brief Delay all events of the same group. + * @param delay Amount of delay. + * @param group Group of the events. + */ + void DelayEvents(uint32 delay, uint32 group) + { + if (!group || group > 8 || Empty()) + return; + + EventStore delayed; + + for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) + { + if (itr->second & (1 << (group + 15))) + { + delayed.insert(EventStore::value_type(itr->first + delay, itr->second)); + _eventMap.erase(itr++); + } + else + ++itr; + } + + _eventMap.insert(delayed.begin(), delayed.end()); + } + + /** + * @name CancelEvent + * @brief Cancels all events of the specified id. + * @param eventId Event id to cancel. + */ + void CancelEvent(uint32 eventId) + { + if (Empty()) + return; + + for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) + { + if (eventId == (itr->second & 0x0000FFFF)) + _eventMap.erase(itr++); + else + ++itr; + } + } + + /** + * @name CancelEventGroup + * @brief Cancel events belonging to specified group. + * @param group Group to cancel. + */ + void CancelEventGroup(uint32 group) + { + if (!group || group > 8 || Empty()) + return; + + for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) + { + if (itr->second & (1 << (group + 15))) + _eventMap.erase(itr++); + else + ++itr; + } + } + + /** + * @name GetNextEventTime + * @brief Returns closest occurence of specified event. + * @param eventId Wanted event id. + * @return Time of found event. + */ + uint32 GetNextEventTime(uint32 eventId) const + { + if (Empty()) + return 0; + + for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr) + if (eventId == (itr->second & 0x0000FFFF)) + return itr->first; + + return 0; + } + + /** + * @name GetNextEventTime + * @return Time of next event. + */ + uint32 GetNextEventTime() const + { + return Empty() ? 0 : _eventMap.begin()->first; + } + + /** + * @name IsInPhase + * @brief Returns wether event map is in specified phase or not. + * @param phase Wanted phase. + * @return True, if phase of event map contains specified phase. + */ + bool IsInPhase(uint8 phase) + { + return phase <= 8 && (!phase || _phase & (1 << (phase - 1))); + } + + /** + * @name GetTimeUntilEvent + * @brief Returns time in milliseconds until next event. + * @param Id of the event. + * @return Time of next event. + */ + uint32 GetTimeUntilEvent(uint32 eventId) const + { + for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr) + if (eventId == (itr->second & 0x0000FFFF)) + return itr->first - _time; + + return std::numeric_limits<uint32>::max(); + } + + private: + /** + * @name _time + * @brief Internal timer. + * + * This does not represent the real date/time value. + * It's more like a stopwatch: It can run, it can be stopped, + * it can be resetted and so on. Events occur when this timer + * has reached their time value. Its value is changed in the + * Update method. + */ + uint32 _time; + + /** + * @name _phase + * @brief Phase mask of the event map. + * + * Contains the phases the event map is in. Multiple + * phases from 1 to 8 can be set with SetPhase or + * AddPhase. RemovePhase deactives a phase. + */ + uint8 _phase; + + /** + * @name _eventMap + * @brief Internal event storage map. Contains the scheduled events. + * + * See typedef at the beginning of the class for more + * details. + */ + EventStore _eventMap; + + + /** + * @name _lastEvent + * @brief Stores information on the most recently executed event + */ + uint32 _lastEvent; +}; + #endif diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index c5424374f5a..6e4214603cb 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -201,24 +201,24 @@ int Master::Run() ACE_Based::Thread rarThread(new RARunnable); #if defined(_WIN32) || defined(__linux__) - + ///- Handle affinity for multiple processors and process priority uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0); bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false); #ifdef _WIN32 // Windows - + HANDLE hProcess = GetCurrentProcess(); - + if (affinity > 0) { ULONG_PTR appAff; ULONG_PTR sysAff; - + if (GetProcessAffinityMask(hProcess, &appAff, &sysAff)) { ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors - + if (!currentAffinity) TC_LOG_ERROR("server.worldserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) @@ -227,7 +227,7 @@ int Master::Run() TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x", currentAffinity); } } - + if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) @@ -235,9 +235,9 @@ int Master::Run() else TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class."); } - + #else // Linux - + if (affinity > 0) { cpu_set_t mask; @@ -264,7 +264,7 @@ int Master::Run() else TC_LOG_INFO("server.worldserver", "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); } - + #endif #endif diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 9eafb68ca15..a4de6f92a8d 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -1114,7 +1114,7 @@ void ExtractDBCFiles(int l, bool basicLocale) } filename = foundFile.cFileName; - filename = outputPath + filename.substr(filename.rfind('\\')); + filename = outputPath + filename.substr(filename.rfind('\\') + 1); if (FileExists(filename.c_str())) continue; @@ -1161,7 +1161,7 @@ void ExtractDB2Files(int l, bool basicLocale) } filename = foundFile.cFileName; - filename = outputPath + filename.substr(filename.rfind('\\')); + filename = outputPath + filename.substr(filename.rfind('\\') + 1); if (ExtractFile(dbcFile, filename.c_str())) ++count; diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp index 19112d84266..7832cef18de 100644 --- a/src/tools/mmaps_generator/TerrainBuilder.cpp +++ b/src/tools/mmaps_generator/TerrainBuilder.cpp @@ -906,7 +906,7 @@ namespace MMAP float p0[3], p1[3]; uint32 mid, tx, ty; float size; - if (sscanf(buf, "%d %d,%d (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty, + if (sscanf(buf, "%u %u,%u (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty, &p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size) != 10) continue; |