[Performance] Don't process ProjectileAttack checks for NPC's that are not engaged in any combat

This commit is contained in:
Akkadius 2017-03-28 03:05:46 -05:00
parent f931ef7bcb
commit d777b1048d
4 changed files with 34 additions and 33 deletions

View File

@ -6,6 +6,7 @@ Akkadius: [Performance] Fixed a large overhead issue where every single NPC in a
Akkadius: [Performance] Removed a timer where clients would constantly calculate light amount on equipment every 600ms, instead Akkadius: [Performance] Removed a timer where clients would constantly calculate light amount on equipment every 600ms, instead
clients will update light when changing equipment or entering a zone clients will update light when changing equipment or entering a zone
Akkadius: [Performance] Disabled enraged timer checks for NPC's that do not actually have enrage as a special attack Akkadius: [Performance] Disabled enraged timer checks for NPC's that do not actually have enrage as a special attack
Akkadius: [Performance] Don't process ProjectileAttack checks for NPC's that are not engaged in any combat
== 03/27/2017 == == 03/27/2017 ==
Akkadius: [Performance] Reworked how client to NPC aggro checks are made Akkadius: [Performance] Reworked how client to NPC aggro checks are made

View File

@ -1011,8 +1011,8 @@ void Mob::AI_Process() {
CastToNPC()->CheckSignal(); CastToNPC()->CheckSignal();
} }
if (engaged) if (engaged) {
{
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive))) if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
SendAddPlayerState(PlayerState::Aggressive); SendAddPlayerState(PlayerState::Aggressive);
// we are prevented from getting here if we are blind and don't have a target in range // we are prevented from getting here if we are blind and don't have a target in range
@ -1039,8 +1039,7 @@ void Mob::AI_Process() {
if (!target) if (!target)
return; return;
if (target->IsCorpse()) if (target->IsCorpse()) {
{
RemoveFromHateList(this); RemoveFromHateList(this);
return; return;
} }
@ -1057,6 +1056,8 @@ void Mob::AI_Process() {
if (DivineAura()) if (DivineAura())
return; return;
ProjectileAttack();
auto npcSpawnPoint = CastToNPC()->GetSpawnPoint(); auto npcSpawnPoint = CastToNPC()->GetSpawnPoint();
if (GetSpecialAbility(TETHER)) { if (GetSpecialAbility(TETHER)) {
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0)); float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
@ -1255,6 +1256,7 @@ void Mob::AI_Process() {
} }
AI_EngagedCastCheck(); AI_EngagedCastCheck();
} //end is within combat rangepet } //end is within combat rangepet
else { else {
//we cannot reach our target... //we cannot reach our target...

View File

@ -587,8 +587,7 @@ void NPC::RemoveCash() {
bool NPC::Process() bool NPC::Process()
{ {
if (IsStunned() && stunned_timer.Check()) if (IsStunned() && stunned_timer.Check()) {
{
Mob::UnStun(); Mob::UnStun();
this->spun_timer.Disable(); this->spun_timer.Disable();
} }
@ -608,8 +607,7 @@ bool NPC::Process()
SpellProcess(); SpellProcess();
if(tic_timer.Check()) if (tic_timer.Check()) {
{
parse->EventNPC(EVENT_TICK, this, nullptr, "", 0); parse->EventNPC(EVENT_TICK, this, nullptr, "", 0);
BuffProcess(); BuffProcess();
@ -632,14 +630,17 @@ bool NPC::Process()
SetHP(GetHP() + GetNPCHPRegen()); SetHP(GetHP() + GetNPCHPRegen());
else else
SetHP(GetHP() + OOCRegen); SetHP(GetHP() + OOCRegen);
} else }
else
SetHP(GetHP() + GetNPCHPRegen()); SetHP(GetHP() + GetNPCHPRegen());
} else if(GetHP() < GetMaxHP() && GetOwnerID() !=0) { }
else if (GetHP() < GetMaxHP() && GetOwnerID() != 0) {
if (!IsEngaged()) //pet if (!IsEngaged()) //pet
SetHP(GetHP() + GetNPCHPRegen() + bonus + (GetLevel() / 5)); SetHP(GetHP() + GetNPCHPRegen() + bonus + (GetLevel() / 5));
else else
SetHP(GetHP() + GetNPCHPRegen() + bonus); SetHP(GetHP() + GetNPCHPRegen() + bonus);
} else }
else
SetHP(GetHP() + GetNPCHPRegen()); SetHP(GetHP() + GetNPCHPRegen());
if (GetMana() < GetMaxMana()) { if (GetMana() < GetMaxMana()) {
@ -693,8 +694,6 @@ bool NPC::Process()
viral_timer_counter = 0; viral_timer_counter = 0;
} }
ProjectileAttack();
if(spellbonuses.GravityEffect == 1) { if(spellbonuses.GravityEffect == 1) {
if(gravity_timer.Check()) if(gravity_timer.Check())
DoGravityEffect(); DoGravityEffect();

View File

@ -956,7 +956,6 @@ void Mob::ProjectileAttack()
{ {
if (!HasProjectileAttack()) if (!HasProjectileAttack())
return; return;
;
Mob *target = nullptr; Mob *target = nullptr;
bool disable = true; bool disable = true;