Skip to content

Commit

Permalink
Add gameobject chest aggro prototype on loot
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Dec 20, 2021
1 parent 0ebeaaf commit c243a43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/game/Entities/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,17 @@ void GameObject::Use(Unit* user, SpellEntry const* spellInfo)
if (!GetGOInfo()->chest.lockId)
SetLootState(GO_JUST_DEACTIVATED);

if (GetFaction())
{
UnitList targets;
MaNGOS::AnyFriendlyUnitInObjectRangeCheck check(this, nullptr, 5.f);
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, check);
Cell::VisitAllObjects(this, searcher, 5.f);
for (Unit* attacker : targets)
if (attacker->AI())
attacker->AI()->AttackStart(user);
}

return;
}
case GAMEOBJECT_TYPE_GENERIC: // 5
Expand Down

0 comments on commit c243a43

Please sign in to comment.