mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Implement RATE_CREATURE_AGGRO
Make aggroRate a local variable and return aggro range of 0 if aggroRate is 0 to save unnecessary calculations.
This commit is contained in:
@@ -2699,6 +2699,10 @@ float Creature::GetAggroRange(Unit const* target) const
|
|||||||
// Determines the aggro range for creatures
|
// Determines the aggro range for creatures
|
||||||
// Based on data from wowwiki due to lack of 3.3.5a data
|
// Based on data from wowwiki due to lack of 3.3.5a data
|
||||||
|
|
||||||
|
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
|
||||||
|
if (aggroRate == 0)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
uint32 targetLevel = target->getLevelForTarget(this);
|
uint32 targetLevel = target->getLevelForTarget(this);
|
||||||
uint32 myLevel = getLevelForTarget(target);
|
uint32 myLevel = getLevelForTarget(target);
|
||||||
int32 levelDiff = int32(targetLevel) - int32(myLevel);
|
int32 levelDiff = int32(targetLevel) - int32(myLevel);
|
||||||
@@ -2729,7 +2733,7 @@ float Creature::GetAggroRange(Unit const* target) const
|
|||||||
if (aggroRadius < minRange)
|
if (aggroRadius < minRange)
|
||||||
aggroRadius = minRange;
|
aggroRadius = minRange;
|
||||||
|
|
||||||
return aggroRadius;
|
return (aggroRadius * aggroRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::SetObjectScale(float scale)
|
void Creature::SetObjectScale(float scale)
|
||||||
|
|||||||
Reference in New Issue
Block a user