Core/Entities: killed Creature::SetInCombatWithZone and replaced with AI version

Port From (https://github.com/TrinityCore/TrinityCore/commit/c77925da4a320df5be5eaeb1fc799df50e22c041)
This commit is contained in:
hondacrx
2021-06-23 14:15:43 -04:00
parent 0c527d206c
commit 84d05548f2
2 changed files with 3 additions and 31 deletions
+3 -1
View File
@@ -928,7 +928,9 @@ namespace Game.AI
{
if (IsCreature(target))
{
_me.SetInCombatWithZone();
Creature creature = target.ToCreature();
if (creature.IsAIEnabled)
creature.GetAI().DoZoneInCombat();
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {_me.GetGUID()}, Target: {target.GetGUID()}");
}
}
-30
View File
@@ -2446,36 +2446,6 @@ namespace Game.Entities
Global.WorldMgr.SendGlobalMessage(packet, null, (enemy_team == Team.Alliance ? Team.Horde : Team.Alliance));
}
public void SetInCombatWithZone()
{
if (!CanHaveThreatList())
{
Log.outError(LogFilter.Unit, "Creature entry {0} call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
return;
}
Map map = GetMap();
if (!map.IsDungeon())
{
Log.outError(LogFilter.Unit, "Creature entry {0} call SetInCombatWithZone for map (id: {1}) that isn't an instance.", GetEntry(), map.GetId());
return;
}
var PlList = map.GetPlayers();
if (PlList.Empty())
return;
foreach (var player in PlList)
{
if (player.IsGameMaster())
continue;
if (player.IsAlive())
EngageWithTarget(player);
}
}
public override bool HasSpell(uint spellId)
{
for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)