aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2012_09_20_00_world_creature_loot_template.sql5
-rw-r--r--sql/updates/world/2012_09_30_03_world_creature_text.sql18
-rwxr-xr-xsrc/server/authserver/Main.cpp15
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.h3
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.cpp7
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp23
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.h1
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp65
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp4
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp2
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp4
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp2
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp4
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp16
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp2
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp48
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp4
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp40
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h12
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp20
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp32
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp336
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h4
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp12
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp8
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/MiscHandler.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp2
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp1
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp36
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp6
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp12
-rwxr-xr-xsrc/server/game/Spells/Spell.h4
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp64
-rw-r--r--src/server/game/Spells/SpellInfo.cpp6
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp4
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp4
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp12
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp214
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp43
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp12
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp35
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp16
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp4
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp2
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp16
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp10
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp6
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp2
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp2
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp44
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp6
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp2
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp10
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp6
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp6
-rw-r--r--src/server/scripts/World/npcs_special.cpp4
-rwxr-xr-xsrc/server/shared/CompilerDefs.h10
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.h2
-rw-r--r--src/server/shared/Dynamic/HashNamespace.h119
-rwxr-xr-xsrc/server/shared/Dynamic/LinkedList.h16
-rwxr-xr-xsrc/server/shared/Dynamic/LinkedReference/Reference.h13
-rwxr-xr-xsrc/server/shared/Dynamic/ObjectRegistry.h3
-rwxr-xr-xsrc/server/shared/Dynamic/UnorderedMap.h83
-rw-r--r--src/server/shared/Dynamic/UnorderedSet.h66
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp8
-rwxr-xr-xsrc/server/shared/Utilities/ByteConverter.h4
-rwxr-xr-xsrc/server/shared/Utilities/EventProcessor.h7
-rwxr-xr-xsrc/server/shared/Utilities/Util.cpp40
-rwxr-xr-xsrc/server/shared/Utilities/Util.h346
79 files changed, 1094 insertions, 947 deletions
diff --git a/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql b/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql
new file mode 100644
index 00000000000..8463b064bf9
--- /dev/null
+++ b/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql
@@ -0,0 +1,5 @@
+SET @exists = (SELECT 1 FROM `creature_loot_template` WHERE `entry`=100002);
+DELETE FROM `creature_loot_template` WHERE `entry`=100002 AND @exists = 1;
+DELETE FROM `creature_loot_template` WHERE `mincountOrRef`=-35069 AND @exists = 1;
+INSERT INTO `creature_loot_template`(`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) SELECT `entry`,1,100,1,0,-35069,2 FROM `creature_template` WHERE `lootid` = 100002 AND @exists = 1; -- 2 selection from reference
+UPDATE `creature_template` SET `lootid`=`entry` WHERE `lootid` = 100002 AND @exists = 1;
diff --git a/sql/updates/world/2012_09_30_03_world_creature_text.sql b/sql/updates/world/2012_09_30_03_world_creature_text.sql
new file mode 100644
index 00000000000..a591f8cfb7c
--- /dev/null
+++ b/sql/updates/world/2012_09_30_03_world_creature_text.sql
@@ -0,0 +1,18 @@
+-- AzjolNerub/Ahnkahet/Jedoga Shadowseeker
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619013 AND -1619000;
+DELETE FROM `creature_text` WHERE `entry`=29310;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(29310, 0, 0, 'These are sacred halls! Your intrusion will be met with death!', 14, 0, 100, 0, 0, 14343, 'SAY_AGGRO'),
+(29310, 1, 0, 'Who among you is devoted?', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_1'),
+(29310, 1, 1, 'You there! Step forward!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_2'),
+(29310, 2, 0, 'Yogg-Saron, grant me your power!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_1'),
+(29310, 2, 1, 'Master, a gift for you!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_2'),
+(29310, 3, 0, 'Glory to Yogg-Saron!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_1'),
+(29310, 3, 1, 'You are unworthy!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_2'),
+(29310, 3, 2, 'Get up! You haven''t suffered enough.', 14, 0, 100, 0, 0, 14350, 'SAY_SLAY_3'),
+(29310, 4, 0, 'Do not expect your sacrilege... to go unpunished.', 14, 0, 100, 0, 0, 0, 'SAY_DEATH'),
+(29310, 5, 0, 'The elements themselves will rise up against the civilized world! Only the faithful will be spared!', 14, 0, 100, 0, 0, 14352, 'SAY_PREACHING_1'),
+(29310, 5, 1, 'Immortality can be yours, but only if you pledge yourself fully to Yogg-Saron!', 14, 0, 100, 0, 0, 14353, 'SAY_PREACHING_2'),
+(29310, 5, 2, 'Here, on the very borders of his domain, you will experience power you could have never imagined!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_3'),
+(29310, 5, 3, 'You have traveled long and risked much to be here! Your devotion shall be rewarded.', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_4'),
+(29310, 5, 4, 'The faithful shall be exalted! But there is more work to be done. We will press on until all of Azeroth lies beneath his shadow!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_5');
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index ed0fa9ab06a..011210dd95b 100755
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -15,7 +15,13 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+/**
+* @file main.cpp
+* @brief Authentication Server main program
+*
+* This file contains the main program for the
+* authentication server
+*/
#include <ace/Dev_Poll_Reactor.h>
#include <ace/TP_Reactor.h>
#include <ace/ACE.h>
@@ -44,7 +50,7 @@ bool stopEvent = false; // Setting it to tru
LoginDatabaseWorkerPool LoginDatabase; // Accessor to the auth server database
-// Handle authserver's termination signals
+/// Handle authserver's termination signals
class AuthServerSignalHandler : public Trinity::SignalHandler
{
public:
@@ -68,7 +74,7 @@ void usage(const char *prog)
prog);
}
-// Launch the auth server
+/// Launch the auth server
extern int main(int argc, char **argv)
{
// Command line parsing to get the configuration file name
@@ -232,7 +238,7 @@ extern int main(int argc, char **argv)
return 0;
}
-// Initialize connection to the database
+/// Initialize connection to the database
bool StartDB()
{
MySQL::Library_Init();
@@ -270,6 +276,7 @@ bool StartDB()
return true;
}
+/// Close the connection to the database
void StopDB()
{
LoginDatabase.Close();
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 119cfd3d35e..89359372355 100755
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -20,8 +20,9 @@
#define TRINITY_UNITAI_H
#include "Define.h"
-#include <list>
#include "Unit.h"
+#include "Containers.h"
+#include <list>
class Unit;
class Player;
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 8076f800356..b666add74b3 100755
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -16,8 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
#include "AccountMgr.h"
+#include "DatabaseEnv.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Util.h"
@@ -274,10 +274,7 @@ std::string CalculateShaPassHash(std::string& name, std::string& password)
sha.UpdateData(password);
sha.Finalize();
- std::string encoded;
- hexEncodeByteArray(sha.GetDigest(), sha.GetLength(), encoded);
-
- return encoded;
+ return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
}
bool IsPlayerAccount(uint32 gmlevel)
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 940f1f8beb7..d580df63700 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -71,7 +71,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
if (MSV <= 0)
return AH_MINIMUM_DEPOSIT;
- float multiplier = CalculatePctN(float(entry->depositPercent), 3);
+ float multiplier = CalculatePct(float(entry->depositPercent), 3);
uint32 timeHr = (((time / 60) / 60) / 12);
uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT));
@@ -635,14 +635,14 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
uint32 AuctionEntry::GetAuctionCut() const
{
- int32 cut = int32(CalculatePctU(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
+ int32 cut = int32(CalculatePct(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
return std::max(cut, 0);
}
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
uint32 AuctionEntry::GetAuctionOutBid() const
{
- uint32 outbid = CalculatePctN(bid, 5);
+ uint32 outbid = CalculatePct(bid, 5);
return outbid ? outbid : 1;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index e91c5122604..6de4bc8fbd0 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -364,6 +364,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
}
+
if (capturedNodes >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
if (capturedNodes >= 4)
@@ -552,14 +553,14 @@ bool BattlegroundAB::SetupBattleground()
{
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
)
{
sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!");
@@ -576,9 +577,9 @@ bool BattlegroundAB::SetupBattleground()
//buffs
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
)
sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!");
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 870b3965522..a7ec4ad700f 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -306,4 +306,3 @@ class BattlegroundAB : public Battleground
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
};
#endif
-
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index aeebfb945f9..0ebe6611042 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -16,11 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "BattlegroundAV.h"
+
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "Battleground.h"
-#include "BattlegroundAV.h"
#include "Miscellaneous/Formulas.h"
#include "GameObject.h"
#include "Miscellaneous/Language.h"
@@ -1193,9 +1194,9 @@ bool BattlegroundAV::SetupBattleground()
// Create starting objects
if (
// alliance gates
- !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3]/2), cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
+ !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
// horde gates
- || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
+ || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
{
sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
@@ -1206,14 +1207,14 @@ bool BattlegroundAV::SetupBattleground()
{
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
{
- if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
//aura
- || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
+ || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
@@ -1223,12 +1224,12 @@ bool BattlegroundAV::SetupBattleground()
{
if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
{
- if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
@@ -1236,12 +1237,12 @@ bool BattlegroundAV::SetupBattleground()
}
else //horde towers
{
- if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
@@ -1249,7 +1250,7 @@ bool BattlegroundAV::SetupBattleground()
}
for (uint8 j=0; j <= 9; j++) //burning aura
{
- if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
return false;
@@ -1263,7 +1264,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (j<5)
{
- if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
return false;
@@ -1271,7 +1272,7 @@ bool BattlegroundAV::SetupBattleground()
}
else
{
- if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
return false;
@@ -1281,7 +1282,7 @@ bool BattlegroundAV::SetupBattleground()
}
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
{
- if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
return false;
@@ -1289,24 +1290,24 @@ bool BattlegroundAV::SetupBattleground()
}
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
- if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
return false;
}
}
- if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
{
- if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index c3845f16826..579f322594a 100755
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -69,8 +69,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
if (db_BannedList)
{
- Tokens tokens(db_BannedList, ' ');
- Tokens::iterator iter;
+ Tokenizer tokens(db_BannedList, ' ');
+ Tokenizer::const_iterator iter;
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint64 banned_guid = atol(*iter);
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 87853a53b6c..cd6b9a7da60 100755
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -158,7 +158,7 @@ void HostileReference::addThreat(float modThreat)
void HostileReference::addThreatPercent(int32 percent)
{
float tmpThreat = iThreat;
- AddPctN(tmpThreat, percent);
+ AddPct(tmpThreat, percent);
addThreat(tmpThreat - iThreat);
}
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 27695f3eafa..9b065729b88 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -100,14 +100,14 @@ void LoadDisables()
if (flags & SPELL_DISABLE_MAP)
{
- Tokens tokens(params_0, ',');
+ Tokenizer tokens(params_0, ',');
for (uint8 i = 0; i < tokens.size(); )
data.params[0].insert(atoi(tokens[i++]));
}
if (flags & SPELL_DISABLE_AREA)
{
- Tokens tokens(params_1, ',');
+ Tokenizer tokens(params_1, ',');
for (uint8 i = 0; i < tokens.size(); )
data.params[1].insert(atoi(tokens[i++]));
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 618032e5f97..3a75066fa2d 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -18,7 +18,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "DBCStores.h"
-
+#include "Containers.h"
#include "DisableMgr.h"
#include "ObjectMgr.h"
#include "SocialMgr.h"
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index b92c3048b45..305168881a5 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -630,7 +630,7 @@ void Creature::RegenerateMana()
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetMiscValue() == POWER_MANA)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
@@ -667,7 +667,7 @@ void Creature::RegenerateHealth()
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 8823a788555..c9d1944af09 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -225,8 +225,8 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
float angle = itr->second->follow_angle;
float dist = itr->second->follow_dist;
- float dx = x + cos(angle + pathangle) * dist;
- float dy = y + sin(angle + pathangle) * dist;
+ float dx = x + std::cos(angle + pathangle) * dist;
+ float dy = y + std::sin(angle + pathangle) * dist;
float dz = z;
Trinity::NormalizeMapCoord(dx);
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index c28ff21bfa5..c4d42f7a537 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1153,8 +1153,8 @@ void GameObject::Use(Unit* user)
// the distance between this slot and the center of the go - imagine a 1D space
float relativeDistance = (info->size*itr->first)-(info->size*(info->chair.slots-1)/2.0f);
- float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
- float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
+ float x_i = GetPositionX() + relativeDistance * std::cos(orthogonalOrientation);
+ float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation);
if (itr->second)
{
@@ -1701,8 +1701,8 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
if (!info)
return IsWithinDist3d(x, y, z, radius);
- float sinA = sin(GetOrientation());
- float cosA = cos(GetOrientation());
+ float sinA = std::sin(GetOrientation());
+ float cosA = std::cos(GetOrientation());
float dx = x - GetPositionX();
float dy = y - GetPositionY();
float dz = z - GetPositionZ();
@@ -1751,17 +1751,17 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
{
static double const atan_pow = atan(pow(2.0f, -20.0f));
- double f_rot1 = sin(GetOrientation() / 2.0f);
- double f_rot2 = cos(GetOrientation() / 2.0f);
+ double f_rot1 = std::sin(GetOrientation() / 2.0f);
+ double f_rot2 = std::cos(GetOrientation() / 2.0f);
int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f));
int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF;
- //float f_rot2 = sin(0.0f / 2.0f);
+ //float f_rot2 = std::sin(0.0f / 2.0f);
//int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f));
//rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000;
- //float f_rot3 = sin(0.0f / 2.0f);
+ //float f_rot3 = std::sin(0.0f / 2.0f);
//int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f));
//rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000;
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 58cc1d027a3..f1a7d646fe4 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -424,7 +424,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
need_save = true;
}
- Tokens tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
+ Tokenizer tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i, atoi(tokens[i]));
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index cbdae9de0bf..8647e6ddb4f 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -772,7 +772,7 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
if (!data)
return;
- Tokens tokens(data, ' ', count);
+ Tokenizer tokens(data, ' ', count);
if (tokens.size() != count)
return;
@@ -1511,8 +1511,8 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
void Position::RelocateOffset(const Position & offset)
{
- m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * sin(GetOrientation() + M_PI));
- m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * sin(GetOrientation()));
+ m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
+ m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
m_orientation = GetOrientation() + offset.GetOrientation();
}
@@ -1522,8 +1522,8 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset
float dx = endPos.GetPositionX() - GetPositionX();
float dy = endPos.GetPositionY() - GetPositionY();
- retOffset.m_positionX = dx * cos(GetOrientation()) + dy * sin(GetOrientation());
- retOffset.m_positionY = dy * cos(GetOrientation()) - dx * sin(GetOrientation());
+ retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
+ retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.m_orientation = endPos.GetOrientation() - GetOrientation();
}
@@ -1555,8 +1555,8 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
{
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
- vcos = cos(angle);
- vsin = sin(angle);
+ vcos = std::cos(angle);
+ vsin = std::sin(angle);
}
else
{
@@ -1605,7 +1605,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
float angle = obj1->GetAngle(obj2);
// not using sqrt() for performance
- return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist);
+ return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist);
}
bool WorldObject::isInFront(WorldObject const* target, float arc) const
@@ -1630,8 +1630,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
float new_dist = (float)rand_norm()*static_cast<float>(distance);
- rand_x = pos.m_positionX + new_dist * cos(angle);
- rand_y = pos.m_positionY + new_dist * sin(angle);
+ rand_x = pos.m_positionX + new_dist * std::cos(angle);
+ rand_y = pos.m_positionY + new_dist * std::sin(angle);
rand_z = pos.m_positionZ;
Trinity::NormalizeMapCoord(rand_x);
@@ -2649,8 +2649,8 @@ namespace Trinity
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const
{
- x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle);
- y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle);
+ x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
+ y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
@@ -2785,8 +2785,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
{
angle += m_orientation;
float destx, desty, destz, ground, floor;
- destx = pos.m_positionX + dist * cos(angle);
- desty = pos.m_positionY + dist * sin(angle);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
@@ -2806,8 +2806,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
@@ -2831,8 +2831,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
angle += m_orientation;
float destx, desty, destz, ground, floor;
pos.m_positionZ += 2.0f;
- destx = pos.m_positionX + dist * cos(angle);
- desty = pos.m_positionY + dist * sin(angle);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
@@ -2851,8 +2851,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
if (col)
{
// move back a bit
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2862,8 +2862,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// Collided with a gameobject
if (col)
{
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2874,8 +2874,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index ead018ac620..283f2032ab0 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -663,7 +663,7 @@ void Creature::Regenerate(Powers power)
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if (Powers((*i)->GetMiscValue()) == power)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
@@ -1979,7 +1979,7 @@ void Pet::CastPetAura(PetAura const* aura)
if (auraId == 35696) // Demonic Knowledge
{
- int32 basePoints = CalculatePctF(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
+ int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
}
else
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 836ea09f727..c41436e1947 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -192,10 +192,10 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
void PlayerTaxi::LoadTaxiMask(const char* data)
{
- Tokens tokens(data, ' ');
+ Tokenizer tokens(data, ' ');
uint8 index;
- Tokens::iterator iter;
+ Tokenizer::const_iterator iter;
for (iter = tokens.begin(), index = 0;
(index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
{
@@ -222,9 +222,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
{
ClearTaxiDestinations();
- Tokens tokens(values, ' ');
+ Tokenizer tokens(values, ' ');
- for (Tokens::iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
+ for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint32 node = uint32(atol(*iter));
AddTaxiDestination(node);
@@ -520,7 +520,7 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
// 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
Unit::AuraEffectList const& auras = player->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
- AddPctN(xp, (*i)->GetAmount());
+ AddPct(xp, (*i)->GetAmount());
// 4.2.3. Give XP to player.
player->GiveXP(xp, _victim, _groupRate);
@@ -1325,7 +1325,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
int32 UnderWaterTime = 3 * MINUTE * IN_MILLISECONDS;
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
- AddPctN(UnderWaterTime, (*i)->GetAmount());
+ AddPct(UnderWaterTime, (*i)->GetAmount());
return UnderWaterTime;
}
case FIRE_TIMER:
@@ -1975,7 +1975,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
*data << uint32(petLevel);
*data << uint32(petFamily);
- Tokens equipment(fields[19].GetString(), ' ');
+ Tokenizer equipment(fields[19].GetString(), ' ');
for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
{
uint32 visualBase = slot * 2;
@@ -2540,7 +2540,7 @@ void Player::Regenerate(Powers power)
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if (Powers((*i)->GetMiscValue()) == power)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
// Butchery requires combat for this effect
if (power != POWER_RUNIC_POWER || isInCombat())
@@ -2620,12 +2620,12 @@ void Player::RegenerateHealth()
{
AuraEffectList const& mModHealthRegenPct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILLISECONDS / (5 * IN_MILLISECONDS);
}
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
- ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
+ ApplyPct(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
if (!IsStandState())
addvalue *= 1.5f;
@@ -5503,8 +5503,8 @@ void Player::RepopAtGraveyard()
ClosestGrave = bg->GetClosestGraveYard(this);
else
{
- if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
- ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = bf->GetClosestGraveYard(this);
else
ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
}
@@ -5947,7 +5947,7 @@ void Player::UpdateRating(CombatRating cr)
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
if ((*i)->GetMiscValue() & (1<<cr))
- amount += int32(CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
+ amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
if (amount < 0)
amount = 0;
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
@@ -7187,7 +7187,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
honor_f /= groupsize;
// apply honor multiplier from aura (not stacking-get highest)
- AddPctN(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
+ AddPct(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
}
honor_f *= sWorld->getRate(RATE_HONOR);
@@ -15146,7 +15146,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
- AddPctN(XP, (*i)->GetAmount());
+ AddPct(XP, (*i)->GetAmount());
int32 moneyRew = 0;
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -16691,7 +16691,7 @@ void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
CharacterDatabase.Execute(stmt);
}
-uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
+uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index)
{
if (index >= data.size())
return 0;
@@ -16699,7 +16699,7 @@ uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
return (uint32)atoi(data[index]);
}
-float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
+float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
{
float result;
uint32 temp = Player::GetUInt32ValueFromArray(data, index);
@@ -17742,9 +17742,9 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
std::string strGUID = (*result)[0].GetString();
- Tokens GUIDlist(strGUID, ' ');
+ Tokenizer GUIDlist(strGUID, ' ');
AllowedLooterSet looters;
- for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
+ for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
looters.insert(atol(*itr));
item->SetSoulboundTradeable(looters);
AddTradeableItem(item);
@@ -19604,7 +19604,7 @@ void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o,
CharacterDatabase.Execute(stmt);
}
-void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value)
+void Player::SetUInt32ValueInArray(Tokenizer& tokens, uint16 index, uint32 value)
{
char buf[11];
snprintf(buf, 11, "%u", value);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 82e91985b04..5670ca05a85 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -36,8 +36,6 @@
#include "Unit.h"
#include "Util.h" // for Tokens typedef
#include "WorldSession.h"
-
-// for template
#include "SpellMgr.h"
#include<string>
@@ -1518,8 +1516,8 @@ class Player : public Unit, public GridObject<Player>
bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
void Initialize(uint32 guid);
- static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
- static float GetFloatValueFromArray(Tokens const& data, uint16 index);
+ static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
+ static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
static uint32 GetZoneIdFromDB(uint64 guid);
static uint32 GetLevelFromDB(uint64 guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
@@ -1534,8 +1532,8 @@ class Player : public Unit, public GridObject<Player>
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
void SaveGoldToDB(SQLTransaction& trans);
- static void SetUInt32ValueInArray(Tokens& data, uint16 index, uint32 value);
- static void SetFloatValueInArray(Tokens& data, uint16 index, float value);
+ static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
+ static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value);
static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
@@ -2918,7 +2916,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
continue;
- totalmul += CalculatePctN(1.0f, mod->value);
+ totalmul += CalculatePct(1.0f, mod->value);
}
DropModCharge(mod, spell);
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 558fdd72a95..e7084353491 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -646,8 +646,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
creature->Relocate(
- GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
- GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
+ GetPositionX() + (x * std::cos(GetOrientation()) + y * std::sin(GetOrientation() + float(M_PI))),
+ GetPositionY() + (y * std::cos(GetOrientation()) + x * std::sin(GetOrientation())),
z + GetPositionZ(),
o + GetOrientation());
@@ -680,8 +680,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
void Transport::UpdatePosition(MovementInfo* mi)
{
float transport_o = mi->pos.m_orientation - mi->t_pos.m_orientation;
- float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * cos(transport_o) - mi->t_pos.m_positionY*sin(transport_o));
- float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * cos(transport_o) + mi->t_pos.m_positionX*sin(transport_o));
+ float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY* std::sin(transport_o));
+ float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX* std::sin(transport_o));
float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;
Relocate(transport_x, transport_y, transport_z, transport_o);
@@ -708,8 +708,8 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float&
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
- x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation());
- y = GetPositionY() + iny * cos(GetOrientation()) + inx * sin(GetOrientation());
+ x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation());
+ y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation());
z = GetPositionZ() + inz;
}
@@ -717,9 +717,9 @@ void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetOrientation();
z -= GetPositionZ();
- y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
- x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
+ x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
- x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
+ y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
+ x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
}
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5cec0cf4375..8c0bfb8af23 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -213,7 +213,7 @@ void Player::UpdateArmor()
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
{
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- value += CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
+ value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
@@ -359,7 +359,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
switch (aurEff->GetEffIndex())
{
case 0: // Predatory Strikes (effect 0)
- mLevelMult = CalculatePctN(1.0f, aurEff->GetAmount());
+ mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
break;
case 1: // Predatory Strikes (effect 1)
if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
@@ -369,7 +369,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
if (!proto)
continue;
- weapon_bonus = CalculatePctN(float(proto->getFeralBonus()), aurEff->GetAmount());
+ weapon_bonus = CalculatePct(float(proto->getFeralBonus()), aurEff->GetAmount());
}
break;
default:
@@ -421,14 +421,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
{
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
- attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
+ attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
}
}
else
{
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
- attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
+ attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
@@ -856,7 +856,7 @@ void Player::UpdateManaRegen()
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
if (modManaRegenInterrupt > 100)
modManaRegenInterrupt = 100;
- SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePctN(power_regen, modManaRegenInterrupt));
+ SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
}
@@ -1098,12 +1098,12 @@ bool Guardian::UpdateStats(Stats stat)
if (aurEff)
{
SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
if (aurEff)
- mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
ownersBonus = float(owner->GetStat(stat)) * mod;
value += ownersBonus;
}
@@ -1111,7 +1111,7 @@ bool Guardian::UpdateStats(Stats stat)
{
if (owner->getClass() == CLASS_WARLOCK && isPet())
{
- ownersBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+ ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
value += ownersBonus;
}
else
@@ -1126,7 +1126,7 @@ bool Guardian::UpdateStats(Stats stat)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
}
ownersBonus = float(owner->GetStat(stat)) * mod;
@@ -1138,7 +1138,7 @@ bool Guardian::UpdateStats(Stats stat)
{
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
- ownersBonus = CalculatePctN(owner->GetStat(stat), 30);
+ ownersBonus = CalculatePct(owner->GetStat(stat), 30);
value += ownersBonus;
}
}
@@ -1190,7 +1190,7 @@ void Guardian::UpdateResistances(uint32 school)
// hunter and warlock pets gain 40% of owner's resistance
if (isPet())
- value += float(CalculatePctN(m_owner->GetResistance(SpellSchools(school)), 40));
+ value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));
SetResistance(SpellSchools(school), int32(value));
}
@@ -1206,7 +1206,7 @@ void Guardian::UpdateArmor()
// hunter and warlock pets gain 35% of owner's armor value
if (isPet())
- bonus_armor = float(CalculatePctN(m_owner->GetArmor(), 35));
+ bonus_armor = float(CalculatePct(m_owner->GetArmor(), 35));
value = GetModifierValue(unitMod, BASE_VALUE);
value *= GetModifierValue(unitMod, BASE_PCT);
@@ -1296,7 +1296,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
+ mod += CalculatePct(1.0f, sProto->Effects[1].CalcValue());
}
}
@@ -1414,8 +1414,8 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
case 61682:
case 61683:
- AddPctN(mindamage, -(*itr)->GetAmount());
- AddPctN(maxdamage, -(*itr)->GetAmount());
+ AddPct(mindamage, -(*itr)->GetAmount());
+ AddPct(maxdamage, -(*itr)->GetAmount());
break;
default:
break;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 0a3876c6946..550f4131c27 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -591,7 +591,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
continue;
SpellInfo const* spell = (*i)->GetSpellInfo();
- uint32 share = CalculatePctN(damage, (*i)->GetAmount());
+ uint32 share = CalculatePct(damage, (*i)->GetAmount());
// TODO: check packets if damage is done by victim, or by attacker of victim
DealDamageMods(shareDamageTarget, share, NULL);
@@ -1000,7 +1000,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
if (critPctDamageMod != 0)
- AddPctF(damage, critPctDamageMod);
+ AddPct(damage, critPctDamageMod);
}
// Spell weapon based damage CAN BE crit & blocked at same time
@@ -1189,7 +1189,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
// Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
if (mod != 0)
- AddPctF(damageInfo->damage, mod);
+ AddPct(damageInfo->damage, mod);
break;
}
case MELEE_HIT_PARRY:
@@ -1457,14 +1457,14 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
&& (*j)->IsAffectedOnSpell(spellInfo))
- armor = floor(AddPctN(armor, -(*j)->GetAmount()));
+ armor = floor(AddPct(armor, -(*j)->GetAmount()));
}
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- armor = floor(AddPctN(armor, -(*j)->GetAmount()));
+ armor = floor(AddPct(armor, -(*j)->GetAmount()));
}
// Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
@@ -1497,7 +1497,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
// Cap armor penetration to this number
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
// Figure out how much armor do we ignore
- float armorPen = CalculatePctF(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
+ float armorPen = CalculatePct(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
// Got the value, apply it
armor -= std::min(armorPen, maxArmorPen);
}
@@ -1581,12 +1581,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
AuraEffectList const& ResIgnoreAurasAb = GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo))
- AddPctN(damageResisted, -(*j)->GetAmount());
+ AddPct(damageResisted, -(*j)->GetAmount());
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
if ((*j)->GetMiscValue() & schoolMask)
- AddPctN(damageResisted, -(*j)->GetAmount());
+ AddPct(damageResisted, -(*j)->GetAmount());
dmgInfo.ResistDamage(uint32(damageResisted));
}
@@ -1647,7 +1647,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
continue;
// Apply absorb mod auras
- AddPctF(currentAbsorb, -auraAbsorbMod);
+ AddPct(currentAbsorb, -auraAbsorbMod);
// absorb must be smaller than the damage itself
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
@@ -1697,7 +1697,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (defaultPrevented)
continue;
- AddPctF(currentAbsorb, -auraAbsorbMod);
+ AddPct(currentAbsorb, -auraAbsorbMod);
// absorb must be smaller than the damage itself
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
@@ -1783,7 +1783,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->isAlive())
continue;
- uint32 splitDamage = CalculatePctN(dmgInfo.GetDamage(), (*itr)->GetAmount());
+ uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
(*itr)->GetBase()->CallScriptEffectSplitHandlers((*itr), aurApp, dmgInfo, splitDamage);
@@ -2159,7 +2159,7 @@ float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const
if (LvlFactor > 1.0f)
LvlFactor = 1.0f;
- return AddPctF(LvlFactor, -LvlPenalty);
+ return AddPct(LvlFactor, -LvlPenalty);
}
void Unit::SendMeleeAttackStart(Unit* victim)
@@ -4337,7 +4337,7 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
return multiplier;
}
@@ -4399,12 +4399,12 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask
// Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
// If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
}
// Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -4466,11 +4466,11 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu
{
if ((*i)->GetMiscValue() == misc_value)
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -4532,11 +4532,11 @@ float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo cons
{
if ((*i)->IsAffectedOnSpell(affectedSpell))
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -5084,7 +5084,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 25988:
{
// return damage % to attacker but < 50% own total health
- basepoints0 = int32(std::min(CalculatePctN(damage, triggerAmount), CountPctFromMaxHealth(50)));
+ basepoints0 = int32(std::min(CalculatePct(damage, triggerAmount), CountPctFromMaxHealth(50)));
triggered_spell_id = 25997;
break;
}
@@ -5536,7 +5536,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 71875: // Item - Black Bruise: Necrotic Touch Proc
case 71877:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 71879;
break;
}
@@ -5596,7 +5596,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Essence of the Blood Queen
case 70871:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
CastCustomSpell(70872, SPELLVALUE_BASE_POINT0, basepoints0, this);
return true;
}
@@ -5615,7 +5615,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Dark Hunger (The Lich King encounter)
case 69383:
{
- basepoints0 = CalculatePctN(int32(damage), 50);
+ basepoints0 = CalculatePct(int32(damage), 50);
triggered_spell_id = 69384;
break;
}
@@ -5631,7 +5631,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// mana reward
- basepoints0 = CalculatePctN(int32(GetMaxPower(POWER_MANA)), triggerAmount);
+ basepoints0 = CalculatePct(int32(GetMaxPower(POWER_MANA)), triggerAmount);
target = this;
triggered_spell_id = 29442;
break;
@@ -5643,8 +5643,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// mana cost save
- int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, triggerAmount);
+ int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -5698,8 +5698,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell)
return false;
- int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, triggerAmount);
+ int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
triggered_spell_id = 44450;
@@ -5782,7 +5782,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!victim)
return false;
- basepoints0 = int32(CalculatePctN(damage, 15));
+ basepoints0 = int32(CalculatePct(damage, 15));
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
{
// The shield can grow to a maximum size of 20, 000 damage absorbtion
@@ -5880,7 +5880,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
triggered_spell_id = 59653;
// % of amount blocked
- basepoints0 = CalculatePctN(int32(GetShieldBlockValue()), triggerAmount);
+ basepoints0 = CalculatePct(int32(GetShieldBlockValue()), triggerAmount);
break;
}
// Glyph of Blocking
@@ -5959,7 +5959,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = GetGuardianPet();
if (!target)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 54181;
break;
}
@@ -5975,7 +5975,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggerAmount += triggerAmount / 4;
triggered_spell_id = 63106;
target = this;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Glyph of Shadowflame
@@ -6029,7 +6029,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
}
// health
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 30294;
break;
@@ -6048,7 +6048,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 37382;
break;
}
@@ -6101,7 +6101,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (AuraEffect const* aurEff = target->GetAuraEffect(47753, 0))
bonus = aurEff->GetAmount();
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) + bonus;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) + bonus;
if (basepoints0 > target->getLevel() * 125)
basepoints0 = target->getLevel() * 125;
@@ -6127,7 +6127,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- int32 total = CalculatePctN(int32(damage), triggerAmount);
+ int32 total = CalculatePct(int32(damage), triggerAmount);
int32 team = total / 5;
int32 self = total - team;
CastCustomSpell(this, 15290, &team, &self, NULL, true, castItem, triggeredByAura);
@@ -6170,7 +6170,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!tickcount)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / tickcount;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / tickcount;
break;
}
// Improved Shadowform
@@ -6200,7 +6200,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 26169:
{
// heal amount
- basepoints0 = int32(CalculatePctN(damage, 10));
+ basepoints0 = int32(CalculatePct(damage, 10));
target = this;
triggered_spell_id = 26170;
break;
@@ -6212,7 +6212,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 39373;
break;
@@ -6232,7 +6232,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!blessHealing)
return false;
- basepoints0 = int32(CalculatePctN(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
+ basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
}
break;
}
@@ -6249,7 +6249,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
- basepoints0 = int32(CalculatePctN(GetCreatePowers(POWER_MANA), mana_perc) / 10);
+ basepoints0 = int32(CalculatePct(GetCreatePowers(POWER_MANA), mana_perc) / 10);
triggered_spell_id = 54833;
target = this;
break;
@@ -6326,7 +6326,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 28719:
{
// mana back
- basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 30));
+ basepoints0 = int32(CalculatePct(procSpell->ManaCost, 30));
target = this;
triggered_spell_id = 28742;
break;
@@ -6336,7 +6336,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!victim || !victim->HealthBelowPct(uint32(triggerAmount)))
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 54755;
break;
}
@@ -6404,7 +6404,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
// Add remaining ticks to damage done
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
}
@@ -6449,7 +6449,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
else if (dummySpell->SpellIconID == 2860)
{
triggered_spell_id = 48504;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
break;
@@ -6492,7 +6492,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// energy cost save
- basepoints0 = CalculatePctN(int32(procSpell->ManaCost), triggerAmount);
+ basepoints0 = CalculatePct(int32(procSpell->ManaCost), triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -6654,7 +6654,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
Player* Member = itr->getSource();
// check if it was heal by paladin which casted this beacon of light
- if (Aura const * aura = Member->GetAura(53563, victim->GetGUID()))
+ if (Member->GetAura(53563, victim->GetGUID()))
{
// do not proc when target of beacon of light is healed
if (Member == this)
@@ -6759,7 +6759,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (victim && victim->isAlive() && victim->getPowerType() == POWER_MANA)
{
// 2% of base mana
- basepoints0 = int32(CalculatePctN(victim->GetCreateMana(), 2));
+ basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2));
victim->CastCustomSpell(victim, 20268, &basepoints0, NULL, NULL, true, 0, triggeredByAura);
}
return true;
@@ -6818,7 +6818,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
bool stacker = !procSpell || procSpell->Id == 53595;
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
- bool damager = procSpell && procSpell->EquippedItemClass != -1;
+ bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
if (!stacker && !damager)
return false;
@@ -6850,7 +6850,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
bool stacker = !procSpell || procSpell->Id == 53595;
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
- bool damager = procSpell && procSpell->EquippedItemClass != -1;
+ bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
if (!stacker && !damager)
return false;
@@ -6882,7 +6882,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = int32(CalculatePctN(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
+ basepoints0 = int32(CalculatePct(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
target = this;
if (basepoints0)
@@ -6921,7 +6921,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 54937:
{
triggered_spell_id = 54968;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Item - Paladin T8 Holy 2P Bonus
@@ -7168,7 +7168,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Not proc from self heals
if (this == victim)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 55533;
break;
@@ -7180,7 +7180,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = GetOwner();
if (!target)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 58879;
// Cast on spirit wolf
CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura);
@@ -7189,7 +7189,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Shaman T8 Elemental 4P Bonus
case 64928:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 64930; // Electrified
break;
}
@@ -7203,7 +7203,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
}
break;
}
@@ -7217,7 +7217,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
// Add remaining ticks to healing done
basepoints0 += GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL);
}
@@ -7279,8 +7279,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0]))
{
- int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount);
- int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount);
+ int32 bp0 = CalculatePct(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount);
+ int32 bp1 = CalculatePct(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount);
CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true);
return true;
}
@@ -7307,7 +7307,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (dummySpell->SpellIconID == 3065)
{
triggered_spell_id = 52759;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
break;
}
@@ -7321,7 +7321,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Earth Shield
if (AuraEffect* aur = GetAuraEffect(63279, 0))
- AddPctN(basepoints0, aur->GetAmount());
+ AddPct(basepoints0, aur->GetAmount());
triggered_spell_id = 379;
break;
}
@@ -7337,13 +7337,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|| (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
return false;
- float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
+ float fire_onhit = float(CalculatePct(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
+ victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE));
// 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
- ApplyPctF(add_spellpower, 3.84f);
+ ApplyPct(add_spellpower, 3.84f);
// Enchant on Off-Hand and ready?
if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
@@ -7497,7 +7497,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (GetTypeId() != TYPEID_PLAYER)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Butchery
@@ -7543,10 +7543,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Unholy Blight
if (dummySpell->Id == 49194)
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
// Glyph of Unholy Blight
if (AuraEffect* glyph=GetAuraEffect(63332, 0))
- AddPctN(basepoints0, glyph->GetAmount());
+ AddPct(basepoints0, glyph->GetAmount());
triggered_spell_id = 50536;
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
@@ -7563,7 +7563,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Necrosis
if (dummySpell->SpellIconID == 2709)
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 51460;
break;
}
@@ -7641,7 +7641,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!roll_chance_f(GetUnitCriticalChance(BASE_ATTACK, victim)))
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 50526;
break;
}
@@ -7723,7 +7723,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 54445;
target = this;
- float addThreat = float(CalculatePctN(procSpell->Effects[0].CalcValue(this), triggerAmount));
+ float addThreat = float(CalculatePct(procSpell->Effects[0].CalcValue(this), triggerAmount));
victim->AddThreat(this, addThreat);
break;
}
@@ -7791,7 +7791,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
if (dummySpell->SpellFamilyFlags[1] & 0x40000)
{
uint32 maxmana = GetMaxPower(POWER_MANA);
- basepoints0 = CalculatePctF(maxmana, GetAttackTime(RANGED_ATTACK) / 1000.0f);
+ basepoints0 = CalculatePct(maxmana, GetAttackTime(RANGED_ATTACK) / 1000.0f);
target = this;
triggered_spell_id = 34075;
break;
@@ -7929,7 +7929,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Swift Hand of Justice
case 59906:
{
- int32 bp0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
+ int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
CastCustomSpell(this, 59913, &bp0, NULL, NULL, true);
*handled = true;
break;
@@ -7948,10 +7948,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
*handled = true;
if (victim && victim->HasAura(53601))
{
- int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue());
+ int32 bp0 = CalculatePct(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue());
// Item - Paladin T9 Holy 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(67191, 0))
- AddPctN(bp0, aurEff->GetAmount());
+ AddPct(bp0, aurEff->GetAmount());
CastCustomSpell(victim, 66922, &bp0, NULL, NULL, true);
return true;
}
@@ -8020,7 +8020,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
if (!spInfo)
return false;
- int32 bp0 = int32(CalculatePctN(GetCreateMana(), spInfo->Effects[0].CalcValue()));
+ int32 bp0 = int32(CalculatePct(GetCreateMana(), spInfo->Effects[0].CalcValue()));
CastCustomSpell(this, 67545, &bp0, NULL, NULL, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
return true;
}
@@ -8115,7 +8115,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Item - Warrior T10 Protection 4P Bonus
case 70844:
{
- int32 basepoints0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
+ int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
break;
}
@@ -8279,7 +8279,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellInfo()->SpellIconID == 113)
{
int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 2);
- basepoints0 = int32(CalculatePctN(GetMaxPower(POWER_MANA), value2));
+ basepoints0 = int32(CalculatePct(GetMaxPower(POWER_MANA), value2));
// Drain Soul
CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
break;
@@ -8327,7 +8327,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id);
return false;
}
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / 3;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3;
target = this;
// Add remaining ticks to healing done
basepoints0 += GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_HEAL);
@@ -8391,7 +8391,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (!TriggerPS)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -8508,8 +8508,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
}
// percent stored in effect 1 (class scripts) base points
- int32 cost = int32(originalSpell->ManaCost + CalculatePctU(GetCreateMana(), originalSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, auraSpellInfo->Effects[1].CalcValue());
+ int32 cost = int32(originalSpell->ManaCost + CalculatePct(GetCreateMana(), originalSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, auraSpellInfo->Effects[1].CalcValue());
trigger_spell_id = 20272;
target = this;
}
@@ -8539,7 +8539,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
- basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 35));
+ basepoints0 = int32(CalculatePct(procSpell->ManaCost, 35));
trigger_spell_id = 23571;
target = this;
break;
@@ -8614,7 +8614,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
trigger_spell_id = 50475;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
}
// Item - Death Knight T10 Melee 4P Bonus
else if (auraSpellInfo->Id == 70656)
@@ -8701,7 +8701,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
case 26467:
{
- basepoints0 = int32(CalculatePctN(damage, 15));
+ basepoints0 = int32(CalculatePct(damage, 15));
target = victim;
trigger_spell_id = 26470;
break;
@@ -8893,7 +8893,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Shamanistic Rage triggered spell
case 30824:
{
- basepoints0 = int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
+ basepoints0 = int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
break;
}
// Enlightenment (trigger only from mana cost spells)
@@ -9005,7 +9005,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Savage Defense
case 62606:
{
- basepoints0 = CalculatePctF(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
+ basepoints0 = CalculatePct(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
break;
}
// Body and Soul
@@ -10353,11 +10353,11 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
}
}
@@ -10368,13 +10368,13 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -10393,7 +10393,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 6928:
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Soul Siphon
@@ -10420,19 +10420,19 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
break;
}
}
- AddPctN(DoneTotalMod, modPercent);
+ AddPct(DoneTotalMod, modPercent);
break;
}
case 6916: // Death's Embrace
case 6925:
case 6927:
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
case 5481: // Starfire Bonus
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
case 4418: // Increased Shock Damage
@@ -10455,14 +10455,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
// Tundra Stalker
else
{
// Frost Fever (target debuff)
if (victim->HasAura(55095))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
break;
@@ -10471,14 +10471,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
+ AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Twisted Faith
case 7377:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Marked for Death
@@ -10489,7 +10489,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 7602:
{
if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Dirty Deeds
@@ -10502,7 +10502,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
{
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
- AddPctN(DoneTotalMod, bonus);
+ AddPct(DoneTotalMod, bonus);
}
break;
}
@@ -10534,7 +10534,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
if ((*i)->GetSpellInfo()->SpellIconID == 3263)
{
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
}
@@ -10547,13 +10547,13 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
// Increase Mind Flay damage if Shadow Word: Pain present on target
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Twisted Faith - Mind Flay part
if (AuraEffect* aurEff = GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_PRIEST, 2848, 1))
// Increase Mind Flay damage if Shadow Word: Pain present on target
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
// Smite
else if (spellProto->SpellFamilyFlags[0] & 0x80)
@@ -10561,7 +10561,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Glyph of Smite
if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
// Shadow Word: Death
else if (spellProto->SpellFamilyFlags[1] & 0x2)
@@ -10569,7 +10569,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Glyph of Shadow Word: Death
if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
break;
case SPELLFAMILY_PALADIN:
@@ -10587,7 +10587,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
}
// + 10% for each application of Holy Vengeance/Blood Corruption on the target
if (stacks)
- AddPctU(DoneTotalMod, 10 * stacks);
+ AddPct(DoneTotalMod, 10 * stacks);
}
break;
case SPELLFAMILY_DRUID:
@@ -10596,7 +10596,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
{
// Brambles
if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
break;
case SPELLFAMILY_WARLOCK:
@@ -10608,7 +10608,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
if ((*i)->GetSpellInfo()->SpellIconID == 3173)
{
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
}
@@ -10619,31 +10619,31 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Shadow Bite (15% increase from each dot)
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet())
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
- AddPctN(DoneTotalMod, 15 * count);
+ AddPct(DoneTotalMod, 15 * count);
break;
case SPELLFAMILY_HUNTER:
// Steady Shot
if (spellProto->SpellFamilyFlags[1] & 0x1)
if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
break;
case SPELLFAMILY_DEATHKNIGHT:
// Improved Icy Touch
if (spellProto->SpellFamilyFlags[0] & 0x2)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2721, 0))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Sigil of the Vengeful Heart
if (spellProto->SpellFamilyFlags[0] & 0x2000)
if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
- AddPctN(DoneTotal, aurEff->GetAmount());
+ AddPct(DoneTotal, aurEff->GetAmount());
// Glacier Rot
if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 196, 0))
if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Impurity (dummy effect)
if (GetTypeId() == TYPEID_PLAYER)
@@ -10662,7 +10662,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 49638:
{
if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
- AddPctN(ApCoeffMod, proto->Effects[0].CalcValue());
+ AddPct(ApCoeffMod, proto->Effects[0].CalcValue());
}
break;
}
@@ -10765,7 +10765,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
- AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
+ AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
}
@@ -10775,7 +10775,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
@@ -10783,7 +10783,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
@@ -10818,12 +10818,12 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (TakenTotal < 0)
{
if (TakenTotalMod < 1)
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePct(pdamage, TakenTotalCasterMod));
else
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePct(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
}
else if (TakenTotalMod < 1)
- tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod));
+ tmpDamage = ((CalculatePct(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePct(float(pdamage) + TakenTotal, TakenTotalCasterMod));
}
if (!tmpDamage)
tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
@@ -10857,14 +10857,14 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
{
// stat used stored in miscValueB for this aura
Stats usedStat = Stats((*i)->GetMiscValueB());
- DoneAdvertisedBenefit += int32(CalculatePctN(GetStat(usedStat), (*i)->GetAmount()));
+ DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
}
}
// ... and attack power
AuraEffectList const& mDamageDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER);
for (AuraEffectList::const_iterator i =mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
if ((*i)->GetMiscValue() & schoolMask)
- DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
+ DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
}
return DoneAdvertisedBenefit;
@@ -11102,7 +11102,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
crit_mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
if (crit_bonus != 0)
- AddPctF(crit_bonus, crit_mod);
+ AddPct(crit_bonus, crit_mod);
crit_bonus -= damage;
@@ -11165,7 +11165,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
// Healing done percent
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -11185,12 +11185,12 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
case 6935:
case 6918:
if (victim->HealthBelowPct(50))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
case 7798: // Glyph of Regrowth
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
case 8477: // Nourish Heal Boost
@@ -11209,13 +11209,13 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
continue;
modPercent += stepPercent * aura->GetStackAmount();
}
- AddPctN(DoneTotalMod, modPercent);
+ AddPct(DoneTotalMod, modPercent);
break;
}
case 7871: // Glyph of Lesser Healing Wave
{
if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
default:
@@ -11306,15 +11306,15 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
// Healing taken percent
float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (minval)
- AddPctF(TakenTotalMod, minval);
+ AddPct(TakenTotalMod, minval);
float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (maxval)
- AddPctF(TakenTotalMod, maxval);
+ AddPct(TakenTotalMod, maxval);
// Tenacity increase healing % taken
if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
- AddPctN(TakenTotalMod, Tenacity->GetAmount());
+ AddPct(TakenTotalMod, Tenacity->GetAmount());
// Healing Done
int32 TakenTotal = 0;
@@ -11336,11 +11336,11 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
// Healing over time taken percent
float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (minval_hot)
- AddPctF(TakenTotalMod, minval_hot);
+ AddPct(TakenTotalMod, minval_hot);
float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (maxval_hot)
- AddPctF(TakenTotalMod, maxval_hot);
+ AddPct(TakenTotalMod, maxval_hot);
}
// Check for table values
@@ -11383,7 +11383,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED);
for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
@@ -11425,14 +11425,14 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
{
// stat used dependent from misc value (stat index)
Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
- AdvertisedBenefit += int32(CalculatePctN(GetStat(usedStat), (*i)->GetAmount()));
+ AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
}
// ... and attack power
AuraEffectList const& mHealingDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER);
for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i)
if ((*i)->GetMiscValue() & schoolMask)
- AdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
+ AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
}
return AdvertisedBenefit;
}
@@ -11663,11 +11663,11 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
}
}
@@ -11675,13 +11675,13 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -11701,14 +11701,14 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
// Tundra Stalker
else
{
// Frost Fever (target debuff)
if (victim->HasAura(55095))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
break;
}
@@ -11716,7 +11716,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
+ AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Marked for Death
@@ -11727,7 +11727,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
case 7602:
{
if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Dirty Deeds
@@ -11738,7 +11738,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
{
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
- AddPctN(DoneTotalMod, bonus);
+ AddPct(DoneTotalMod, bonus);
}
break;
}
@@ -11754,7 +11754,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 196, 0))
if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
break;
}
@@ -11810,7 +11810,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
@@ -11824,7 +11824,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
}
@@ -11841,7 +11841,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
- AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
+ AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
}
@@ -11860,13 +11860,13 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
{
AuraEffectList const& mModMeleeDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
else
{
AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
float tmpDamage = 0.0f;
@@ -11876,12 +11876,12 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
if (TakenFlatBenefit < 0)
{
if (TakenTotalMod < 1)
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePct(pdamage, TakenTotalCasterMod));
else
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePct(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
}
else if (TakenTotalMod < 1)
- tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod));
+ tmpDamage = ((CalculatePct(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePct(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod));
}
if (!tmpDamage)
tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
@@ -12648,7 +12648,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
// now we ready for speed calculation
float speed = std::max(non_stack_bonus, stack_bonus);
if (main_speed_mod)
- AddPctN(speed, main_speed_mod);
+ AddPct(speed, main_speed_mod);
switch (mtype)
{
@@ -12686,7 +12686,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
int32 slow = GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
if (slow)
{
- AddPctN(speed, slow);
+ AddPct(speed, slow);
if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
{
float min_speed = minSpeedMod / 100.0f;
@@ -13205,7 +13205,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
durationMod = durationMod_always;
if (durationMod != 0)
- AddPctN(duration, durationMod);
+ AddPct(duration, durationMod);
// there are only negative mods currently
durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
@@ -13218,7 +13218,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
durationMod += durationMod_always;
if (durationMod != 0)
- AddPctN(duration, durationMod);
+ AddPct(duration, durationMod);
}
else
{
@@ -14132,14 +14132,14 @@ void CharmInfo::LoadPetActionBar(const std::string& data)
{
InitPetActionBar();
- Tokens tokens(data, ' ');
+ Tokenizer tokens(data, ' ');
if (tokens.size() != (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START) * 2)
return; // non critical, will reset to default
- uint8 index;
- Tokens::iterator iter;
- for (iter = tokens.begin(), index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++iter, ++index)
+ uint8 index = ACTION_BAR_INDEX_START;
+ Tokenizer::const_iterator iter = tokens.begin();
+ for (; index < ACTION_BAR_INDEX_END; ++iter, ++index)
{
// use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion
ActiveStates type = ActiveStates(atol(*iter));
@@ -14641,7 +14641,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// Remove charge (aura can be removed by triggers)
if (useCharges && takeCharges)
- i->aura->DropCharge(AURA_REMOVE_BY_EXPIRE);
+ i->aura->DropCharge();
if (spellInfo->AttributesEx3 & SPELL_ATTR3_DISABLE_PROC)
SetCantProc(false);
@@ -16695,7 +16695,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
{
float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
- return CalculatePctF(damage, percent);
+ return CalculatePct(damage, percent);
}
uint32 Unit::GetModelForForm(ShapeshiftForm form)
@@ -16985,8 +16985,8 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward)
GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
else
{
- float vcos = cos(angle+GetOrientation());
- float vsin = sin(angle+GetOrientation());
+ float vcos = std::cos(angle+GetOrientation());
+ float vsin = std::sin(angle+GetOrientation());
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
data.append(GetPackGUID());
@@ -17441,7 +17441,7 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
addRage = (damage / rageconversion * 7.5f + weaponSpeedHitFactor) / 2;
// talent who gave more rage on attack
- AddPctN(addRage, GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT));
+ AddPct(addRage, GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT));
}
else
{
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 5a639de574c..7f279a8b97e 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1334,8 +1334,8 @@ class Unit : public WorldObject
bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); }
bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); }
float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; }
- uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); }
- uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); }
+ uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePct(GetMaxHealth(), pct); }
+ uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePct(GetHealth(), pct); }
void SetHealth(uint32 val);
void SetMaxHealth(uint32 val);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index ef4ed1a7f81..a9cd1bc3824 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -517,8 +517,8 @@ void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
{
float inx = x, iny = y, inz = z, ino = o;
o = GetBase()->GetOrientation() + ino;
- x = GetBase()->GetPositionX() + inx * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation());
- y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation());
+ x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation());
+ y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation());
z = GetBase()->GetPositionZ() + inz;
}
@@ -526,9 +526,9 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetBase()->GetOrientation();
z -= GetBase()->GetPositionZ();
- y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
- x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
+ x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
- x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+ y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+ x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 5ef9efa0396..fd2a2fe143a 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -525,10 +525,10 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.bytes2 = fields[4].GetUInt32();
creatureAddon.emote = fields[5].GetUInt32();
- Tokens tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[6].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
- for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
@@ -907,10 +907,10 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.bytes2 = fields[4].GetUInt32();
creatureAddon.emote = fields[5].GetUInt32();
- Tokens tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[6].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
- for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 8f98135aafb..082552daa99 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -2021,7 +2021,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
{
const uint32 ktcount = KNOWN_TITLES_SIZE * 2;
uint32 knownTitles[ktcount];
- Tokens tokens(knownTitlesStr, ' ', ktcount);
+ Tokenizer tokens(knownTitlesStr, ' ', ktcount);
if (tokens.size() != ktcount)
return;
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 1da44882ea9..e6e32e81e51 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -862,8 +862,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
// 2PI = 360°, keep in mind that ingame orientation is counter-clockwise
double rotation = 2 * M_PI - atEntry->box_orientation;
- double sinVal = sin(rotation);
- double cosVal = cos(rotation);
+ double sinVal = std::sin(rotation);
+ double cosVal = std::cos(rotation);
float playerBoxDistX = player->GetPositionX() - atEntry->x;
float playerBoxDistY = player->GetPositionY() - atEntry->y;
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 56818e95a2b..6e0c62107ff 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -146,8 +146,8 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
break;
}
- temp_x = x + distance * cos(angle);
- temp_y = y + distance * sin(angle);
+ temp_x = x + distance * std::cos(angle);
+ temp_y = y + distance * std::sin(angle);
Trinity::NormalizeMapCoord(temp_x);
Trinity::NormalizeMapCoord(temp_y);
if (owner.IsWithinLOS(temp_x, temp_y, z))
@@ -172,8 +172,8 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f)
{
- float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle+static_cast<float>(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast<float>(M_PI/2)),z,true);
- float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle-static_cast<float>(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast<float>(M_PI/2)),z,true);
+ float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle+static_cast<float>(M_PI/2)),temp_y + 1.0f* std::sin(angle+static_cast<float>(M_PI/2)),z,true);
+ float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle-static_cast<float>(M_PI/2)),temp_y + 1.0f* std::sin(angle-static_cast<float>(M_PI/2)),z,true);
if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
{
x = temp_x;
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 84cd9e88295..72725570826 100755
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -46,8 +46,8 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
const float angle = float(rand_norm()) * static_cast<float>(M_PI*2.0f);
const float range = float(rand_norm()) * wander_distance;
- const float distanceX = range * cos(angle);
- const float distanceY = range * sin(angle);
+ const float distanceX = range * std::cos(angle);
+ const float distanceY = range * std::sin(angle);
destX = respX + distanceX;
destY = respY + distanceY;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 9919a47642e..6985cb92804 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -135,7 +135,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
m_maxValue = (float)goinfo->capturePoint.maxTime;
m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
m_neutralValuePct = goinfo->capturePoint.neutralPercent;
- m_minValue = CalculatePctU(m_maxValue, m_neutralValuePct);
+ m_minValue = CalculatePct(m_maxValue, m_neutralValuePct);
return true;
}
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 79e8d47aa94..0d3d97d3996 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -17,6 +17,7 @@
*/
#include "PoolMgr.h"
+#include "Containers.h"
#include "ObjectMgr.h"
#include "Log.h"
#include "MapManager.h"
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index f28a02a52fc..297b4df97c4 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -474,7 +474,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Glyph of Fear, Glyph of Frost nova and similar auras
if ((*itr)->GetMiscValue() == 7801)
{
- AddPctN(amount, (*itr)->GetAmount());
+ AddPct(amount, (*itr)->GetAmount());
break;
}
}
@@ -527,7 +527,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Borrowed Time
if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
- bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
+ bonus += CalculatePct(1.0f, pAurEff->GetAmount());
DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
// Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
@@ -539,7 +539,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Twin Disciplines
if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
- AddPctN(amount, pAurEff->GetAmount());
+ AddPct(amount, pAurEff->GetAmount());
// Focused Power
// Reuse variable, not sure if this code below can be moved before Twin Disciplines
@@ -569,7 +569,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!pAurEff)
pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening
if (pAurEff)
- AddPctN(amount, pAurEff->GetAmount());
+ AddPct(amount, pAurEff->GetAmount());
return amount;
}
@@ -635,7 +635,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
amount += cp * aurEff->GetAmount();
- amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
+ amount += uint32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
}
// Rend
else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
@@ -653,7 +653,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (m_spellInfo->GetRank() >= 9)
{
if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster))
- AddPctN(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
+ AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
}
}
// Unholy Blight damage over time effect
@@ -674,10 +674,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
break;
case 29166: // Innervate
- ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
+ ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
break;
case 48391: // Owlkin Frenzy
- ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
break;
default:
break;
@@ -692,7 +692,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (caster->GetTypeId() == TYPEID_PLAYER)
// Bonus from Glyph of Lightwell
if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0))
- AddPctN(amount, modHealing->GetAmount());
+ AddPct(amount, modHealing->GetAmount());
}
break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
@@ -4745,7 +4745,7 @@ void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode
Unit* target = aurApp->GetTarget();
- float amount = CalculatePctN(1.0f, GetAmount());
+ float amount = CalculatePct(1.0f, GetAmount());
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
if (GetMiscValue() & (1 << i))
target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply);
@@ -6399,25 +6399,25 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
// Tenacity increase healing % taken
if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
- AddPctN(TakenTotalMod, Tenacity->GetAmount());
+ AddPct(TakenTotalMod, Tenacity->GetAmount());
// Healing taken percent
float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (minval)
- AddPctF(TakenTotalMod, minval);
+ AddPct(TakenTotalMod, minval);
float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (maxval)
- AddPctF(TakenTotalMod, maxval);
+ AddPct(TakenTotalMod, maxval);
// Healing over time taken percent
float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (minval_hot)
- AddPctF(TakenTotalMod, minval_hot);
+ AddPct(TakenTotalMod, minval_hot);
float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (maxval_hot)
- AddPctF(TakenTotalMod, maxval_hot);
+ AddPct(TakenTotalMod, maxval_hot);
TakenTotalMod = std::max(TakenTotalMod, 0.0f);
@@ -6510,8 +6510,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (m_spellInfo->ManaCostPercentage)
{
// max value
- int32 maxmana = CalculatePctF(caster->GetMaxPower(powerType), drainAmount * 2.0f);
- ApplyPctU(drainAmount, target->GetMaxPower(powerType));
+ int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f);
+ ApplyPct(drainAmount, target->GetMaxPower(powerType));
if (drainAmount > maxmana)
drainAmount = maxmana;
}
@@ -6548,7 +6548,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
// Mana Feed - Drain Mana
if (manaFeedVal > 0)
{
- int32 feedAmount = CalculatePctN(gainedAmount, manaFeedVal);
+ int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this);
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 4060ee42206..9c08ebae5ac 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -1215,7 +1215,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
- int32 heal = int32(CalculatePctN(basepoints0, 15));
+ int32 heal = int32(CalculatePct(basepoints0, 15));
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
@@ -1433,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else if (aurEff->GetId() == 47537)
multiplier += 0.5f;
- int32 basepoints0 = int32(CalculatePctF(caster->GetMaxPower(POWER_MANA), multiplier));
+ int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
}
// effect on aura target
@@ -1447,7 +1447,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{
case POWER_MANA:
{
- int32 basepoints0 = int32(CalculatePctN(target->GetMaxPower(POWER_MANA), 2));
+ int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true);
break;
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 6b51f240b28..51fbd24a3e0 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1651,7 +1651,7 @@ void Spell::SelectImplicitTrajTargets()
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
// TODO: all calculation should be based on src instead of m_caster
- const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
+ const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ;
DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
@@ -1719,8 +1719,8 @@ void Spell::SelectImplicitTrajTargets()
if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist)
{
- float x = m_targets.GetSrcPos()->m_positionX + cos(m_caster->GetOrientation()) * bestDist;
- float y = m_targets.GetSrcPos()->m_positionY + sin(m_caster->GetOrientation()) * bestDist;
+ float x = m_targets.GetSrcPos()->m_positionX + std::cos(m_caster->GetOrientation()) * bestDist;
+ float y = m_targets.GetSrcPos()->m_positionY + std::sin(m_caster->GetOrientation()) * bestDist;
float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b);
if (itr != targets.end())
@@ -6365,7 +6365,7 @@ void Spell::Delayed() // only called in DealDamage()
if (delayReduce >= 100)
return;
- AddPctN(delaytime, -delayReduce);
+ AddPct(delaytime, -delayReduce);
if (m_timer + delaytime > m_casttime)
{
@@ -6393,14 +6393,14 @@ void Spell::DelayedChannel()
return;
//check pushback reduce
- int32 delaytime = CalculatePctN(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
+ int32 delaytime = CalculatePct(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
- AddPctN(delaytime, -delayReduce);
+ AddPct(delaytime, -delayReduce);
if (m_timer <= delaytime)
{
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index d2bdf4b8970..5de81b6bd88 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -154,8 +154,8 @@ class SpellCastTargets
void SetSpeed(float speed) { m_speed = speed; }
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
- float GetSpeedXY() const { return m_speed * cos(m_elevation); }
- float GetSpeedZ() const { return m_speed * sin(m_elevation); }
+ float GetSpeedXY() const { return m_speed * std::cos(m_elevation); }
+ float GetSpeedZ() const { return m_speed * std::sin(m_elevation); }
void Update(Unit* caster);
void OutDebug() const;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index dcbd1888b03..cbc478078e5 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -377,13 +377,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
// Victory Rush
else if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
- ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
+ ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shockwave
else if (m_spellInfo->Id == 46968)
{
int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2);
if (pct > 0)
- damage += int32(CalculatePctN(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
+ damage += int32(CalculatePct(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
break;
}
break;
@@ -434,10 +434,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
- damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir));
+ damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir));
uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3;
- m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot)));
+ m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot)));
apply_direct_bonus = false;
// Glyph of Conflagrate
@@ -495,7 +495,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier;
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
damage += int32(energy * multiple);
- damage += int32(CalculatePctN(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
+ damage += int32(CalculatePct(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
}
// Wrath
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
@@ -503,7 +503,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Improved Insect Swarm
if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
}
break;
}
@@ -636,7 +636,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
{
uint8 level = m_caster->getLevel();
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
- damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
+ damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
break;
}
break;
@@ -1436,8 +1436,8 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->Id == 8129)
{
- int32 maxDamage = int32(CalculatePctN(m_caster->GetMaxPower(powerType), damage * 2));
- damage = int32(CalculatePctN(unitTarget->GetMaxPower(powerType), damage));
+ int32 maxDamage = int32(CalculatePct(m_caster->GetMaxPower(powerType), damage * 2));
+ damage = int32(CalculatePct(unitTarget->GetMaxPower(powerType), damage));
damage = std::min(damage, maxDamage);
}
@@ -1493,7 +1493,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(addhealth, 25);
+ AddPct(addhealth, 25);
}
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
@@ -1552,7 +1552,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i)
{
if (m_caster->GetGUID() == (*i)->GetCasterGUID())
- AddPctN(addhealth, aurEff->GetAmount());
+ AddPct(addhealth, aurEff->GetAmount());
}
}
}
@@ -1876,20 +1876,20 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
case 31930: // Judgements of the Wise
case 63375: // Improved Stormstrike
case 68082: // Glyph of Seal of Command
- damage = int32(CalculatePctN(unitTarget->GetCreateMana(), damage));
+ damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage));
break;
case 48542: // Revitalize
- damage = int32(CalculatePctN(unitTarget->GetMaxPower(power), damage));
+ damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage));
break;
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(damage, 25);
+ AddPct(damage, 25);
break;
}
case 71132: // Glyph of Shadow Word: Pain
- damage = int32(CalculatePctN(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
+ damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
break;
default:
break;
@@ -1972,7 +1972,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
if (maxPower == 0)
return;
- uint32 gain = CalculatePctN(maxPower, damage);
+ uint32 gain = CalculatePct(maxPower, damage);
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
@@ -3363,7 +3363,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
{
if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0))
- AddPctN(totalDamagePercentMod, rendAndTear->GetAmount());
+ AddPct(totalDamagePercentMod, rendAndTear->GetAmount());
}
break;
}
@@ -3381,7 +3381,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
{
// Glyph of Plague Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
- AddPctN(totalDamagePercentMod, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, aurEff->GetAmount());
break;
}
// Blood Strike
@@ -3390,13 +3390,13 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
// Glyph of Blood Strike
if (m_caster->GetAuraEffect(59332, EFFECT_0))
if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
- AddPctN(totalDamagePercentMod, 20);
+ AddPct(totalDamagePercentMod, 20);
break;
}
// Death Strike
@@ -3405,7 +3405,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Glyph of Death Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
- AddPctN(totalDamagePercentMod, runic);
+ AddPct(totalDamagePercentMod, runic);
break;
}
// Obliterate (12.5% more damage per disease)
@@ -3421,14 +3421,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
// Blood-Caked Strike - Blood-Caked Blade
if (m_spellInfo->SpellIconID == 1736)
{
- AddPctF(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
+ AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
break;
}
// Heart Strike
@@ -3437,9 +3437,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
+ AddPct(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
break;
@@ -3461,7 +3461,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
normalized = true;
break;
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
- ApplyPctN(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
+ ApplyPct(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
break;
default:
break; // not weapon damage effect, just skip
@@ -4937,7 +4937,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
return;
uint32 health = target->CountPctFromMaxHealth(damage);
- uint32 mana = CalculatePctN(target->GetMaxPower(POWER_MANA), damage);
+ uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
ExecuteLogEffectResurrect(effIndex, target);
@@ -5087,7 +5087,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
{
health = m_caster->CountPctFromMaxHealth(damage);
if (m_caster->GetMaxPower(POWER_MANA) > 0)
- mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
+ mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
}
Player* player = m_caster->ToPlayer();
@@ -5404,12 +5404,12 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
if (spellInfo)
{
mana += spellInfo->ManaCost;
- mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
+ mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
}
totem->ToTotem()->UnSummon();
}
}
- ApplyPctN(mana, damage);
+ ApplyPct(mana, damage);
if (mana)
m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true);
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 0531549cbd3..37f6a4b8640 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2026,16 +2026,16 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
{
// health as power used
case POWER_HEALTH:
- powerCost += int32(CalculatePctU(caster->GetCreateHealth(), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetCreateHealth(), ManaCostPercentage));
break;
case POWER_MANA:
- powerCost += int32(CalculatePctU(caster->GetCreateMana(), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetCreateMana(), ManaCostPercentage));
break;
case POWER_RAGE:
case POWER_FOCUS:
case POWER_ENERGY:
case POWER_HAPPINESS:
- powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
break;
case POWER_RUNE:
case POWER_RUNIC_POWER:
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 167c56c20a2..6803354d29b 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -201,8 +201,8 @@ public:
float z = player->GetPositionZ();
float ang = player->GetOrientation();
- float rot2 = sin(ang/2);
- float rot3 = cos(ang/2);
+ float rot2 = std::sin(ang/2);
+ float rot3 = std::cos(ang/2);
uint32 objectId = atoi(id);
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 7e489a5781e..c2ec563b3c7 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -39,12 +39,12 @@ public:
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
{ "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 7d2a4304054..25f4c176bfc 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -408,9 +408,9 @@ public:
if (!*args)
return false;
- Tokens entries(std::string(args), ' ');
+ Tokenizer entries(std::string(args), ' ');
- for (Tokens::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
+ for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
{
uint32 entry = uint32(atoi(*itr));
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 08aad90f588..ea9cfe5c3c1 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -210,16 +210,16 @@ public:
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
float angle = me->GetAngle(pAttumen);
float distance = me->GetDistance2d(pAttumen);
- float newX = me->GetPositionX() + cos(angle)*(distance/2);
- float newY = me->GetPositionY() + sin(angle)*(distance/2);
+ float newX = me->GetPositionX() + std::cos(angle)*(distance/2);
+ float newY = me->GetPositionY() + std::sin(angle)*(distance/2);
float newZ = 50;
//me->Relocate(newX, newY, newZ, angle);
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
distance += 10;
- newX = me->GetPositionX() + cos(angle)*(distance/2);
- newY = me->GetPositionY() + sin(angle)*(distance/2);
+ newX = me->GetPositionX() + std::cos(angle)*(distance/2);
+ newY = me->GetPositionY() + std::sin(angle)*(distance/2);
pAttumen->GetMotionMaster()->Clear();
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//pAttumen->Relocate(newX, newY, newZ, -angle);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 167f040bbc4..e368124abaf 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -774,8 +774,8 @@ public:
for (uint8 i = 1; i < Phase; ++i)
{
float sx, sy;
- sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]);
- sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]);
+ sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]);
+ sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]);
me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
}
Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown
@@ -1207,13 +1207,13 @@ public:
{
if (bClockwise)
{
- y = my - r * sin(c);
- x = mx - r * cos(c);
+ y = my - r * std::sin(c);
+ x = mx - r * std::cos(c);
}
else
{
- y = my + r * sin(c);
- x = mx + r * cos(c);
+ y = my + r * std::sin(c);
+ x = mx + r * std::cos(c);
}
bPointReached = false;
uiCheckTimer = 1000;
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index 89064a5d18c..ebab2cb99a9 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -15,10 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users...
- */
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ahnkahet.h"
@@ -34,12 +30,24 @@ enum Spells
SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self
SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, // Self
SPELL_PUTRID_MUSHROOM = 31690, // To make the mushrooms visible
+ SPELL_POWER_MUSHROOM_VISUAL_AURA = 56740,
};
enum Creatures
{
- NPC_HEALTHY_MUSHROOM = 30391,
- NPC_POISONOUS_MUSHROOM = 30435
+ NPC_HEALTHY_MUSHROOM = 30391,
+ NPC_POISONOUS_MUSHROOM = 30435,
+ NPC_TRIGGER = 19656
+};
+
+enum event
+{
+ EVENT_SPAWN = 1,
+ EVENT_MINI,
+ EVENT_ROOT,
+ EVENT_BASH,
+ EVENT_BOLT,
+ EVENT_AURA
};
class boss_amanitar : public CreatureScript
@@ -47,110 +55,118 @@ class boss_amanitar : public CreatureScript
public:
boss_amanitar() : CreatureScript("boss_amanitar") { }
- struct boss_amanitarAI : public ScriptedAI
+ struct boss_amanitarAI : public BossAI
{
- boss_amanitarAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- bFirstTime = true;
- }
-
- InstanceScript* instance;
-
- uint32 uiRootTimer;
- uint32 uiBashTimer;
- uint32 uiBoltTimer;
- uint32 uiSpawnTimer;
-
- bool bFirstTime;
-
+ boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR) { }
+
void Reset()
{
- uiRootTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
- uiBashTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS);
- uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- uiSpawnTimer = 0;
-
+ _Reset();
+
me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
- me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
+ me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
+ summons.DespawnAll();
if (instance)
{
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
- if (!bFirstTime)
- instance->SetData(DATA_AMANITAR_EVENT, FAIL);
- else
- bFirstTime = false;
+ instance->SetData(DATA_AMANITAR_EVENT, NOT_STARTED);
}
}
- void JustDied(Unit* /*killer*/)
+ void JustDied(Unit* /*Killer*/)
{
if (instance)
{
+ _JustDied();
instance->SetData(DATA_AMANITAR_EVENT, DONE);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
+ summons.DespawnAll();
}
}
void EnterCombat(Unit* /*who*/)
{
+ _EnterCombat();
+
+ events.ScheduleEvent(EVENT_ROOT, urand(5,9)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BASH, urand(10,14)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BOLT, urand(15,20)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_MINI, urand(12,18)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SPAWN, 5 *IN_MILLISECONDS);
+
+ me->SetInCombatWithZone();
if (instance)
instance->SetData(DATA_AMANITAR_EVENT, IN_PROGRESS);
-
- DoCast(me, SPELL_MINI, false);
}
void SpawnAdds()
{
+ uint8 u = 0;
+
for (uint8 i = 0; i < 30; ++i)
{
- Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0);
+ Position pos;
+ me->GetPosition(&pos);
+ me->GetRandomNearPosition(pos, 30.0f);
+ pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
- if (victim)
+ if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
{
- Position pos;
- victim->GetPosition(&pos);
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- me->SummonCreature(NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- me->SummonCreature(NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
+ Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true);
+ Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true);
+ if (temp1 || temp2)
+ {
+ trigger->DisappearAndDie();
+ }
+ else
+ {
+ u = 1 - u;
+ trigger->DisappearAndDie();
+ me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60*IN_MILLISECONDS);
+ }
}
}
}
void UpdateAI(const uint32 diff)
{
- //Return since we have no target
if (!UpdateVictim())
return;
- if (uiSpawnTimer <= diff)
- {
- SpawnAdds();
- uiSpawnTimer = urand(35*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else uiSpawnTimer -= diff;
-
- if (uiRootTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_ENTANGLING_ROOTS);
- uiRootTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiRootTimer -= diff;
+ events.Update(diff);
- if (uiBashTimer <= diff)
- {
- DoCastVictim(SPELL_BASH);
- uiBashTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiBashTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (uiBoltTimer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_VENOM_BOLT_VOLLEY);
- uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiBoltTimer -= diff;
-
+ switch (eventId)
+ {
+ case EVENT_SPAWN:
+ SpawnAdds();
+ events.ScheduleEvent(EVENT_SPAWN, 20*IN_MILLISECONDS);
+ break;
+ case EVENT_MINI:
+ DoCast(SPELL_MINI);
+ events.ScheduleEvent(EVENT_MINI, urand(25,30)*IN_MILLISECONDS);
+ break;
+ case EVENT_ROOT:
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_ENTANGLING_ROOTS,true);
+ events.ScheduleEvent(EVENT_ROOT, urand(10,15)*IN_MILLISECONDS);
+ break;
+ case EVENT_BASH:
+ DoCastVictim(SPELL_BASH);
+ events.ScheduleEvent(EVENT_BASH, urand(7,12)*IN_MILLISECONDS);
+ break;
+ case EVENT_BOLT:
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_VENOM_BOLT_VOLLEY,true);
+ events.ScheduleEvent(EVENT_BOLT, urand(18,22)*IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
+ }
DoMeleeAttackIfReady();
}
};
@@ -170,30 +186,26 @@ public:
{
mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
- uint32 uiAuraTimer;
- uint32 uiDeathTimer;
+ EventMap events;
void Reset()
{
- DoCast(me, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell...
+ events.Reset();
+ events.ScheduleEvent(EVENT_AURA, 1*IN_MILLISECONDS);
+
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
+ DoCast(SPELL_PUTRID_MUSHROOM);
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
-
- uiAuraTimer = 0;
- uiDeathTimer = 30*IN_MILLISECONDS;
+ DoCast(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA);
+ else
+ DoCast(SPELL_POWER_MUSHROOM_VISUAL_AURA);
}
- void JustDied(Unit* killer)
+ void DamageTaken(Unit* /*attacker*/, uint32 &damage)
{
- if (!killer)
- return;
-
- if (me->GetEntry() == NPC_HEALTHY_MUSHROOM && killer->GetTypeId() == TYPEID_PLAYER)
- {
- me->InterruptNonMeleeSpells(false);
- DoCast(killer, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, false);
- }
+ if (damage >= me->GetHealth() && me->GetEntry() == NPC_HEALTHY_MUSHROOM)
+ DoCast(me, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true);
}
void EnterCombat(Unit* /*who*/) {}
@@ -201,18 +213,30 @@ public:
void UpdateAI(const uint32 diff)
{
- if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (uiAuraTimer <= diff)
+ switch (eventId)
{
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
- DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false);
- uiAuraTimer = 7*IN_MILLISECONDS;
- } else uiAuraTimer -= diff;
+ case EVENT_AURA:
+ if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
+ {
+ DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
+ DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
+ }
+ events.ScheduleEvent(EVENT_AURA, 7*IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
}
- if (uiDeathTimer <= diff)
- me->DisappearAndDie();
- else uiDeathTimer -= diff;
}
};
@@ -224,6 +248,6 @@ public:
void AddSC_boss_amanitar()
{
- new boss_amanitar;
- new mob_amanitar_mushrooms;
-}
+ new boss_amanitar();
+ new mob_amanitar_mushrooms();
+} \ No newline at end of file
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
index 7c167fb9c27..02dcc04abd6 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -23,22 +23,15 @@
#include "ScriptedCreature.h"
#include "ahnkahet.h"
+
enum Yells
{
- TEXT_AGGRO = -1619000,
- TEXT_SACRIFICE_1_1 = -1619001,
- TEXT_SACRIFICE_1_2 = -1619002,
- TEXT_SACRIFICE_2_1 = -1619003,
- TEXT_SACRIFICE_2_2 = -1619004,
- TEXT_SLAY_1 = -1619005,
- TEXT_SLAY_2 = -1619006,
- TEXT_SLAY_3 = -1619007,
- TEXT_DEATH = -1619008,
- TEXT_PREACHING_1 = -1619009,
- TEXT_PREACHING_2 = -1619010,
- TEXT_PREACHING_3 = -1619011,
- TEXT_PREACHING_4 = -1619012,
- TEXT_PREACHING_5 = -1619013
+ TEXT_AGGRO = 0,
+ TEXT_SACRIFICE_1 = 1,
+ TEXT_SACRIFICE_2 = 2,
+ TEXT_SLAY = 3,
+ TEXT_DEATH = 4,
+ TEXT_PREACHING = 5
};
enum Spells
@@ -129,7 +122,7 @@ public:
if (!instance || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
return;
- DoScriptText(TEXT_AGGRO, me);
+ Talk(TEXT_AGGRO);
me->SetInCombatWithZone();
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS);
}
@@ -147,12 +140,12 @@ public:
if (!Victim || Victim->GetTypeId() != TYPEID_PLAYER)
return;
- DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), me);
+ Talk(TEXT_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(TEXT_DEATH, me);
+ Talk(TEXT_DEATH);
if (instance)
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE);
}
@@ -178,7 +171,7 @@ public:
if (!bPreDone && who->GetTypeId() == TYPEID_PLAYER && me->GetDistance(who) < 100.0f)
{
- DoScriptText(RAND(TEXT_PREACHING_1, TEXT_PREACHING_2, TEXT_PREACHING_3, TEXT_PREACHING_4, TEXT_PREACHING_5), me);
+ Talk(TEXT_PREACHING);
bPreDone = true;
}
@@ -270,7 +263,7 @@ public:
if (opfer)
{
- DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), me);
+ Talk(TEXT_SACRIFICE_1);
instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
} else
bCanDown = true;
@@ -278,7 +271,7 @@ public:
void Opfern()
{
- DoScriptText(RAND(TEXT_SACRIFICE_2_1, TEXT_SACRIFICE_2_2), me);
+ Talk(TEXT_SACRIFICE_2);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_GIFT_OF_THE_HERALD, false);
@@ -534,11 +527,11 @@ public:
{
npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature)
{
- instance = creature->GetInstanceScript();
- bRemoved = false;
- bRemoved2 = false;
- bCasted = false;
- bCasted2 = false;
+ instance = creature->GetInstanceScript();
+ bRemoved = false;
+ bRemoved2 = false;
+ bCasted = false;
+ bCasted2 = false;
}
InstanceScript* instance;
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
index f8e2fc0f99f..4729f68680e 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -140,8 +140,8 @@ public:
{
float angle, x, y;
angle = pSpheres[0]->GetAngle(pSphereTarget);
- x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle);
- y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle);
+ x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
+ y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ());
}
if (IsHeroic())
@@ -154,12 +154,12 @@ public:
{
float angle, x, y;
angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
- y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
+ x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ());
angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
- y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
+ x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ());
}
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
index c4008564029..61d693104fa 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -42,6 +42,8 @@ enum Events
EVENT_FLIGHT = 2,
EVENT_FLAME_BREATH = 3,
EVENT_CONFLAGRATION = 4,
+ EVENT_LAND_GROUND = 5,
+ EVENT_AIR_MOVEMENT = 6,
// Event group
EVENT_GROUP_LAND_PHASE = 1,
@@ -51,6 +53,8 @@ enum MovementPoints
{
POINT_FLIGHT = 1,
POINT_LAND = 2,
+ POINT_TAKEOFF = 3,
+ POINT_LAND_GROUND = 4
};
enum Misc
@@ -58,8 +62,9 @@ enum Misc
SOUND_ID_DEATH = 17531,
};
-Position const SavianaRagefireFlyPos = {3155.51f, 683.844f, 95.20f, 4.69f};
-Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 79.54f, 4.69f};
+Position const SavianaRagefireFlyOutPos = {3155.51f, 683.844f, 95.0f, 4.69f};
+Position const SavianaRagefireFlyInPos = {3151.07f, 636.443f, 79.540f, 4.69f};
+Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 78.649f, 4.69f};
class boss_saviana_ragefire : public CreatureScript
{
@@ -96,7 +101,7 @@ class boss_saviana_ragefire : public CreatureScript
void MovementInform(uint32 type, uint32 point)
{
- if (type != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
return;
switch (point)
@@ -106,13 +111,18 @@ class boss_saviana_ragefire : public CreatureScript
Talk(SAY_CONFLAGRATION);
break;
case POINT_LAND:
+ events.ScheduleEvent(EVENT_LAND_GROUND, 1);
+ break;
+ case POINT_LAND_GROUND:
me->SetCanFly(false);
me->SetDisableGravity(false);
+ me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetReactState(REACT_AGGRESSIVE);
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
- me->GetMotionMaster()->MovementExpired();
DoStartMovement(me->getVictim());
break;
+ case POINT_TAKEOFF:
+ events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1);
+ break;
default:
break;
}
@@ -149,8 +159,13 @@ class boss_saviana_ragefire : public CreatureScript
{
me->SetCanFly(true);
me->SetDisableGravity(true);
+ me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetReactState(REACT_PASSIVE);
- me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos);
+ me->AttackStop();
+ Position pos;
+ pos.Relocate(me);
+ pos.m_positionZ += 10.0f;
+ me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos);
events.ScheduleEvent(EVENT_FLIGHT, 50000);
events.DelayEvents(12500, EVENT_GROUP_LAND_PHASE);
break;
@@ -167,6 +182,12 @@ class boss_saviana_ragefire : public CreatureScript
DoCastVictim(SPELL_FLAME_BREATH);
events.ScheduleEvent(EVENT_FLAME_BREATH, urand(20000, 30000), EVENT_GROUP_LAND_PHASE);
break;
+ case EVENT_AIR_MOVEMENT:
+ me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyOutPos);
+ break;
+ case EVENT_LAND_GROUND:
+ me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SavianaRagefireLandPos);
+ break;
default:
break;
}
@@ -243,7 +264,7 @@ class spell_saviana_conflagration_throwback : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
- GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireLandPos);
+ GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireFlyInPos);
}
void Register()
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index 6e7e3c49ef8..1b12f17ce64 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -1585,7 +1585,7 @@ class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount());
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
dmgInfo.AbsorbDamage(absorbAmount);
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index 9f9223f0161..eb0b3692f01 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -129,14 +129,14 @@ public:
{
if (uiCrystalSpikesTimer2 <= diff)
{
- fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
- fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
- fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
- fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
- fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
- fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
- fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
- fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
+ fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
+ fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
+ fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
+ fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
+ fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
+ fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2)));
+ fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
+ fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2)));
for (uint8 i = 0; i < 4; ++i)
me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS);
if (++uiCrystalSpikesCount >= 13)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index dcd3a3a91f5..67122b2e859 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -521,7 +521,7 @@ class boss_algalon_the_observer : public CreatureScript
if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
}
- else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
+ else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePct<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
{
_fightWon = true;
damage = 0;
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
index e3b1a7e94e1..2937a5b9987 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -181,8 +181,8 @@ class boss_warp_splinter : public CreatureScript
{
float angle = (M_PI / 3) * i;
- float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle);
- float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle);
+ float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle);
+ float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle);
float O = - me->GetAngle(X, Y);
if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000))
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 96897ae3033..8398e48e09f 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -194,7 +194,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
- amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
+ amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
void OnPeriodic(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index a1c48878507..b46d2083ecd 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -70,7 +70,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -118,7 +118,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
+ absorbAmount = std::min(CalculatePct(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
}
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
@@ -179,7 +179,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -413,7 +413,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
- AddPctF(multiplier, aurEff->GetAmount());
+ AddPct(multiplier, aurEff->GetAmount());
}
}
@@ -425,7 +425,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
int32 bp = GetHitDamage() * multiplier;
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
- AddPctN(bp, aurEff->GetAmount());
+ AddPct(bp, aurEff->GetAmount());
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
@@ -472,7 +472,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader
{
// You have a chance equal to your Parry chance
if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance()))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -582,7 +582,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
// Damage that would take you below [effect0] health or taken while you are at [effect0]
if (remainingHp < minHp)
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -722,7 +722,7 @@ class spell_dk_death_strike : public SpellScriptLoader
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
- AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
+ AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
}
}
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 32a92da5e3a..2c873c84f74 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -181,7 +181,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
// restore mana
- int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
return;
}
@@ -204,7 +204,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
// restore mana
- int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
return;
}
@@ -255,7 +255,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Moonkin Form
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -327,7 +327,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Cat Form
if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -369,7 +369,7 @@ class spell_dru_savage_defense : public SpellScriptLoader
void Absorb(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
{
- absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
+ absorbAmount = uint32(CalculatePct(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
aurEff->SetAmount(0);
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 3085472749c..5cc31ad54e8 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1236,7 +1236,7 @@ class spell_gen_lifeblood : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
- amount += int32(CalculatePctF(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
+ amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
}
void Register()
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index e445f68cfba..31aafe8dd38 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -138,7 +138,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
- ApplyPctN(basePoint, TickCount * 40);
+ ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
@@ -148,11 +148,11 @@ class spell_hun_chimera_shot : public SpellScriptLoader
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
- basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
+ basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget?
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
- ApplyPctN(basePoint, TickCount * 60);
+ ApplyPct(basePoint, TickCount * 60);
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 0edfbaee437..f4bbccc8587 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -292,7 +292,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
{
- int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+ int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 7be80088101..41bda3c163d 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -112,7 +112,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
? dmgInfo.GetDamage()
: allowedHealth - remainingHealth;
- absorbAmount = CalculatePctN(damageToReduce, absorbPct);
+ absorbAmount = CalculatePct(damageToReduce, absorbPct);
}
}
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 7830d46260c..df6c311ca67 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -243,7 +243,7 @@ public:
if (pet->isPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+ float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
amount += ownerBonus;
}
@@ -313,7 +313,7 @@ public:
if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
{
float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
- amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount());
+ amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
}
}
}
@@ -382,7 +382,7 @@ public:
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
+ ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
amount += ownerBonus;
_tempBonus = ownerBonus;
@@ -434,7 +434,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
}
@@ -446,7 +446,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
}
@@ -493,7 +493,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
}
@@ -505,7 +505,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
}
@@ -517,7 +517,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
}
@@ -560,7 +560,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
}
@@ -686,7 +686,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
- amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount());
+ amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -708,7 +708,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
- amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount());
+ amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -898,7 +898,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
@@ -941,7 +941,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
@@ -971,7 +971,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
@@ -1028,7 +1028,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
@@ -1047,7 +1047,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
@@ -1066,7 +1066,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
@@ -1115,7 +1115,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
@@ -1134,7 +1134,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
@@ -1153,7 +1153,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
@@ -1544,12 +1544,12 @@ public:
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
- mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
if (aurEff)
- mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod;
amount += ownerBonus;
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 3d8ca3e729b..aee3889e93b 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -278,7 +278,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
if (GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
- int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+ int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
@@ -316,7 +316,7 @@ public:
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0))
{
int32 heal = GetHitHeal();
- AddPctN(heal, aurEff->GetAmount());
+ AddPct(heal, aurEff->GetAmount());
SetHitHeal(heal);
}
}
@@ -432,7 +432,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader
// Pain and Suffering reduces damage
if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index ad437c5e431..ab6d0e95c1d 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -124,7 +124,7 @@ class spell_rog_nerves_of_steel : public SpellScriptLoader
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index c863c2363af..e107ea954e4 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -78,7 +78,7 @@ class spell_sha_astral_shift : public SpellScriptLoader
{
// reduces all damage taken while stun, fear or silence
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -184,7 +184,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader
if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
effValue += dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
- int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
+ int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue));
caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
}
}
@@ -501,11 +501,11 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
// Restorative Totems
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
- AddPctN(damage, dummy->GetAmount());
+ AddPct(damage, dummy->GetAmount());
// Glyph of Healing Stream Totem
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL));
}
@@ -592,7 +592,7 @@ class spell_sha_lava_lash : public SpellScriptLoader
{
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
- AddPctN(hitDamage, damage);
+ AddPct(hitDamage, damage);
SetHitDamage(hitDamage);
}
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 0def62b7d3a..aa56f8300bc 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -410,7 +410,7 @@ class spell_warl_life_tap : public SpellScriptLoader
// Improved Life Tap mod
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0))
- AddPctN(mana, aurEff->GetAmount());
+ AddPct(mana, aurEff->GetAmount());
caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
@@ -421,7 +421,7 @@ class spell_warl_life_tap : public SpellScriptLoader
if (manaFeedVal > 0)
{
- ApplyPctN(manaFeedVal, mana);
+ ApplyPct(manaFeedVal, mana);
caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
}
}
@@ -544,7 +544,7 @@ class spell_warl_haunt : public SpellScriptLoader
{
if (Aura* aura = GetHitAura())
if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
- aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
+ aurEff->SetAmount(CalculatePct(aurEff->GetAmount(), GetHitDamage()));
}
void Register()
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index c64101e11ea..cc8dbe35703 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -183,7 +183,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader
// apply percent damage mods
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
- ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
+ ApplyPct(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
@@ -368,7 +368,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
- SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
+ SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
}
void Register()
@@ -400,7 +400,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader
void HandleDamage(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
- ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
+ ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
if (Unit* target = GetHitUnit())
{
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 5640a84317c..9ade37a1096 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1954,8 +1954,8 @@ public:
me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING);
me->SetSpeed(MOVE_FLIGHT, 0.75f, true);
me->SetSpeed(MOVE_RUN, 0.75f, true);
- float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
- float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
+ float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation());
+ float y = me->GetPositionY() + 20 * std::sin(me->GetOrientation());
float z = me->GetPositionZ() + 40;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(0, x, y, z);
diff --git a/src/server/shared/CompilerDefs.h b/src/server/shared/CompilerDefs.h
index f7e3d0b4979..b8be66d928f 100755
--- a/src/server/shared/CompilerDefs.h
+++ b/src/server/shared/CompilerDefs.h
@@ -50,12 +50,20 @@
# define COMPILER COMPILER_INTEL
#elif defined( __GNUC__ )
# define COMPILER COMPILER_GNU
+# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#else
-# pragma error "FATAL ERROR: Unknown compiler."
+# error "FATAL ERROR: Unknown compiler."
#endif
#if COMPILER == COMPILER_MICROSOFT
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
# pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
#endif
+
+#if defined(__cplusplus) && __cplusplus == 201103L
+# define COMPILER_HAS_CPP11_SUPPORT 1
+#else
+# define COMPILER_HAS_CPP11_SUPPORT 0
+#endif
+
#endif
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index c597476967d..b0b79ac0a33 100755
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -41,7 +41,7 @@ struct MySQLConnectionInfo
MySQLConnectionInfo() {}
MySQLConnectionInfo(const std::string& infoString)
{
- Tokens tokens(infoString, ';');
+ Tokenizer tokens(infoString, ';');
if (tokens.size() != 5)
return;
diff --git a/src/server/shared/Dynamic/HashNamespace.h b/src/server/shared/Dynamic/HashNamespace.h
new file mode 100644
index 00000000000..c7b5a817b76
--- /dev/null
+++ b/src/server/shared/Dynamic/HashNamespace.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_HASH_NAMESPACE_H
+#define TRINITY_HASH_NAMESPACE_H
+
+#include "Define.h"
+
+#if COMPILER_HAS_CPP11_SUPPORT
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif defined(_STLPORT_VERSION)
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
+# define HASH_NAMESPACE_START namespace std { namespace tr1 {
+# define HASH_NAMESPACE_END } }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
+# define HASH_NAMESPACE_START namespace stdext {
+# define HASH_NAMESPACE_END }
+
+#if !_HAS_TRADITIONAL_STL
+#ifndef HASH_NAMESPACE
+#define HASH_NAMESPACE
+#else
+
+// can be not used by some platforms, so provide fake forward
+HASH_NAMESPACE_START
+
+template<class K>
+class hash
+{
+public:
+ size_t operator() (K const&);
+};
+
+HASH_NAMESPACE_END
+
+#endif
+#endif
+
+#elif COMPILER == COMPILER_INTEL
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define HASH_NAMESPACE_START namespace std { namespace tr1 {
+# define HASH_NAMESPACE_END } }
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define HASH_NAMESPACE_START namespace __gnu_cxx {
+# define HASH_NAMESPACE_END }
+
+#include <ext/hash_fun.h>
+#include <string>
+
+HASH_NAMESPACE_START
+
+template<>
+class hash<unsigned long long>
+{
+public:
+ size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
+};
+
+template<typename T>
+class hash<T *>
+{
+public:
+ size_t operator()(T * const &__x) const { return (size_t)__x; }
+};
+
+template<> struct hash<std::string>
+{
+ size_t operator()(const std::string &__x) const
+ {
+ return hash<char const *>()(__x.c_str());
+ }
+};
+
+HASH_NAMESPACE_END
+
+#else
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#endif
+
+#if COMPILER != COMPILER_MICROSOFT
+
+// Visual Studio use non standard hash calculation function, so provide fake forward for other
+HASH_NAMESPACE_START
+
+template<class K>
+size_t hash_value(K const&);
+
+HASH_NAMESPACE_END
+
+#endif
+
+#endif
diff --git a/src/server/shared/Dynamic/LinkedList.h b/src/server/shared/Dynamic/LinkedList.h
index 29cbeb2e66c..3969e22aa14 100755
--- a/src/server/shared/Dynamic/LinkedList.h
+++ b/src/server/shared/Dynamic/LinkedList.h
@@ -19,7 +19,8 @@
#ifndef _LINKEDLIST
#define _LINKEDLIST
-#include "Common.h"
+#include "Define.h"
+#include <iterator>
//============================================
class LinkedListHead;
@@ -32,7 +33,7 @@ class LinkedListElement
LinkedListElement* iNext;
LinkedListElement* iPrev;
public:
- LinkedListElement() { iNext = NULL; iPrev = NULL; }
+ LinkedListElement(): iNext(NULL), iPrev(NULL) {}
~LinkedListElement() { delink(); }
bool hasNext() const { return(iNext && iNext->iNext != NULL); }
@@ -83,13 +84,12 @@ class LinkedListHead
LinkedListElement iLast;
uint32 iSize;
public:
- LinkedListHead()
+ LinkedListHead(): iSize(0)
{
// create empty list
iFirst.iNext = &iLast;
iLast.iPrev = &iFirst;
- iSize = 0;
}
bool isEmpty() const { return(!iFirst.iNext->isInList()); }
@@ -153,13 +153,14 @@ class LinkedListHead
Iterator& operator=(Iterator const &_Right)
{
- return (*this) = _Right._Ptr;
+ _Ptr = _Right._Ptr;
+ return *this;
}
Iterator& operator=(const_pointer const &_Right)
{
- _Ptr = (pointer)_Right;
- return (*this);
+ _Ptr = pointer(_Right);
+ return *this;
}
reference operator*()
@@ -242,4 +243,3 @@ class LinkedListHead
//============================================
#endif
-
diff --git a/src/server/shared/Dynamic/LinkedReference/Reference.h b/src/server/shared/Dynamic/LinkedReference/Reference.h
index d4c607470cc..6c9710381b9 100755
--- a/src/server/shared/Dynamic/LinkedReference/Reference.h
+++ b/src/server/shared/Dynamic/LinkedReference/Reference.h
@@ -57,13 +57,21 @@ template <class TO, class FROM> class Reference : public LinkedListElement
// We don't need the reference anymore. Call comes from the refFrom object
// Tell our refTo object, that the link is cut
- void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; }
+ void unlink()
+ {
+ targetObjectDestroyLink();
+ delink();
+ iRefTo = NULL;
+ iRefFrom = NULL;
+ }
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
// Tell our refFrom object, that the link is cut
void invalidate() // the iRefFrom MUST remain!!
{
- sourceObjectDestroyLink(); delink(); iRefTo = NULL;
+ sourceObjectDestroyLink();
+ delink();
+ iRefTo = NULL;
}
bool isValid() const // Only check the iRefTo
@@ -89,4 +97,3 @@ template <class TO, class FROM> class Reference : public LinkedListElement
//=====================================================
#endif
-
diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h
index ca481671796..bb3227514a7 100755
--- a/src/server/shared/Dynamic/ObjectRegistry.h
+++ b/src/server/shared/Dynamic/ObjectRegistry.h
@@ -101,7 +101,6 @@ class ObjectRegistry
}
private:
RegistryMapType i_registeredObjects;
-
};
-#endif
+#endif
diff --git a/src/server/shared/Dynamic/UnorderedMap.h b/src/server/shared/Dynamic/UnorderedMap.h
index 5e7b48f9b7b..5d485efa89b 100755
--- a/src/server/shared/Dynamic/UnorderedMap.h
+++ b/src/server/shared/Dynamic/UnorderedMap.h
@@ -19,55 +19,54 @@
#ifndef TRINITY_UNORDERED_MAP_H
#define TRINITY_UNORDERED_MAP_H
-#include "CompilerDefs.h"
-#include "Define.h"
+#include "HashNamespace.h"
-#if COMPILER == COMPILER_INTEL
-#include <ext/hash_map>
-#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#include <tr1/unordered_map>
-#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
-#include <ext/hash_map>
-#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 // VC9.0 and later
-#include <unordered_map>
+#if COMPILER_HAS_CPP11_SUPPORT
+# include <unordered_map>
+#elif COMPILER == COMPILER_INTEL
+# include <ext/hash_map>
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# include <unordered_map>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# include <tr1/unordered_map>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# include <ext/hash_map>
+#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later
+# include <unordered_map>
#else
-#include <hash_map>
+# include <hash_map>
#endif
#ifdef _STLPORT_VERSION
-#define UNORDERED_MAP std::hash_map
-using std::hash_map;
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
+#elif COMPILER_HAS_CPP11_SUPPORT
+# define UNORDERED_MAP std::unordered_map
+# define UNORDERED_MULTIMAP std::unordered_multimap
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
-#define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
-#define UNORDERED_MAP stdext::hash_map
-using stdext::hash_map;
-#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#define UNORDERED_MAP std::tr1::unordered_map
-#elif (COMPILER == COMPILER_GNU && __GNUC__ >= 3) || COMPILER == COMPILER_INTEL
-#define UNORDERED_MAP __gnu_cxx::hash_map
-
-namespace __gnu_cxx
-{
- template<> struct hash<unsigned long long>
- {
- size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
- };
- template<typename T> struct hash<T *>
- {
- size_t operator()(T * const &__x) const { return (size_t)__x; }
- };
- template<> struct hash<std::string>
- {
- size_t operator()(const std::string &__x) const
- {
- return hash<const char *>()(__x.c_str());
- }
- };
-};
-
+# define UNORDERED_MAP stdext::hash_map
+# define UNORDERED_MULTIMAP stdext::hash_multimap
+#elif COMPILER == COMPILER_INTEL
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define UNORDERED_MAP std::unordered_map
+# define UNORDERED_MULTIMAP std::unordered_multimap
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define UNORDERED_MAP __gnu_cxx::hash_map
+# define UNORDERED_MULTIMAP __gnu_cxx::hash_multimap
#else
-#define UNORDERED_MAP std::hash_map
-using std::hash_map;
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
#endif
+
#endif
diff --git a/src/server/shared/Dynamic/UnorderedSet.h b/src/server/shared/Dynamic/UnorderedSet.h
new file mode 100644
index 00000000000..8c8d7c0d5dc
--- /dev/null
+++ b/src/server/shared/Dynamic/UnorderedSet.h
@@ -0,0 +1,66 @@
+/*
+* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2 of the License, or (at your
+* option) any later version.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef TRINITY_UNORDERED_SET_H
+#define TRINITY_UNORDERED_SET_H
+
+#include "HashNamespace.h"
+
+#if COMPILER_HAS_CPP11_SUPPORT
+# include <unordered_set>
+#elif COMPILER == COMPILER_INTEL
+# include <ext/hash_set>
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# include <unordered_set>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# include <tr1/unordered_set>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# include <ext/hash_set>
+#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later
+# include <unordered_set>
+#else
+# include <hash_set>
+#endif
+
+#ifdef _STLPORT_VERSION
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#elif COMPILER_HAS_CPP11_SUPPORT
+# define UNORDERED_SET std::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
+# define UNORDERED_SET stdext::hash_set
+using stdext::hash_set;
+#elif COMPILER == COMPILER_INTEL
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define UNORDERED_SET std::unordered_set
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define UNORDERED_SET __gnu_cxx::hash_set
+#else
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#endif
+
+#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 9f3c8f77739..4538fc75c1e 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -88,8 +88,8 @@ void Log::CreateAppenderFromConfig(const char* name)
std::string options = "Appender.";
options.append(name);
options = ConfigMgr::GetStringDefault(options.c_str(), "");
- Tokens tokens(options, ',');
- Tokens::iterator iter = tokens.begin();
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() < 2)
{
@@ -181,8 +181,8 @@ void Log::CreateLoggerFromConfig(const char* name)
return;
}
- Tokens tokens(options, ',');
- Tokens::iterator iter = tokens.begin();
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() != 3)
{
diff --git a/src/server/shared/Utilities/ByteConverter.h b/src/server/shared/Utilities/ByteConverter.h
index d0790acadd3..05e8b8cc959 100755
--- a/src/server/shared/Utilities/ByteConverter.h
+++ b/src/server/shared/Utilities/ByteConverter.h
@@ -24,12 +24,12 @@
*/
#include "Define.h"
-#include<algorithm>
+#include <algorithm>
namespace ByteConverter
{
template<size_t T>
- inline void convert(char *val)
+ inline void convert(char *val)
{
std::swap(*val, *(val + T - 1));
convert<T - 2>(val + 1);
diff --git a/src/server/shared/Utilities/EventProcessor.h b/src/server/shared/Utilities/EventProcessor.h
index 149ca9a4098..0f1a7c15216 100755
--- a/src/server/shared/Utilities/EventProcessor.h
+++ b/src/server/shared/Utilities/EventProcessor.h
@@ -21,7 +21,7 @@
#include "Define.h"
-#include<map>
+#include <map>
// Note. All times are in milliseconds here.
@@ -29,9 +29,7 @@ class BasicEvent
{
public:
BasicEvent() { to_Abort = false; }
- virtual ~BasicEvent() // override destructor to perform some actions on event removal
- {
- };
+ virtual ~BasicEvent() {} // override destructor to perform some actions on event removal
// this method executes when the event is triggered
// return false if event does not want to be deleted
@@ -68,4 +66,3 @@ class EventProcessor
bool m_aborting;
};
#endif
-
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 89942b978df..e5f62bf9e6b 100755
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -56,13 +56,13 @@ double rand_chance(void)
return sfmtRand->Random() * 100.0;
}
-Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
+Tokenizer::Tokenizer(const std::string &src, const char sep, uint32 vectorReserve)
{
m_str = new char[src.length() + 1];
memcpy(m_str, src.c_str(), src.length() + 1);
if (vectorReserve)
- reserve(vectorReserve);
+ m_storage.reserve(vectorReserve);
char* posold = m_str;
char* posnew = m_str;
@@ -71,17 +71,17 @@ Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
{
if (*posnew == sep)
{
- push_back(posold);
+ m_storage.push_back(posold);
posold = posnew + 1;
- *posnew = 0x00;
+ *posnew = '\0';
}
- else if (*posnew == 0x00)
+ else if (*posnew == '\0')
{
// Hack like, but the old code accepted these kind of broken strings,
// so changing it would break other things
if (posold != posnew)
- push_back(posold);
+ m_storage.push_back(posold);
break;
}
@@ -471,29 +471,21 @@ void vutf8printf(FILE* out, const char *str, va_list* ap)
#endif
}
-void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result)
+std::string ByteArrayToHexStr(uint8 const* bytes, uint32 arrayLen, bool reverse /* = false */)
{
- std::ostringstream ss;
- for (uint32 i=0; i<arrayLen; ++i)
+ int32 init = 0;
+ int32 end = arrayLen;
+ int8 op = 1;
+
+ if (reverse)
{
- for (uint8 j=0; j<2; ++j)
- {
- unsigned char nibble = 0x0F & (bytes[i]>>((1-j)*4));
- char encodedNibble;
- if (nibble < 0x0A)
- encodedNibble = '0'+nibble;
- else
- encodedNibble = 'A'+nibble-0x0A;
- ss << encodedNibble;
- }
+ init = arrayLen - 1;
+ end = -1;
+ op = -1;
}
- result = ss.str();
-}
-std::string ByteArrayToHexStr(uint8* bytes, uint32 length)
-{
std::ostringstream ss;
- for (uint32 i = 0; i < length; ++i)
+ for (int32 i = init; i != end; i += op)
{
char buffer[4];
sprintf(buffer, "%02X ", bytes[i]);
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index 37782c31d8b..1785df70a05 100755
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -19,27 +19,48 @@
#ifndef _UTIL_H
#define _UTIL_H
-#include "Common.h"
-#include "Containers.h"
+#include "Define.h"
+
#include <string>
#include <vector>
+#include <list>
// Searcher for map of structs
template<typename T, class S> struct Finder
{
T val_;
T S::* idMember_;
-
+
Finder(T val, T S::* idMember) : val_(val), idMember_(idMember) {}
bool operator()(const std::pair<int, S> &obj) { return obj.second.*idMember_ == val_; }
};
-struct Tokens: public std::vector<char*>
+class Tokenizer
{
- Tokens(const std::string &src, const char sep, uint32 vectorReserve = 0);
- ~Tokens() { delete[] m_str; }
+public:
+ typedef std::vector<char const *> StorageType;
+
+ typedef StorageType::size_type size_type;
+
+ typedef StorageType::const_iterator const_iterator;
+ typedef StorageType::reference reference;
+ typedef StorageType::const_reference const_reference;
+
+public:
+ Tokenizer(const std::string &src, char const sep, uint32 vectorReserve = 0);
+ ~Tokenizer() { delete[] m_str; }
+
+ const_iterator begin() const { return m_storage.begin(); }
+ const_iterator end() const { return m_storage.end(); }
+
+ size_type size() const { return m_storage.size(); }
+
+ reference operator [] (size_type i) { return m_storage[i]; }
+ const_reference operator [] (size_type i) const { return m_storage[i]; }
+private:
char* m_str;
+ StorageType m_storage;
};
void stripLineInvisibleChars(std::string &src);
@@ -49,27 +70,29 @@ uint32 TimeStringToSecs(const std::string& timestring);
std::string TimeToTimestampStr(time_t t);
/* Return a random number in the range min..max; (max-min) must be smaller than 32768. */
- int32 irand(int32 min, int32 max);
+int32 irand(int32 min, int32 max);
/* Return a random number in the range min..max (inclusive). For reliable results, the difference
* between max and min should be less than RAND32_MAX. */
- uint32 urand(uint32 min, uint32 max);
+uint32 urand(uint32 min, uint32 max);
/* Return a random number in the range 0 .. RAND32_MAX. */
- int32 rand32();
+int32 rand32();
- /* Return a random number in the range min..max */
- float frand(float min, float max);
+/* Return a random number in the range min..max */
+float frand(float min, float max);
/* Return a random double from 0.0 to 1.0 (exclusive). Floats support only 7 valid decimal digits.
* A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits).
- * With an FPU, there is usually no difference in performance between float and double. */
- double rand_norm(void);
+ * With an FPU, there is usually no difference in performance between float and double.
+*/
+double rand_norm(void);
/* Return a random double from 0.0 to 99.9999999999999. Floats support only 7 valid decimal digits.
* A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits).
- * With an FPU, there is usually no difference in performance between float and double. */
- double rand_chance(void);
+ * With an FPU, there is usually no difference in performance between float and double.
+*/
+double rand_chance(void);
/* Return true if a random roll fits in the specified chance (range 0-100). */
inline bool roll_chance_f(float chance)
@@ -91,58 +114,22 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
}
// Percentage calculation
-template <class T>
-inline T CalculatePctF(T base, float pct)
-{
- return T(base * pct / 100.0f);
-}
-
-template <class T>
-inline T CalculatePctN(T base, int32 pct)
-{
- return T(base * float(pct) / 100.0f);
-}
-
-template <class T>
-inline T CalculatePctU(T base, uint32 pct)
+template <class T, class U>
+inline T CalculatePct(T base, U pct)
{
- return T(base * float(pct) / 100.0f);
+ return T(base * static_cast<float>(pct) / 100.0f);
}
-template <class T>
-inline T AddPctF(T& base, float pct)
-{
- return base += CalculatePctF(base, pct);
-}
-
-template <class T>
-inline T AddPctN(T& base, int32 pct)
-{
- return base += CalculatePctN(base, pct);
-}
-
-template <class T>
-inline T AddPctU(T& base, uint32 pct)
-{
- return base += CalculatePctU(base, pct);
-}
-
-template <class T>
-inline T ApplyPctF(T& base, float pct)
-{
- return base = CalculatePctF(base, pct);
-}
-
-template <class T>
-inline T ApplyPctN(T& base, int32 pct)
+template <class T, class U>
+inline T AddPct(T &base, U pct)
{
- return base = CalculatePctN(base, pct);
+ return base += CalculatePct(base, pct);
}
-template <class T>
-inline T ApplyPctU(T& base, uint32 pct)
+template <class T, class U>
+inline T ApplyPct(T &base, U pct)
{
- return base = CalculatePctU(base, pct);
+ return base = CalculatePct(base, pct);
}
template <class T>
@@ -355,8 +342,7 @@ void vutf8printf(FILE* out, const char *str, va_list* ap);
bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename);
-void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result);
-std::string ByteArrayToHexStr(uint8* bytes, uint32 length);
+std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, bool reverse = false);
#endif
//handler for operations on large flags
@@ -404,232 +390,140 @@ class flag96
{
private:
uint32 part[3];
+
public:
- flag96(uint32 p1=0, uint32 p2=0, uint32 p3=0)
+ flag96(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0)
{
- part[0]=p1;
- part[1]=p2;
- part[2]=p3;
+ part[0] = p1;
+ part[1] = p2;
+ part[2] = p3;
}
flag96(uint64 p1, uint32 p2)
{
- part[0]=PAIR64_LOPART(p1);
- part[1]=PAIR64_HIPART(p1);
- part[2]=p2;
+ part[0] = PAIR64_LOPART(p1);
+ part[1] = PAIR64_HIPART(p1);
+ part[2] = p2;
}
- inline bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
+ inline bool IsEqual(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
{
- return (
- part[0]==p1 &&
- part[1]==p2 &&
- part[2]==p3);
- };
-
- inline bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
- {
- return (
- part[0]&p1 ||
- part[1]&p2 ||
- part[2]&p3);
- };
+ return (part[0] == p1 && part[1] == p2 && part[2] == p3);
+ }
- inline void Set(uint32 p1=0, uint32 p2=0, uint32 p3=0)
+ inline bool HasFlag(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
{
- part[0]=p1;
- part[1]=p2;
- part[2]=p3;
- };
+ return (part[0] & p1 || part[1] & p2 || part[2] & p3);
+ }
- template<class type>
- inline bool operator < (type & right)
+ inline void Set(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0)
{
- for (uint8 i=3; i > 0; --i)
- {
- if (part[i-1]<right.part[i-1])
- return 1;
- else if (part[i-1]>right.part[i-1])
- return 0;
- }
- return 0;
+ part[0] = p1;
+ part[1] = p2;
+ part[2] = p3;
}
- template<class type>
- inline bool operator < (type & right) const
+ inline bool operator <(const flag96 &right) const
{
for (uint8 i = 3; i > 0; --i)
{
- if (part[i-1]<right.part[i-1])
- return 1;
- else if (part[i-1]>right.part[i-1])
- return 0;
- }
- return 0;
- }
-
- template<class type>
- inline bool operator != (type & right)
- {
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
+ if (part[i - 1] < right.part[i - 1])
return true;
+ else if (part[i - 1] > right.part[i - 1])
+ return false;
+ }
return false;
}
- template<class type>
- inline bool operator != (type & right) const
+ inline bool operator ==(const flag96 &right) const
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return true;
- return false;
+ return
+ (
+ part[0] == right.part[0] &&
+ part[1] == right.part[1] &&
+ part[2] == right.part[2]
+ );
}
- template<class type>
- inline bool operator == (type & right)
+ inline bool operator !=(const flag96 &right) const
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
+ return !this->operator ==(right);
}
- template<class type>
- inline bool operator == (type & right) const
+ inline flag96 & operator =(const flag96 &right)
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
+ part[0] = right.part[0];
+ part[1] = right.part[1];
+ part[2] = right.part[2];
+ return *this;
}
- template<class type>
- inline void operator = (type & right)
+ inline flag96 operator &(const flag96 &right) const
{
- part[0]=right.part[0];
- part[1]=right.part[1];
- part[2]=right.part[2];
+ return flag96(part[0] & right.part[0], part[1] & right.part[1],
+ part[2] & right.part[2]);
}
- template<class type>
- inline flag96 operator & (type & right)
+ inline flag96 & operator &=(const flag96 &right)
{
- flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
- return
- ret;
+ part[0] &= right.part[0];
+ part[1] &= right.part[1];
+ part[2] &= right.part[2];
+ return *this;
}
- template<class type>
- inline flag96 operator & (type & right) const
+ inline flag96 operator |(const flag96 &right) const
{
- flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
- return
- ret;
+ return flag96(part[0] | right.part[0], part[1] | right.part[1],
+ part[2] | right.part[2]);
}
- template<class type>
- inline void operator &= (type & right)
+ inline flag96 & operator |=(const flag96 &right)
{
- *this=*this & right;
+ part[0] |= right.part[0];
+ part[1] |= right.part[1];
+ part[2] |= right.part[2];
+ return *this;
}
- template<class type>
- inline flag96 operator | (type & right)
+ inline flag96 operator ~() const
{
- flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
- return
- ret;
+ return flag96(~part[0], ~part[1], ~part[2]);
}
- template<class type>
- inline flag96 operator | (type & right) const
+ inline flag96 operator ^(const flag96 &right) const
{
- flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
- return
- ret;
+ return flag96(part[0] ^ right.part[0], part[1] ^ right.part[1],
+ part[2] ^ right.part[2]);
}
- template<class type>
- inline void operator |= (type & right)
+ inline flag96 & operator ^=(const flag96 &right)
{
- *this=*this | right;
+ part[0] ^= right.part[0];
+ part[1] ^= right.part[1];
+ part[2] ^= right.part[2];
+ return *this;
}
- inline void operator ~ ()
- {
- part[2]=~part[2];
- part[1]=~part[1];
- part[0]=~part[0];
- };
-
- template<class type>
- inline flag96 operator ^ (type & right)
+ inline operator bool() const
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
+ return (part[0] != 0 || part[1] != 0 || part[2] != 0);
}
- template<class type>
- inline flag96 operator ^ (type & right) const
+ inline bool operator !() const
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
+ return !this->operator bool();
}
- template<class type>
- inline void operator ^= (type & right)
+ inline uint32 & operator [](uint8 el)
{
- *this=*this^right;
+ return part[el];
}
- inline operator bool() const
- {
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
-
- inline operator bool()
+ inline const uint32 & operator [](uint8 el) const
{
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
-
- inline bool operator ! () const
- {
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
-
- inline bool operator ! ()
- {
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
-
- inline uint32 & operator[](uint8 el)
- {
- return (part[el]);
- };
-
- inline uint32 operator[](uint8 el) const
- {
- return (part[el]);
- };
+ return part[el];
+ }
};
#endif