diff options
35 files changed, 248 insertions, 115 deletions
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/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e7d14d68377..563d7fed107 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -144,6 +144,8 @@ enum CharacterCustomizeFlags static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 }; +uint32 const MAX_MONEY_AMOUNT = static_cast<uint32>(std::numeric_limits<int32>::max()); + // == PlayerTaxi ================================================ PlayerTaxi::PlayerTaxi() @@ -22645,7 +22647,7 @@ bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/) SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0); else { - if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount)) + if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount)) SetMoney(GetMoney() + amount); else { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 92691c3fd45..0826f533df7 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -29,6 +29,7 @@ #include "SpellMgr.h" #include "Unit.h" +#include <limits> #include <string> #include <vector> @@ -824,7 +825,8 @@ enum PlayerDelayedOperations // Player summoning auto-decline time (in secs) #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) -#define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) +// Maximum money amount : 2^31 - 1 +extern uint32 const MAX_MONEY_AMOUNT; struct InstancePlayerBind { diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index f448fbb9f19..db0a196dec6 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -754,7 +754,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]; } @@ -1760,7 +1760,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair) { //clamp amount to MAX_MONEY_AMOUNT, Players can't hold more than that anyway - amount = std::min(amount, uint32(MAX_MONEY_AMOUNT)); + amount = std::min(amount, MAX_MONEY_AMOUNT); if (m_bankMoney < amount) // Not enough money in bank return false; @@ -2581,7 +2581,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); @@ -2598,7 +2598,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 ebb1f9c8e57..278c180c380 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -260,7 +260,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) trans = CharacterDatabase.BeginTransaction(); // client limits the amount of players to be invited to 100 - const int MaxPlayerInvites = 100; + const uint32 MaxPlayerInvites = 100; for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i) { diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index 1fe4718d7ae..884c4a83b15 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -299,14 +299,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) return; } - if (_player->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - his_trade->GetMoney()) + if (_player->GetMoney() >= MAX_MONEY_AMOUNT - his_trade->GetMoney()) { _player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); my_trade->SetAccepted(false, true); return; } - if (trader->GetMoney() >= uint32(MAX_MONEY_AMOUNT) - my_trade->GetMoney()) + if (trader->GetMoney() >= MAX_MONEY_AMOUNT - my_trade->GetMoney()) { trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL); his_trade->SetAccepted(false, true); diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 3050443edc0..9e11c566c22 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -243,7 +243,7 @@ AI* GetInstanceAI(T* obj, char const* scriptName) return new AI(obj); return NULL; -}; +} template<class AI, class T> AI* GetInstanceAI(T* obj) @@ -253,6 +253,6 @@ AI* GetInstanceAI(T* obj) return new AI(obj); return NULL; -}; +} #endif // TRINITY_INSTANCE_DATA_H 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/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 f2f11801229..5dbe95b3e54 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1020,7 +1020,7 @@ public: } else { - if (newmoney > MAX_MONEY_AMOUNT) + if (newmoney > static_cast<int32>(MAX_MONEY_AMOUNT)) newmoney = MAX_MONEY_AMOUNT; handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str()); @@ -1035,10 +1035,7 @@ public: if (handler->needReportToTarget(target)) ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); - if (moneyToAdd >= MAX_MONEY_AMOUNT) - moneyToAdd = MAX_MONEY_AMOUNT; - - if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd) + if (targetMoney >= MAX_MONEY_AMOUNT - moneyToAdd) moneyToAdd -= targetMoney; target->ModifyMoney(moneyToAdd); 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/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index 8d6ae347b85..358814d440a 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -447,7 +447,7 @@ class spell_mount_check : public SpellScriptLoader class spell_mount_check_AuraScript : public AuraScript { - PrepareAuraScript(spell_mount_check_AuraScript) + PrepareAuraScript(spell_mount_check_AuraScript); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -495,7 +495,7 @@ class spell_voljin_war_drums : public SpellScriptLoader class spell_voljin_war_drums_SpellScript : public SpellScript { - PrepareSpellScript(spell_voljin_war_drums_SpellScript) + PrepareSpellScript(spell_voljin_war_drums_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -552,7 +552,7 @@ class spell_voodoo : public SpellScriptLoader class spell_voodoo_SpellScript : public SpellScript { - PrepareSpellScript(spell_voodoo_SpellScript) + PrepareSpellScript(spell_voodoo_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 3f4fb31a11d..42ab3d8d9cf 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 3f0fb2f93b1..192249955cf 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 77a4faa7e8c..4c72d790059 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -509,7 +509,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) { @@ -671,7 +671,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 { @@ -895,7 +895,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) { } @@ -1446,6 +1446,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) || @@ -1511,7 +1512,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 { @@ -1612,7 +1613,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 { @@ -2093,7 +2094,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) { @@ -2794,7 +2795,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*/) { @@ -2842,30 +2843,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; } } @@ -3123,7 +3122,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*/) { @@ -3615,7 +3614,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 590cad7007f..61ff79c505e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -775,7 +775,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 { 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 bc46b87fa27..dd0a9d5fdf4 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -377,9 +377,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; |
