diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-05-18 19:40:30 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-05-18 19:40:30 +0200 |
commit | ef5bc9c70a6b50e1244a91fb922ecab455f6966f (patch) | |
tree | c018aa80719c1050314e67d9a5a8d5b2e173232a | |
parent | a3793b1741a6ff8cb71c858d12f8de6ca259f338 (diff) | |
parent | 7228bd3664d9fa6a808e338a2fb2f519a6370672 (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Entities/Player/Player.cpp
src/server/game/Entities/Player/Player.h
src/server/game/Guilds/Guild.cpp
src/server/game/Handlers/TradeHandler.cpp
src/server/scripts/Commands/cs_modify.cpp
src/server/scripts/Kalimdor/zone_durotar.cpp
41 files changed, 462 insertions, 130 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/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp index bb278dd6653..55517884b8e 100644 --- a/src/server/authserver/Authentication/AuthCodes.cpp +++ b/src/server/authserver/Authentication/AuthCodes.cpp @@ -79,4 +79,4 @@ namespace AuthHelper return NULL; } -}; +} diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h index 5e6522f8981..97b4779da0e 100644 --- a/src/server/authserver/Authentication/AuthCodes.h +++ b/src/server/authserver/Authentication/AuthCodes.h @@ -92,6 +92,6 @@ namespace AuthHelper bool IsAcceptedClientBuild(int build); bool IsPostBCAcceptedClientBuild(int build); bool IsPreBCAcceptedClientBuild(int build); -}; +} #endif diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 098f3130fed..e769b7c22a5 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -618,10 +618,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/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/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index acfc8da9bc8..b55df9eb024 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2a8217d2028..a8434bb515e 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() @@ -23250,7 +23252,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 { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index e417d24f793..2f210b5f9f8 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> @@ -902,7 +903,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 { 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/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/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6ec5e5d5f8f..c2876a2536e 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; 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/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/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 83b716728ea..354e1204a50 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -212,4 +212,4 @@ void AddSC_boss_balinda() { new boss_balinda; new npc_water_elemental; -}; +} diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 010e06d67cb..870ae370366 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 { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 5562559786d..28bb24f49a9 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()); } } } diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 3dd2419de4a..74a7900b023 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1006,7 +1006,7 @@ void npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) 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/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_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 00eb970b57b..5fa52c1eb53 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -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/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 2570a44b0a0..169d942e536 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -1810,7 +1810,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 +2282,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 +2348,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/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/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_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/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/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index c60458323f7..3665a388854 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); @@ -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/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.h b/src/server/shared/Packets/ByteBuffer.h index 906633a1254..e1ff495a50b 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -505,9 +505,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/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; |