aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-01-22 15:00:55 -0300
committerariel- <ariel-@users.noreply.github.com>2018-01-22 15:00:55 -0300
commit7c9722a4ae08b5f283f6a085a411e37604a7da9f (patch)
treeae026035f31ecd0c4f6cece5294683d5de59d40c /src/server/game
parente315e41d36061fc88dfa09bfa0da1fbc0c00826f (diff)
Core/Entities: killed Creature::SetInCombatWithZone and replaced with AI version
Closes #12108 (again)
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp34
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
3 files changed, 3 insertions, 37 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 64845c6686e..d517b909816 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -994,7 +994,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsCreature(target))
{
- target->ToCreature()->SetInCombatWithZone();
+ Creature* creature = target->ToCreature();
+ if (creature->IsAIEnabled)
+ creature->AI()->DoZoneInCombat();
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature %u, target: %u", me->GetGUID().GetCounter(), target->GetGUID().GetCounter());
}
}
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 669946d88a5..043f65620b8 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2578,40 +2578,6 @@ void Creature::SendZoneUnderAttackMessage(Player* attacker)
sWorld->SendGlobalMessage(&data, nullptr, (enemy_team == ALLIANCE ? HORDE : ALLIANCE));
}
-void Creature::SetInCombatWithZone()
-{
- if (!CanHaveThreatList())
- {
- TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
- return;
- }
-
- Map* map = GetMap();
-
- if (!map->IsDungeon())
- {
- TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
- return;
- }
-
- Map::PlayerList const& PlList = map->GetPlayers();
-
- if (PlList.isEmpty())
- return;
-
- for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
- {
- if (Player* player = i->GetSource())
- {
- if (player->IsGameMaster())
- continue;
-
- if (player->IsAlive())
- EngageWithTarget(player);
- }
- }
-}
-
uint32 Creature::GetShieldBlockValue() const //dunno mob block value
{
return (getLevel()/2 + uint32(GetStat(STAT_STRENGTH)/20));
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index f9c25399f02..84d00777e9b 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -270,8 +270,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void SendZoneUnderAttackMessage(Player* attacker);
- void SetInCombatWithZone();
-
bool hasQuest(uint32 quest_id) const override;
bool hasInvolvedQuest(uint32 quest_id) const override;