aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-10-04 19:39:09 -0500
committerSubv <s.v.h21@hotmail.com>2012-10-04 19:39:09 -0500
commitf7d3600e7e7ffaba971b77e4371a705e55593cfd (patch)
tree2d4e898bb4e09ede5dba97918741597da6fd2d2e /src/server/game/Entities
parentd2437407f4f7ad1af3baeb351626b41bd700065c (diff)
parent74707a08d3d63dc66e7b6943431c91f50258b0f9 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Conflicts: src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
Diffstat (limited to 'src/server/game/Entities')
-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
13 files changed, 266 insertions, 268 deletions
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 cc800dce7b8..2c5d448cc63 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, pos.m_positionZ))
@@ -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 556a754cdf9..3742503c786 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 6d50155adfe..9b29d644c36 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1335,8 +1335,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 f9dfbacdf43..da15372ca16 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()));
}