aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 50fa95337f6..c8dcd0d2414 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -2262,6 +2262,43 @@ void Creature::SendZoneUnderAttackMessage(Player* attacker)
sWorld.SendGlobalMessage(&data,NULL,(enemy_team==ALLIANCE ? HORDE : ALLIANCE));
}
+void Creature::SetInCombatWithZone()
+{
+ if (!CanHaveThreatList())
+ {
+ error_log("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
+ return;
+ }
+
+ Map* pMap = GetMap();
+
+ if (!pMap->IsDungeon())
+ {
+ error_log("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), pMap->GetId());
+ return;
+ }
+
+ Map::PlayerList const &PlList = pMap->GetPlayers();
+
+ if (PlList.isEmpty())
+ return;
+
+ for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
+ {
+ if (Player* pPlayer = i->getSource())
+ {
+ if (pPlayer->isGameMaster())
+ continue;
+
+ if (pPlayer->isAlive())
+ {
+ pPlayer->SetInCombatWith(this);
+ AddThreat(pPlayer, 0.0f);
+ }
+ }
+ }
+}
+
void Creature::_AddCreatureSpellCooldown(uint32 spell_id, time_t end_time)
{
m_CreatureSpellCooldowns[spell_id] = end_time;