Fix previous commit. (#124)

* Fix "You are in combat" bug.

Ideas taken from TC

* Correct previous commit.

* Improved previous commits

- Creatures in dungeons will not remove distant players from their threat list
- Creatures in non dungeon maps will properly remove the distant players from their threat lists and also players auras from them

* Fix previous commit.

  -The creatures will remain tapped by the initial attacker.
  -Fix the loot bug
This commit is contained in:
H0zen 2016-05-15 23:55:24 +03:00 committed by Antz
parent 6d77f18394
commit 75d65f245a
2 changed files with 3 additions and 6 deletions

View File

@ -4219,6 +4219,9 @@ void Unit::RemoveAllAurasOnEvade()
RemoveSpellAuraHolder(iter->second, AURA_REMOVE_BY_DEFAULT);
iter = m_spellAuraHolders.begin();
}
if ((GetTypeId() == TYPEID_UNIT) && HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
{ RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); }
}
void Unit::DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid)
@ -6619,9 +6622,6 @@ void Unit::ClearInCombat()
if (cThis->GetCreatureInfo()->UnitFlags & UNIT_FLAG_OOC_NOT_ATTACKABLE && !(cThis->GetTemporaryFactionFlags() & TEMPFACTION_TOGGLE_OOC_NOT_ATTACK))
{ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); }
if (cThis->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
{ RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); }
clearUnitState(UNIT_STAT_ATTACK_PLAYER);
}
}

View File

@ -566,8 +566,6 @@ void Map::Update(const uint32& t_diff)
for (std::vector<Creature*>::iterator it = _removeList.begin(); it != _removeList.end(); ++it)
{
if ((*it)->IsTappedBy(plr))
{ (*it)->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); }
(*it)->RemoveAurasByCaster(plr->GetObjectGuid());
(*it)->_removeAttacker(plr);
(*it)->GetHostileRefManager().deleteReference(plr);
@ -577,7 +575,6 @@ void Map::Update(const uint32& t_diff)
VisitNearbyCellsOf(*it, grid_object_update, world_object_update);
}
}
}
// non-player active objects